summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-05 22:00:21 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-06 01:09:46 -0400
commit0c31ef6a246a893b5106618b2761426a73ca2c56 (patch)
treedde49f231e5910ffcf0cf7c804a3f099bd8e45e0
parent5b987526b5e6780e565de647cc94820fc7c8d9d2 (diff)
downloadpango-0c31ef6a246a893b5106618b2761426a73ca2c56.tar.gz
tests: Print layout directions too
Make test-layout print the values returned by pango_layout_get_direction too. Update expected test results to match.
-rw-r--r--tests/layouts/valid-1.expected4
-rw-r--r--tests/layouts/valid-2.expected4
-rw-r--r--tests/layouts/valid-3.expected4
-rw-r--r--tests/layouts/valid-4.expected4
-rw-r--r--tests/layouts/valid-5.expected4
-rw-r--r--tests/layouts/valid-6.expected4
-rw-r--r--tests/test-layout.c20
7 files changed, 44 insertions, 0 deletions
diff --git a/tests/layouts/valid-1.expected b/tests/layouts/valid-1.expected
index 292d6f43..cbd07127 100644
--- a/tests/layouts/valid-1.expected
+++ b/tests/layouts/valid-1.expected
@@ -15,6 +15,10 @@ range 22 41
[22,41]underline=1
range 41 2147483647
+--- directions
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr 'This is a test of the automatic emergency brake!
diff --git a/tests/layouts/valid-2.expected b/tests/layouts/valid-2.expected
index 2efc56fe..4b8e793d 100644
--- a/tests/layouts/valid-2.expected
+++ b/tests/layouts/valid-2.expected
@@ -16,6 +16,10 @@ range 20 25
[20,25]underline=1
range 25 2147483647
+--- directions
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr 'test the blue drink after dinner
diff --git a/tests/layouts/valid-3.expected b/tests/layouts/valid-3.expected
index 247c61bf..e8a4d095 100644
--- a/tests/layouts/valid-3.expected
+++ b/tests/layouts/valid-3.expected
@@ -10,6 +10,10 @@ lines: 2
range 0 2147483647
+--- directions
+
+0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr 'ABC😀️D
diff --git a/tests/layouts/valid-4.expected b/tests/layouts/valid-4.expected
index 66796cb5..33e01d8b 100644
--- a/tests/layouts/valid-4.expected
+++ b/tests/layouts/valid-4.expected
@@ -11,6 +11,10 @@ width: 192512
range 0 2147483647
+--- directions
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr 'This paragraph should ac­tual­'
diff --git a/tests/layouts/valid-5.expected b/tests/layouts/valid-5.expected
index 5c6fa749..4568137f 100644
--- a/tests/layouts/valid-5.expected
+++ b/tests/layouts/valid-5.expected
@@ -15,6 +15,10 @@ range 21 31
[21,31]font-features=tnum=1
range 31 2147483647
+--- directions
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr 'A test with multiple '
diff --git a/tests/layouts/valid-6.expected b/tests/layouts/valid-6.expected
index b8f90c34..0f81967f 100644
--- a/tests/layouts/valid-6.expected
+++ b/tests/layouts/valid-6.expected
@@ -10,6 +10,10 @@ lines: 2
range 0 2147483647
+--- directions
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
--- lines
i=1, index=0, paragraph-start=1, dir=ltr ' 0️⃣ Keycap Digit Zero
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 9c5d13a0..70dfc3d1 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -178,6 +178,19 @@ dump_runs (PangoLayout *layout, GString *string)
}
static void
+dump_directions (PangoLayout *layout, GString *string)
+{
+ const char *text, *p;
+
+ text = pango_layout_get_text (layout);
+ for (p = text; *p; p = g_utf8_next_char (p))
+ {
+ g_string_append_printf (string, "%d ", pango_layout_get_direction (layout, p - text));
+ }
+ g_string_append (string, "\n");
+}
+
+static void
parse_params (const gchar *str,
gint *width,
gint *ellipsize_at,
@@ -266,16 +279,23 @@ test_file (const gchar *filename, GString *string)
pango_layout_set_wrap (layout, wrap);
g_string_append (string, pango_layout_get_text (layout));
+
g_string_append (string, "\n--- parameters\n\n");
g_string_append_printf (string, "wrapped: %d\n", pango_layout_is_wrapped (layout));
g_string_append_printf (string, "ellipsized: %d\n", pango_layout_is_ellipsized (layout));
g_string_append_printf (string, "lines: %d\n", pango_layout_get_line_count (layout));
if (width != 0)
g_string_append_printf (string, "width: %d\n", pango_layout_get_width (layout));
+
g_string_append (string, "\n--- attributes\n\n");
print_attr_list (pango_layout_get_attributes (layout), string);
+
+ g_string_append (string, "\n--- directions\n\n");
+ dump_directions (layout, string);
+
g_string_append (string, "\n--- lines\n\n");
dump_lines (layout, string);
+
g_string_append (string, "\n--- runs\n\n");
dump_runs (layout, string);