summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-02-01 21:52:42 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-02-01 21:59:21 -0500
commitecb072fdd0c705b3b1b22ef85b8916233721b12a (patch)
treeaa12d46bad98cf8cc79f71699a9518b0450bec30
parentef053ebb4a33fe315aeb4137d3266f3aeeb3033b (diff)
downloadgtk+-ecb072fdd0c705b3b1b22ef85b8916233721b12a.tar.gz
composetable: Check algorithmic matching
Just some spot checks, enough to verify the fix in the previous commit.
-rw-r--r--testsuite/gtk/composetable.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/gtk/composetable.c b/testsuite/gtk/composetable.c
index c1608e1af4..26659bf9f9 100644
--- a/testsuite/gtk/composetable.c
+++ b/testsuite/gtk/composetable.c
@@ -197,6 +197,51 @@ compose_table_match_compact (void)
g_assert_true (ch == 0x24d9); /* CIRCLED LATIN SMALL LETTER J */
}
+static void
+match_algorithmic (void)
+{
+ guint16 buffer[8] = { 0, };
+ gboolean ret;
+ gunichar ch;
+
+ buffer[0] = GDK_KEY_a;
+ buffer[1] = GDK_KEY_b;
+
+ ret = gtk_check_algorithmically (buffer, 2, &ch);
+ g_assert_false (ret);
+ g_assert_true (ch == 0);
+
+ buffer[0] = GDK_KEY_dead_abovering;
+ buffer[1] = GDK_KEY_A;
+
+ ret = gtk_check_algorithmically (buffer, 2, &ch);
+ g_assert_true (ret);
+ g_assert_true (ch == 0xc5);
+
+ buffer[0] = GDK_KEY_A;
+ buffer[1] = GDK_KEY_dead_abovering;
+
+ ret = gtk_check_algorithmically (buffer, 2, &ch);
+ g_assert_false (ret);
+ g_assert_true (ch == 0);
+
+ buffer[0] = GDK_KEY_dead_dasia;
+ buffer[1] = GDK_KEY_dead_perispomeni;
+ buffer[2] = GDK_KEY_Greek_alpha;
+
+ ret = gtk_check_algorithmically (buffer, 3, &ch);
+ g_assert_true (ret);
+ g_assert_true (ch == 0x1f07);
+
+ buffer[0] = GDK_KEY_dead_perispomeni;
+ buffer[1] = GDK_KEY_dead_dasia;
+ buffer[2] = GDK_KEY_Greek_alpha;
+
+ ret = gtk_check_algorithmically (buffer, 3, &ch);
+ g_assert_true (ret);
+ g_assert_true (ch == 0x1f07);
+}
+
int
main (int argc, char *argv[])
{
@@ -223,6 +268,7 @@ main (int argc, char *argv[])
g_test_add_data_func ("/compose-table/multi", "multi", compose_table_compare);
g_test_add_func ("/compose-table/match", compose_table_match);
g_test_add_func ("/compose-table/match-compact", compose_table_match_compact);
+ g_test_add_func ("/compose-table/match-algorithmic", match_algorithmic);
return g_test_run ();
}