diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-03-02 23:29:21 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-03-02 23:29:21 +0000 |
commit | 2169f50919be21b48fe1916af7ab663ac8d0b1a7 (patch) | |
tree | 76a65660c32ea782d4f3ef09312e13782e8ac532 /tests | |
parent | 2140cee8c86eaded329ed3d45650f07e73af05b6 (diff) | |
download | gtk+-2169f50919be21b48fe1916af7ab663ac8d0b1a7.tar.gz |
Add an animation mode, to test how the combobox behaves if the model
Wed Mar 3 00:28:59 2004 Matthias Clasen <maclas@gmx.de>
* tests/testcombochange.c: Add an animation mode, to test
how the combobox behaves if the model changes while it is popped
up.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testcombochange.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/tests/testcombochange.c b/tests/testcombochange.c index 97224b3729..965460f551 100644 --- a/tests/testcombochange.c +++ b/tests/testcombochange.c @@ -155,11 +155,11 @@ on_reorder (void) for (i = 0; i < contents->len; i++) shuffle_array[i] = i; - for (i = 0; i < contents->len - 1; i++) + for (i = 0; i + 1 < contents->len; i++) { gint pos = g_random_int_range (i, contents->len); gint tmp; - + tmp = shuffle_array[i]; shuffle_array[i] = shuffle_array[pos]; shuffle_array[pos] = tmp; @@ -179,6 +179,37 @@ on_reorder (void) g_free (shuffle_array); } +static int n_animations = 0; +static int timer = 0; + +static gint +animation_timer (gpointer data) +{ + switch (g_random_int_range (0, 3)) + { + case 0: + on_insert (); + break; + case 1: + on_delete (); + break; + case 2: + on_reorder (); + break; + } + + n_animations--; + return n_animations > 0; +} + +static void +on_animate (void) +{ + n_animations += 20; + + timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL); +} + int main (int argc, char **argv) { @@ -262,6 +293,10 @@ main (int argc, char **argv) gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0); g_signal_connect (button, "clicked", G_CALLBACK (on_reorder), NULL); + button = align_button_new ("Animate"); + gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0); + g_signal_connect (button, "clicked", G_CALLBACK (on_animate), NULL); + gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); |