summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-03 23:41:27 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-03 23:55:09 -0400
commit90777d89aa15fb2be260dc442d5cf4ce5a15234d (patch)
tree5cd902dae8f3e1140868b34a0d1b3f0d1a707664 /tests
parente2c1cdbec788875fe02d63d801ba022ee6d75db5 (diff)
downloadpango-90777d89aa15fb2be260dc442d5cf4ce5a15234d.tar.gz
itemize: Ignore width in horizontal contextignore-width-in-horizontal2
Changes in width only need to break runs in vertical context. Update tests and add a new test. Fixes: #503
Diffstat (limited to 'tests')
-rw-r--r--tests/layouts/valid-14.expected17
-rw-r--r--tests/layouts/valid-14.markup2
-rw-r--r--tests/layouts/valid-19.expected32
-rw-r--r--tests/layouts/valid-21.expected36
-rw-r--r--tests/layouts/valid-21.markup2
-rw-r--r--tests/test-layout.c14
6 files changed, 75 insertions, 28 deletions
diff --git a/tests/layouts/valid-14.expected b/tests/layouts/valid-14.expected
index 9c4d5111..0ab5dcb8 100644
--- a/tests/layouts/valid-14.expected
+++ b/tests/layouts/valid-14.expected
@@ -5,7 +5,7 @@
wrapped: 0
ellipsized: 1
lines: 2
-width: 166912
+width: 161792
--- attributes
@@ -29,11 +29,10 @@ i=2, index=38, paragraph-start=1, dir=ltr ''
i=1, index=0, chars=1, level=0, gravity=south, flags=2, font=OMITTED, script=common, language=en-us, '你'
[0,2147483647]fallback=1
-i=2, index=3, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=han, language=xx, '好'
-i=3, index=6, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=han, language=xx, ' '
-i=4, index=7, chars=6, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'Hello '
-i=5, index=19, chars=4, level=1, gravity=south, flags=0, font=OMITTED, script=hebrew, language=he, 'שלום'
-i=6, index=21, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=hebrew, language=he, ' '
-i=7, index=22, chars=8, level=0, gravity=south, flags=0, font=OMITTED, script=greek, language=el, 'Γειά σας'
-i=8, index=37, no run, line end
-i=9, index=38, no run, line end
+i=2, index=3, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=han, language=xx, '好 '
+i=3, index=7, chars=6, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'Hello '
+i=4, index=19, chars=4, level=1, gravity=south, flags=0, font=OMITTED, script=hebrew, language=he, 'שלום'
+i=5, index=21, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=hebrew, language=he, ' '
+i=6, index=22, chars=8, level=0, gravity=south, flags=0, font=OMITTED, script=greek, language=el, 'Γειά σας'
+i=7, index=37, no run, line end
+i=8, index=38, no run, line end
diff --git a/tests/layouts/valid-14.markup b/tests/layouts/valid-14.markup
index 48412c04..1d556d26 100644
--- a/tests/layouts/valid-14.markup
+++ b/tests/layouts/valid-14.markup
@@ -1,2 +1,2 @@
-line_spacing=1.5,width=163,ellipsize=start
+line_spacing=1.5,width=158,ellipsize=start
你好 Hello שלום Γειά σας
diff --git a/tests/layouts/valid-19.expected b/tests/layouts/valid-19.expected
index 1efc1d54..5e115e47 100644
--- a/tests/layouts/valid-19.expected
+++ b/tests/layouts/valid-19.expected
@@ -26,21 +26,17 @@ i=2, index=75, paragraph-start=1, dir=ltr ''
--- runs
-i=1, index=0, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' a'
-i=2, index=2, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '⃠'
-i=3, index=5, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=4, index=6, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '😊︎'
-i=5, index=13, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=6, index=14, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '😊️'
-i=7, index=21, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=8, index=22, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '🇩🇪'
-i=9, index=30, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=10, index=31, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '✊'
-i=11, index=34, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=12, index=35, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '✋🏾'
-i=13, index=42, chars=5, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' 0 # '
-i=14, index=47, chars=6, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '🏴󠁵󠁳󠁣󠁡󠁿'
-i=15, index=71, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
-i=16, index=72, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '©'
-i=17, index=74, no run, line end
-i=18, index=75, no run, line end
+i=1, index=0, chars=4, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' a⃠ '
+i=2, index=6, chars=3, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '😊︎ '
+i=3, index=14, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '😊️'
+i=4, index=21, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
+i=5, index=22, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '🇩🇪'
+i=6, index=30, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
+i=7, index=31, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '✊'
+i=8, index=34, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
+i=9, index=35, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '✋🏾'
+i=10, index=42, chars=5, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' 0 # '
+i=11, index=47, chars=6, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '🏴󠁵󠁳󠁣󠁡󠁿'
+i=12, index=71, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' ©'
+i=13, index=74, no run, line end
+i=14, index=75, no run, line end
diff --git a/tests/layouts/valid-21.expected b/tests/layouts/valid-21.expected
new file mode 100644
index 00000000..5999056f
--- /dev/null
+++ b/tests/layouts/valid-21.expected
@@ -0,0 +1,36 @@
+有一位住在石室裏的詩人叫施氏,abc, 愛吃獅子,決心要吃十隻獅子。
+
+--- parameters
+
+wrapped: 0
+ellipsized: 0
+lines: 2
+
+--- attributes
+
+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
+
+--- cursor positions
+
+0(0) 3(0) 6(0) 9(0) 12(0) 15(0) 18(0) 21(0) 24(0) 27(0) 30(0) 33(0) 36(0) 39(0) 42(0) 45(0) 46(0) 47(0) 48(0) 49(0) 50(0) 53(0) 56(0) 59(0) 62(0) 65(0) 68(0) 71(0) 74(0) 77(0) 80(0) 83(0) 86(0) 89(0) 89(1) 93(0)
+
+--- lines
+
+i=1, index=0, paragraph-start=1, dir=ltr '有一位住在石室裏的詩人叫施氏,abc, 愛吃獅子,決心要吃十隻獅子。
+'
+i=2, index=93, paragraph-start=1, dir=ltr ''
+
+--- runs
+
+i=1, index=0, chars=14, level=0, gravity=east, flags=1, font=OMITTED, script=han, language=xx, '有一位住在石室裏的詩人叫施氏'
+i=2, index=42, chars=1, level=0, gravity=east, flags=1, font=OMITTED, script=han, language=xx, ','
+i=3, index=45, chars=5, level=0, gravity=south, flags=1, font=OMITTED, script=latin, language=en-us, 'abc, '
+i=4, index=50, chars=4, level=0, gravity=east, flags=1, font=OMITTED, script=han, language=xx, '愛吃獅子'
+i=5, index=62, chars=1, level=0, gravity=east, flags=1, font=OMITTED, script=han, language=xx, ','
+i=6, index=65, chars=9, level=0, gravity=east, flags=1, font=OMITTED, script=han, language=xx, '決心要吃十隻獅子。'
+i=7, index=92, no run, line end
+i=8, index=93, no run, line end
diff --git a/tests/layouts/valid-21.markup b/tests/layouts/valid-21.markup
new file mode 100644
index 00000000..676a5e56
--- /dev/null
+++ b/tests/layouts/valid-21.markup
@@ -0,0 +1,2 @@
+gravity=east
+有一位住在石室裏的詩人叫施氏,abc, 愛吃獅子,決心要吃十隻獅子。
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 8a1054b4..f35d839e 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -221,6 +221,7 @@ typedef struct {
gboolean auto_dir;
gboolean single_paragraph;
PangoTabArray *tabs;
+ PangoGravity gravity;
} LayoutParams;
static void
@@ -238,6 +239,7 @@ init_params (LayoutParams *params)
params->auto_dir = TRUE;
params->single_paragraph = FALSE;
params->tabs = NULL;
+ params->gravity = PANGO_GRAVITY_AUTO;
}
static void
@@ -326,6 +328,16 @@ parse_params (const char *str,
}
g_strfreev (str3);
}
+ else if (strcmp (str2[0], "gravity") == 0)
+ {
+ eclass = g_type_class_ref (PANGO_TYPE_GRAVITY);
+ ev = g_enum_get_value_by_name (eclass, str2[1]);
+ if (!ev)
+ ev = g_enum_get_value_by_nick (eclass, str2[1]);
+ if (ev)
+ params->gravity = ev->value;
+ g_type_class_unref (eclass);
+ }
g_strfreev (str2);
}
@@ -425,6 +437,8 @@ test_file (const char *filename, GString *string)
parse_params (contents, &params);
+ pango_context_set_base_gravity (context, params.gravity);
+
pango_layout_set_width (layout, params.width > 0 ? params.width * PANGO_SCALE : -1);
pango_layout_set_height (layout, params.height > 0 ? params.height * PANGO_SCALE : params.height);
pango_layout_set_indent (layout, params.indent * PANGO_SCALE);