[gtk/shortcut-action-parse: 2/2] testsuite: Add tests for parsing shortcut actions



commit 6b292af6acb6efc621b1585c7615f23cad7852a1
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 3 22:42:00 2020 -0400

    testsuite: Add tests for parsing shortcut actions

 testsuite/gtk/shortcuts.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/testsuite/gtk/shortcuts.c b/testsuite/gtk/shortcuts.c
index 1f235b71ff..916a8f0424 100644
--- a/testsuite/gtk/shortcuts.c
+++ b/testsuite/gtk/shortcuts.c
@@ -441,6 +441,32 @@ test_action_activate (void)
   g_object_unref (widget);
 }
 
+static void
+test_action_parse (void)
+{
+  GtkShortcutAction *action;
+
+  action = gtk_shortcut_action_parse_string ("nothing");
+  g_assert_true (GTK_IS_NOTHING_ACTION (action));
+  g_object_unref (action);
+
+  action = gtk_shortcut_action_parse_string ("activate");
+  g_assert_true (GTK_IS_ACTIVATE_ACTION (action));
+  g_object_unref (action);
+
+  action = gtk_shortcut_action_parse_string ("mnemonic-activate");
+  g_assert_true (GTK_IS_MNEMONIC_ACTION (action));
+  g_object_unref (action);
+
+  action = gtk_shortcut_action_parse_string ("action(win.dark)");
+  g_assert_true (GTK_IS_NAMED_ACTION (action));
+  g_object_unref (action);
+
+  action = gtk_shortcut_action_parse_string ("signal(frob)");
+  g_assert_true (GTK_IS_SIGNAL_ACTION (action));
+  g_object_unref (action);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -456,6 +482,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/shortcuts/trigger/trigger", test_trigger_trigger);
   g_test_add_func ("/shortcuts/action/basic", test_action_basic);
   g_test_add_func ("/shortcuts/action/activate", test_action_activate);
+  g_test_add_func ("/shortcuts/action/parse", test_action_parse);
 
   return g_test_run ();
 }


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