summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-14 00:14:29 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-14 01:55:39 -0500
commit0275c123f9dd2872c10752423e76a27cf5acc80e (patch)
treecfc30297fb25af588c42ed44ad87e9905522c3e5
parent5b5bb1102df82495a9899c1e6c70e05741eeb475 (diff)
downloadpango-0275c123f9dd2872c10752423e76a27cf5acc80e.tar.gz
Add a test for tab array serialization
-rw-r--r--tests/testserializer.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/testserializer.c b/tests/testserializer.c
index 6390dbcc..0c0a15c6 100644
--- a/tests/testserializer.c
+++ b/tests/testserializer.c
@@ -77,7 +77,7 @@ test_roundtrip (void)
}
static void
-test_attr_list_deserialize (void)
+test_attr_list_serialize (void)
{
PangoAttrList *attrs;
const char *text = "0 10 foreground red, 5 15 weight 6, 0 200 font-desc \"Sans Small-Caps 10\"";
@@ -109,13 +109,36 @@ test_attr_list_deserialize (void)
}
}
+static void
+test_tab_array_serialize (void)
+{
+ const char *text[] = {
+ "0 10 100 200 400",
+ "0px 10px 100px 200px 400px",
+ };
+
+ for (int i = 0; i < G_N_ELEMENTS (text); i++)
+ {
+ PangoTabArray *tabs;
+ char *str;
+
+ tabs = pango_tab_array_from_string (text[i]);
+ g_assert_nonnull (tabs);
+ str = pango_tab_array_to_string (tabs);
+ g_assert_cmpstr (str, ==, text[i]);
+ g_free (str);
+ pango_tab_array_free (tabs);
+ }
+}
+
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/layout/roundtrip", test_roundtrip);
- g_test_add_func ("/attrlist/serialize", test_attr_list_deserialize);
+ g_test_add_func ("/serialize/layout", test_roundtrip);
+ g_test_add_func ("/serialize/attributes", test_attr_list_serialize);
+ g_test_add_func ("/serialize/tabs", test_tab_array_serialize);
return g_test_run ();
}