testsuite: Stop using gtk_widget_show/hide

This commit is contained in:
Matthias Clasen 2022-11-29 07:07:01 -05:00
parent 6b83ded8f0
commit fba4cea2e8
14 changed files with 33 additions and 38 deletions

View File

@ -15,7 +15,7 @@ test_hidden (void)
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
gtk_widget_hide (widget);
gtk_widget_set_visible (widget, FALSE);
gtk_test_accessible_assert_state (widget, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);

View File

@ -19,7 +19,7 @@ window_state (void)
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, FALSE);
gtk_widget_hide (window);
gtk_widget_set_visible (window, FALSE);
gtk_test_accessible_assert_state (window, GTK_ACCESSIBLE_STATE_HIDDEN, TRUE);

View File

@ -98,7 +98,7 @@ load_ui_file (GFile *file, gboolean generate)
output = NULL;
g_signal_connect (window, "map", G_CALLBACK (style_context_changed), &output);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
while (!output)
g_main_context_iteration (NULL, FALSE);

View File

@ -86,7 +86,7 @@ load_ui_file (GFile *file, gboolean generate)
output = NULL;
g_signal_connect (window, "map", G_CALLBACK (style_context_changed), &output);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
while (!output)
g_main_context_iteration (NULL, FALSE);

View File

@ -115,7 +115,7 @@ load_ui_file (GFile *file, gboolean generate)
output = NULL;
g_signal_connect (window, "map", G_CALLBACK (style_context_changed), &output);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
while (!output)
g_main_context_iteration (NULL, FALSE);

View File

@ -30,7 +30,7 @@ main (int argc, char **argv)
G_CALLBACK (gtk_window_destroy), win);
gtk_window_set_child (GTK_WINDOW (win), but);
gtk_widget_show (win);
gtk_window_present (GTK_WINDOW (win));
gtk_test_widget_wait_for_draw (win);

View File

@ -18,7 +18,7 @@ show_and_wait (GtkWidget *widget)
gboolean done = FALSE;
g_timeout_add (500, main_loop_quit_cb, &done);
gtk_widget_show (widget);
gtk_widget_set_visible (widget, TRUE);
while (!done)
g_main_context_iteration (NULL, FALSE);
}

View File

@ -427,7 +427,7 @@ test_phases (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -479,7 +479,7 @@ test_mixed (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -538,7 +538,7 @@ test_early_exit (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -593,7 +593,7 @@ test_claim_capture (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -640,7 +640,7 @@ test_claim_target (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -687,7 +687,7 @@ test_claim_bubble (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -741,7 +741,7 @@ test_early_claim_capture (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -798,7 +798,7 @@ test_late_claim_capture (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -857,7 +857,7 @@ test_group (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -908,10 +908,10 @@ test_gestures_outside_grab (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
D = gtk_window_new ();
gtk_widget_show (D);
gtk_window_present (GTK_WINDOW (D));
str = g_string_new ("");
@ -968,7 +968,7 @@ test_gestures_inside_grab (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -1028,7 +1028,7 @@ test_multitouch_on_single (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -1079,7 +1079,7 @@ test_multitouch_activation (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");
@ -1155,7 +1155,7 @@ test_multitouch_interaction (void)
gtk_box_append (GTK_BOX (A), B);
gtk_box_append (GTK_BOX (B), C);
gtk_widget_show (A);
gtk_window_present (GTK_WINDOW (A));
str = g_string_new ("");

View File

@ -59,7 +59,6 @@ test_sort (void)
list = GTK_LIST_BOX (gtk_list_box_new ());
g_object_ref_sink (list);
gtk_widget_show (GTK_WIDGET (list));
for (i = 0; i < 100; i++)
{
@ -116,7 +115,6 @@ test_selection (void)
list = GTK_LIST_BOX (gtk_list_box_new ());
g_object_ref_sink (list);
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert_null (gtk_list_box_get_selected_row (list));
@ -204,7 +202,6 @@ test_multi_selection (void)
list = GTK_LIST_BOX (gtk_list_box_new ());
g_object_ref_sink (list);
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert_null (gtk_list_box_get_selected_rows (list));
@ -318,7 +315,6 @@ test_filter (void)
list = GTK_LIST_BOX (gtk_list_box_new ());
g_object_ref_sink (list);
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert_null (gtk_list_box_get_selected_row (list));
@ -410,7 +406,6 @@ test_header (void)
list = GTK_LIST_BOX (gtk_list_box_new ());
g_object_ref_sink (list);
gtk_widget_show (GTK_WIDGET (list));
g_assert_cmpint (gtk_list_box_get_selection_mode (list), ==, GTK_SELECTION_SINGLE);
g_assert_null (gtk_list_box_get_selected_row (list));

View File

@ -42,7 +42,7 @@ show_and_wait (GtkWidget *widget)
gboolean done = FALSE;
g_timeout_add (500, main_loop_quit_cb, &done);
gtk_widget_show (widget);
gtk_widget_set_visible (widget, TRUE);
while (!done)
g_main_context_iteration (NULL, FALSE);
}

View File

@ -79,7 +79,7 @@ generate_focus_chain (GtkWidget *window,
GtkWidget *focus;
int count = 0;
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
/* start without focus */
gtk_window_set_focus (GTK_WINDOW (window), NULL);
@ -203,7 +203,7 @@ load_ui_file (GFile *ui_file,
g_assert_nonnull (window);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
timeout_handle_id = g_timeout_add (2000,
quit_iteration_loop,

View File

@ -215,7 +215,7 @@ test_row_separator_height (void)
NULL);
gtk_window_set_child (GTK_WINDOW (window), tree_view);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
gtk_test_widget_wait_for_draw (window);

View File

@ -96,7 +96,7 @@ test_default_size (void)
g_assert_cmpint (w, ==, 300);
g_assert_cmpint (h, ==, 300);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
done = FALSE;
if (!interactive)
@ -131,8 +131,8 @@ test_default_size (void)
g_assert_cmpint (h, ==, 300);
/* check that even hide/show does not pull in the new default */
gtk_widget_hide (window);
gtk_widget_show (window);
gtk_widget_set_visible (window, FALSE);
gtk_widget_set_visible (window, TRUE);
done = FALSE;
if (!interactive)
@ -162,7 +162,7 @@ test_resize_popup (void)
g_assert_cmpint (w, ==, 1);
g_assert_cmpint (h, ==, 1);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
done = FALSE;
if (!interactive)
@ -190,7 +190,7 @@ test_show_hide (void)
window = gtk_window_new ();
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
done = FALSE;
if (!interactive)
@ -212,7 +212,7 @@ test_show_hide (void)
g_assert_cmpint (w, ==, w1);
g_assert_cmpint (h, ==, h1);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
done = FALSE;
if (!interactive)

View File

@ -312,7 +312,7 @@ reftest_snapshot_ui_file (const char *ui_file)
g_object_unref (builder);
g_assert_true (window);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
return snapshot_widget (window);
}