filechooserbutton: In the tests, run through the dialog more than one time

This ensures that data maintained by the button while the dialog opens/closes remains consistent.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
Federico Mena Quintero 2013-02-20 18:28:59 -06:00
parent ac5cc19836
commit cefcafc508

View File

@ -382,6 +382,8 @@ test_file_chooser_button (gconstpointer data)
GtkWidget *window;
GtkWidget *fc_button;
GtkWidget *fc_dialog;
int iterations;
int i;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -398,6 +400,17 @@ test_file_chooser_button (gconstpointer data)
gtk_widget_show_all (window);
wait_for_idle ();
/* If there is a dialog to be opened, we actually test going through it a
* couple of times. This ensures that any state that the button frobs for
* each appearance of the dialog will make sense.
*/
if (setup->open_dialog)
iterations = 2;
else
iterations = 1;
for (i = 0; i < iterations; i++)
{
if (setup->open_dialog)
{
GList *children;
@ -447,6 +460,7 @@ test_file_chooser_button (gconstpointer data)
g_assert_cmpstr (filename, ==, setup->final_filename);
g_free (filename);
}
}
gtk_widget_destroy (window);
}