summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-07 18:10:00 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-07 18:14:25 -0400
commit628c950fa07e31d01f33c1a17e6772f5b870e847 (patch)
tree4fd07364fafaff667ab3bf8fe1e0a4aefee76100 /tests
parentb6178a3122264809210dc257f553057c91f41a17 (diff)
downloadpango-628c950fa07e31d01f33c1a17e6772f5b870e847.tar.gz
tests: Dump grapheme boundaries too
Add grapheme boundaries to the output of test-break, so we can check those easily, too. Update expected test output for this.
Diffstat (limited to 'tests')
-rw-r--r--tests/breaks/eight.expected6
-rw-r--r--tests/breaks/five.expected6
-rw-r--r--tests/breaks/four.expected1
-rw-r--r--tests/breaks/nine.expected1
-rw-r--r--tests/breaks/one.expected1
-rw-r--r--tests/breaks/seven.expected6
-rw-r--r--tests/breaks/six.expected6
-rw-r--r--tests/breaks/ten.expected1
-rw-r--r--tests/breaks/three.expected1
-rw-r--r--tests/breaks/two.expected1
-rw-r--r--tests/test-break.c27
11 files changed, 52 insertions, 5 deletions
diff --git a/tests/breaks/eight.expected b/tests/breaks/eight.expected
new file mode 100644
index 00000000..083ebeef
--- /dev/null
+++ b/tests/breaks/eight.expected
@@ -0,0 +1,6 @@
+Text: 我 能 吞 下 玻 璃 而 不 傷 身 體 [0x0a]
+Breaks: c lc lc lc lc lc lc lc lc lc lc c c
+Whitespace: w w
+Words: bs b b b b b b b b b b be b
+Sentences: bs e b
+Graphemes: b b b b b b b b b b b b b
diff --git a/tests/breaks/five.expected b/tests/breaks/five.expected
new file mode 100644
index 00000000..38dc88ff
--- /dev/null
+++ b/tests/breaks/five.expected
@@ -0,0 +1,6 @@
+Text: H e r e [ ] i s [ ] s o m e [ ] t e x t [ ] w i t h [ ] b r e a k - a f f e c t i n g [ ] a t t r i b u t e s . [0x0a]
+Breaks: c c c c c lc c c lc c c c c lc c c c c lc c
+Whitespace: x x x x x x w w
+Words: bs be bs be bs be bs be bs be bs be bs be bs be b b
+Sentences: bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/four.expected b/tests/breaks/four.expected
index 6d3d1ba4..100eae24 100644
--- a/tests/breaks/four.expected
+++ b/tests/breaks/four.expected
@@ -3,3 +3,4 @@ Breaks: c c c c lc c c c lc c c c lc c c c lc c c lc c c c c
Whitespace: x x x x x x x x x x x x x w w
Words: bs b b b bse b b be bse b b be bse b b b bse b b bse b b b be bse b b bse b b b bse b b b b b bse b b bse b b b bse b b b b bse b b bse b b bse b b b b b bse b b be bse b b b bse b b bse b b bse b b b bse b bse b b bse b b b bse b bse b bse b b bse b b bse b b bse b b bse b b b b bse b b b bse b b be bse b be bse b b b b b b bse b be bse b b b bse b bse b b b b bse bse bse b bse b b b b bse b b bse b b bse b b bse b bse b b bse b b b b b bse b be bse b b bse b bse b b b b b b b b bse b b bse b b bse b b b bse b be bse b b b bse b b bse b bse b bse bse b b b bse b b b bse b b bse b bse b b b b bse b b b bse b bse b b b be bse b b b b bse b be bse b b b b bse b b b bse b bse b b b b b b b b be bse b b bse b b b b bse b b b bse b be bse b b b be b
Sentences: bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/nine.expected b/tests/breaks/nine.expected
index 7f38803d..8ffac505 100644
--- a/tests/breaks/nine.expected
+++ b/tests/breaks/nine.expected
@@ -3,3 +3,4 @@ Breaks: c c lc c c lc c c lc c c c c lc c c lc c lc
Whitespace: x x x x x x x w x x x x x x x x x x x w x x x x x x x w x x x x x x x x x x w x x x x x x x w w
Words: bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be b bs be bs be bs be bs be b bs be bs be bs be bs be b
Sentences: bs e bs e bs e bs e bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/one.expected b/tests/breaks/one.expected
index 66c6bd48..165e2d13 100644
--- a/tests/breaks/one.expected
+++ b/tests/breaks/one.expected
@@ -3,3 +3,4 @@ Breaks: c c c c lc c c c lc c c c lc c c c c lc c c c c
Whitespace: x x w w
Words: bs be bs be bs be b bs be b
Sentences: bs e bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/seven.expected b/tests/breaks/seven.expected
new file mode 100644
index 00000000..8cd411a6
--- /dev/null
+++ b/tests/breaks/seven.expected
@@ -0,0 +1,6 @@
+Text: 나 는 [ ] 유 리 를 [ ] 먹 을 [ ] 수 [ ] 있 어 요 . [ ] 그 래 도 [ ] 아 프 지 [ ] 않 아 요 [0x0a]
+Breaks: c lc c lc lc lc c lc lc c lc c lc lc lc c c lc lc lc c lc lc lc c lc lc lc c c
+Whitespace: x x x x x x x w w
+Words: bs be bs be bs be bs be bs be b bs be bs be bs be b
+Sentences: bs e bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/six.expected b/tests/breaks/six.expected
new file mode 100644
index 00000000..fba8e60d
--- /dev/null
+++ b/tests/breaks/six.expected
@@ -0,0 +1,6 @@
+Text: मी [ ] का च [ ] खा ऊ [ ] श क तो , [ ] म ला [ ] ते [ ] दु ख त [ ] ना ह [0x0a] मैं [ ] काँ च [ ] खा [ ] स क ता [ ] हूँ , [ ] मु झे [ ] उ स [ ] से [ ] को ई [ ] पी डा [ ] न हीं [ ] हो त [0x0a] நா ன் [ ] க ண் ணா டி [ ] சா ப் பி டு வே ன் , [ ] அ த னா ல் [ ] எ ன க் கு [ ] ஒ ரு [ ] கே டு ம் [ ] வ ரா த [0x0a] ﻢ ﯾ ں [ ] ﮎ ﺎ ﻨ ﭼ [ ] ﮎ ھ ﺍ [ ] ﺲ ﮑ ﺗ ﺍ [ ] ہ ﻭ ں [ ] ﺍ ﻭ ﺭ [ ] ﻢ ﺟ ھ ے [ ] ﺖ ﮑ ﻠ ﯿ ﻓ [ ] ﻥ ہ ﯼ ں [ ] ہ ﻮ ﺘ ﯾ [ ] ۔ [0x0a] ﺰ ﻫ [ ] ﺶ ﻴ ﺸ ﻫ [ ] ﺥ ﻭ ړ ﻝ ې [ ] ﺶ ﻣ ، [ ] ﻪ ﻐ ﻫ [ ] ﻡ ﺍ [ ] ﻦ ﻫ [ ] ﺥ ﻭ ږ ﻮ ﻳ [0x0a]
+Breaks: c c lc c c lc c c lc c c c c lc c c lc c lc c c c lc c c c c lc c c lc c lc c c c lc c c lc c c lc c c lc c lc c c lc c c lc c c lc c c c c c lc c c c c lc c c c c c c c lc c c c c lc c c c c lc c c lc c c c lc c c c c c c c lc c c c c lc c c c lc c c c c lc c c c lc c c c lc c c c c lc c c c c c lc c c c c lc c c c c c c c c c lc c c c c lc c c c c c lc c c c lc c c c lc c c lc c c lc c c c c c c
+Whitespace: x x x x x x x w x x x x x x x x x x x w x x x x x x x w x x x x x x x x x x w x x x x x x x w w
+Words: bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be b bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be bs be b b bs be bs be bs be bs be b bs be bs be bs be bs be b
+Sentences: bs e bs e bs e bs e bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/ten.expected b/tests/breaks/ten.expected
index 29f46183..6577c9fb 100644
--- a/tests/breaks/ten.expected
+++ b/tests/breaks/ten.expected
@@ -3,3 +3,4 @@ Breaks: c c c lc c c c
Whitespace: x w w
Words: bs be bs be b
Sentences: bs e b
+Graphemes: b b b b b b b
diff --git a/tests/breaks/three.expected b/tests/breaks/three.expected
index 0e60f876..2ff60a9c 100644
--- a/tests/breaks/three.expected
+++ b/tests/breaks/three.expected
@@ -3,3 +3,4 @@ Breaks: c c c c lc c c c Lc c c c lc c c c c c c c c
Whitespace: x w x w w
Words: bs be bs be bs be bs be b
Sentences: bs e bs e b
+Graphemes: b b b b b b b b b b b b b b b b b b b b b b b
diff --git a/tests/breaks/two.expected b/tests/breaks/two.expected
index 7ff48c28..c7f983ee 100644
--- a/tests/breaks/two.expected
+++ b/tests/breaks/two.expected
@@ -3,3 +3,4 @@ Breaks: c c c c c c c c c c c
Whitespace: w w
Words: bs e s be b
Sentences: bs e b
+Graphemes: b b b b b b b b b b b
diff --git a/tests/test-break.c b/tests/test-break.c
index b06fb4c0..0158bd40 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -46,7 +46,7 @@ test_file (const gchar *filename, GString *string)
int len2;
char *p;
int i;
- GString *s1, *s2, *s3, *s4;
+ GString *s1, *s2, *s3, *s4, *s5;
int m;
char *test;
char *text;
@@ -73,6 +73,7 @@ test_file (const gchar *filename, GString *string)
pango_layout_set_text (layout, text, length);
pango_layout_set_attributes (layout, attributes);
+#if 0
if (pango_layout_get_unknown_glyphs_count (layout) > 0)
{
char *msg = g_strdup_printf ("Missing glyphs - skipping %s. Maybe fonts are missing?", filename);
@@ -87,6 +88,7 @@ test_file (const gchar *filename, GString *string)
g_free (text);
return FALSE;
}
+#endif
pango_layout_get_log_attrs (layout, &attrs, &len);
attrs2 = pango_layout_get_log_attrs_readonly (layout, &len2);
@@ -106,15 +108,17 @@ test_file (const gchar *filename, GString *string)
s2 = g_string_new ("Whitespace: ");
s3 = g_string_new ("Words:");
s4 = g_string_new ("Sentences:");
+ s5 = g_string_new ("Graphemes:");
g_string_append (string, "Text: ");
- m = MAX (MAX (s1->len, s2->len), MAX (s3->len, s4->len));
+ m = MAX (MAX (MAX (s1->len, s2->len), MAX (s3->len, s4->len)), s5->len);
g_string_append_printf (s1, "%*s", (int)(m - s1->len), "");
g_string_append_printf (s2, "%*s", (int)(m - s2->len), "");
g_string_append_printf (s3, "%*s", (int)(m - s3->len), "");
g_string_append_printf (s4, "%*s", (int)(m - s4->len), "");
+ g_string_append_printf (s5, "%*s", (int)(m - s5->len), "");
g_string_append_printf (string, "%*s", (int)(m - strlen ("Text: ")), "");
for (i = 0, p = text; i < len; i++, p = g_utf8_next_char (p))
@@ -124,6 +128,7 @@ test_file (const gchar *filename, GString *string)
int w = 0;
int o = 0;
int s = 0;
+ int g = 0;
if (log.is_mandatory_break)
{
@@ -183,14 +188,20 @@ test_file (const gchar *filename, GString *string)
g_string_append (s4, "e");
s++;
}
+ if (log.is_cursor_position)
+ {
+ g_string_append (s5, "b");
+ g++;
+ }
- m = MAX (MAX (b, w), MAX (o, s));
+ m = MAX (MAX (MAX (b, w), MAX (o, s)), g);
g_string_append_printf (string, "%*s", m, "");
g_string_append_printf (s1, "%*s", m - b, "");
g_string_append_printf (s2, "%*s", m - w, "");
g_string_append_printf (s3, "%*s", m - o, "");
g_string_append_printf (s4, "%*s", m - s, "");
+ g_string_append_printf (s5, "%*s", m - g, "");
if (i < len - 1)
{
@@ -202,6 +213,7 @@ test_file (const gchar *filename, GString *string)
g_string_append (s2, " ");
g_string_append (s3, " ");
g_string_append (s4, " ");
+ g_string_append (s5, " ");
}
else if (g_unichar_isgraph (ch) &&
!(g_unichar_type (ch) == G_UNICODE_LINE_SEPARATOR ||
@@ -212,6 +224,7 @@ test_file (const gchar *filename, GString *string)
g_string_append (s2, " ");
g_string_append (s3, " ");
g_string_append (s4, " ");
+ g_string_append (s5, " ");
}
else
{
@@ -221,6 +234,7 @@ test_file (const gchar *filename, GString *string)
g_string_append_printf (s2, "%*s", (int)strlen (str), "");
g_string_append_printf (s3, "%*s", (int)strlen (str), "");
g_string_append_printf (s4, "%*s", (int)strlen (str), "");
+ g_string_append_printf (s5, "%*s", (int)strlen (str), "");
g_free (str);
}
}
@@ -234,11 +248,14 @@ test_file (const gchar *filename, GString *string)
g_string_append (string, "\n");
g_string_append_len (string, s4->str, s4->len);
g_string_append (string, "\n");
+ g_string_append_len (string, s5->str, s5->len);
+ g_string_append (string, "\n");
g_string_free (s1, TRUE);
g_string_free (s2, TRUE);
g_string_free (s3, TRUE);
g_string_free (s4, TRUE);
+ g_string_free (s5, TRUE);
g_object_unref (layout);
g_free (attrs);
@@ -341,8 +358,8 @@ main (int argc, char *argv[])
if (strcmp (argv[1], "--legend") == 0)
{
g_print ("test-break uses the following symbols for log attrs\n\n");
- g_print ("Breaks: Words:\n"
- " L - mandatory break b - word boundary\n"
+ g_print ("Breaks: Words: Graphemes:\n"
+ " L - mandatory break b - word boundary b - grapheme boundary\n"
" l - line break s - word start\n"
" c - char break e - word end\n"
"\n"