tests: Update testcombochange test

GtkComboBox doesn't have list mode anymore, remove that.
This commit is contained in:
Alexander Mikhaylenko 2020-05-11 03:22:50 +05:00
parent 9efdf3c65c
commit 9af4a420a3

View File

@ -70,39 +70,6 @@ combochange_log (const char *fmt,
g_free (msg);
}
static GtkWidget *
create_combo (const char *name,
gboolean is_list)
{
GtkCellRenderer *cell_renderer;
GtkWidget *combo;
GtkCssProvider *provider;
GtkStyleContext *context;
gchar *css_data;
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
cell_renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
"text", 0, NULL);
gtk_widget_set_name (combo, name);
context = gtk_widget_get_style_context (combo);
provider = gtk_css_provider_new ();
css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
name, is_list ? "true" : "false");
gtk_css_provider_load_from_data (provider, css_data, -1);
g_free (css_data);
gtk_style_context_add_provider (context,
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
return combo;
}
static void
on_insert (void)
{
@ -230,10 +197,9 @@ main (int argc, char **argv)
GtkWidget *button_vbox;
GtkWidget *combo_vbox;
GtkWidget *button;
GtkWidget *menu_combo;
GtkWidget *label;
GtkWidget *list_combo;
GtkWidget *combo;
GtkCellRenderer *cell_renderer;
test_init ();
gtk_init ();
@ -254,21 +220,13 @@ main (int argc, char **argv)
combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), combo_vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<b>Menu mode</b>");
gtk_container_add (GTK_CONTAINER (combo_vbox), label);
menu_combo = create_combo ("menu-combo", FALSE);
gtk_widget_set_margin_start (menu_combo, 12);
gtk_container_add (GTK_CONTAINER (combo_vbox), menu_combo);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<b>List mode</b>");
gtk_container_add (GTK_CONTAINER (combo_vbox), label);
list_combo = create_combo ("list-combo", TRUE);
gtk_widget_set_margin_start (list_combo, 12);
gtk_container_add (GTK_CONTAINER (combo_vbox), list_combo);
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
cell_renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
"text", 0, NULL);
gtk_widget_set_margin_start (combo, 12);
gtk_container_add (GTK_CONTAINER (combo_vbox), combo);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled_window, TRUE);