[gtk/fix-action-muxer-parent-chain: 1/2] Add a test for reinserting action groups



commit f12d61b0552e09b761550c84e06506a98c586567
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 23 22:54:02 2019 +0000

    Add a test for reinserting action groups
    
    This is reproducing a crash that was seen
    in gnome-builder.

 testsuite/gtk/action.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/testsuite/gtk/action.c b/testsuite/gtk/action.c
index a21fa611b1..585753e10a 100644
--- a/testsuite/gtk/action.c
+++ b/testsuite/gtk/action.c
@@ -214,6 +214,26 @@ g_test_action_muxer (void)
 
 /* main */
 
+static void
+test_reinsert (void)
+{
+  GtkWidget *widget;
+  GActionGroup *group;
+
+  widget = gtk_label_new ("");
+  group = G_ACTION_GROUP (g_simple_action_group_new ());
+
+  gtk_widget_insert_action_group (widget, "test", group);
+  g_assert (gtk_widget_get_action_group (widget, "test") == group);
+
+  g_clear_object (&group);
+
+  group = gtk_widget_get_action_group (widget, "test");
+  gtk_widget_insert_action_group (widget, "test", group);
+
+  gtk_widget_destroy (widget);
+}
+
 int
 main (int    argc,
       char **argv)
@@ -227,6 +247,7 @@ main (int    argc,
               action_test_teardown);
 
   g_test_add_func ("/action/muxer/update-parent", g_test_action_muxer);
+  g_test_add_func ("/action/reinsert", test_reinsert);
 
   return g_test_run ();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]