[gnome-builder/wip/gtk4-port: 868/1774] tests: add more tests for shortcuts
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 868/1774] tests: add more tests for shortcuts
- Date: Mon, 11 Jul 2022 22:31:26 +0000 (UTC)
commit b2423c32e23e17d0effd26436e6a88bc3eafda73
Author: Christian Hergert <chergert redhat com>
Date: Tue May 3 18:13:51 2022 -0700
tests: add more tests for shortcuts
src/tests/test-shortcuts.c | 10 +++++++++-
src/tests/test-shortcuts.json | 9 +++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/tests/test-shortcuts.c b/src/tests/test-shortcuts.c
index 63245b736..e10f3c35d 100644
--- a/src/tests/test-shortcuts.c
+++ b/src/tests/test-shortcuts.c
@@ -77,12 +77,20 @@ test_parse_bundle (void)
g_assert_true (G_IS_LIST_MODEL (bundle));
g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (bundle)) == GTK_TYPE_SHORTCUT);
- g_assert_cmpint (g_list_model_get_n_items (G_LIST_MODEL (bundle)), ==, 1);
+ g_assert_cmpint (g_list_model_get_n_items (G_LIST_MODEL (bundle)), ==, 2);
+
+ shortcut = g_list_model_get_item (G_LIST_MODEL (bundle), pos++);
+ g_assert_nonnull (shortcut);
+ g_assert_true (GTK_IS_SHORTCUT (shortcut));
+ g_assert_false (gtk_shortcut_action_activate (gtk_shortcut_get_action (shortcut), 0, widget, NULL));
+ g_assert_cmpint (state.open, ==, 0);
+ g_object_unref (shortcut);
shortcut = g_list_model_get_item (G_LIST_MODEL (bundle), pos++);
g_assert_nonnull (shortcut);
g_assert_true (GTK_IS_SHORTCUT (shortcut));
g_assert_true (gtk_shortcut_action_activate (gtk_shortcut_get_action (shortcut), 0, widget, NULL));
+ g_assert_cmpint (state.open, ==, 1);
g_object_unref (shortcut);
shortcut = g_list_model_get_item (G_LIST_MODEL (bundle), pos++);
diff --git a/src/tests/test-shortcuts.json b/src/tests/test-shortcuts.json
index b90ab9827..b9a4ad23c 100644
--- a/src/tests/test-shortcuts.json
+++ b/src/tests/test-shortcuts.json
@@ -1,9 +1,14 @@
[
{
"action" : "test.open",
- /* This doesn't work yet */
- "when" : "true",
+ "when" : "true && false",
"trigger" : "<ctrl>o",
"phase" : "bubble"
+ },
+ {
+ "action" : "test.open",
+ "when" : "false || true",
+ "trigger" : "<ctrl>p",
+ "phase" : "capture"
}
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]