[gtk] Add another action test
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] Add another action test
- Date: Sun, 23 Jun 2019 01:40:05 +0000 (UTC)
commit b903d8ee33487d09e908527be1a4d338e0d6065e
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 23 01:38:27 2019 +0000
Add another action test
Test that disabled actions aren't activated.
testsuite/gtk/action.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/testsuite/gtk/action.c b/testsuite/gtk/action.c
index 7d44e2fc5d..12dbb42542 100644
--- a/testsuite/gtk/action.c
+++ b/testsuite/gtk/action.c
@@ -388,6 +388,31 @@ test_introspection (void)
g_type_class_unref (class);
}
+/* Test that disabled actions don't get activated */
+static void
+test_enabled (void)
+{
+ GtkWidget *text;
+
+ text = gtk_text_new ();
+ g_signal_connect (text, "notify::visibility",
+ G_CALLBACK (visibility_toggled), NULL);
+
+ toggled = 0;
+
+ gtk_widget_activate_action (text, "misc.toggle-visibility", NULL);
+
+ g_assert_cmpint (toggled, ==, 1);
+
+ gtk_widget_action_set_enabled (text, "misc.toggle-visibility", FALSE);
+
+ gtk_widget_activate_action (text, "misc.toggle-visibility", NULL);
+
+ g_assert_cmpint (toggled, ==, 1);
+
+ gtk_widget_destroy (text);
+}
+
int
main (int argc,
char *argv[])
@@ -399,6 +424,7 @@ main (int argc,
g_test_add_func ("/action/overlap", test_overlap);
g_test_add_func ("/action/overlap2", test_overlap2);
g_test_add_func ("/action/introspection", test_introspection);
+ g_test_add_func ("/action/enabled", test_enabled);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]