Skip to content

Commit

Permalink
Add a test for reinserting action groups
Browse files Browse the repository at this point in the history
This is reproducing a crash that was seen
in gnome-builder.
  • Loading branch information
Matthias Clasen committed Jun 24, 2019
1 parent 2169494 commit f8251a4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions testsuite/gtk/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ();
}

0 comments on commit f8251a4

Please sign in to comment.