summaryrefslogtreecommitdiff
path: root/tests/testboundaries_ucd.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-05-31 18:02:03 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-05-31 18:03:53 -0400
commite17b595e3bacfb7333bab6fcd1c62d05e7228936 (patch)
tree53137441a64f82e316138ab44bc847cecb0d0c76 /tests/testboundaries_ucd.c
parent6c16dfe8ad012a2551d0270a0325574e9ce3cef7 (diff)
downloadpango-e17b595e3bacfb7333bab6fcd1c62d05e7228936.tar.gz
Make tests installable
This ensures that tests are run continuously on ostree.gnome.org.
Diffstat (limited to 'tests/testboundaries_ucd.c')
-rw-r--r--tests/testboundaries_ucd.c65
1 files changed, 47 insertions, 18 deletions
diff --git a/tests/testboundaries_ucd.c b/tests/testboundaries_ucd.c
index e7f742b3..d9019c63 100644
--- a/tests/testboundaries_ucd.c
+++ b/tests/testboundaries_ucd.c
@@ -215,7 +215,7 @@ make_test_string (gchar *string,
}
static void
-do_test (gchar *filename,
+do_test (const gchar *filename,
AttrBits bits,
gboolean fixup_broken_linebreaktest)
{
@@ -322,43 +322,72 @@ done:
g_io_channel_unref (channel);
if (error)
g_error_free (error);
- g_free (filename);
+
+ g_assert (!failed);
}
-gint
-main (gint argc,
- gchar **argv)
+static void
+test_grapheme_break (void)
{
- gchar *srcdir;
- gchar *filename;
+ const gchar *filename;
AttrBits bits;
- setlocale (LC_ALL, "");
-
- srcdir = getenv ("srcdir");
- if (!srcdir)
- srcdir = ".";
-
- filename = g_strdup_printf ("%s/GraphemeBreakTest.txt", srcdir);
+ filename = g_test_get_filename (G_TEST_DIST, "GraphemeBreakTest.txt", NULL);
bits.bits = 0;
bits.attr.is_cursor_position = 1;
do_test (filename, bits, FALSE);
+}
- filename = g_strdup_printf ("%s/WordBreakTest.txt", srcdir);
+static void
+test_word_break (void)
+{
+ const gchar *filename;
+ AttrBits bits;
+
+ filename = g_test_get_filename (G_TEST_DIST, "WordBreakTest.txt", NULL);
bits.bits = 0;
bits.attr.is_word_boundary = 1;
do_test (filename, bits, FALSE);
+}
- filename = g_strdup_printf ("%s/SentenceBreakTest.txt", srcdir);
+static void
+test_sentence_break (void)
+{
+ const gchar *filename;
+ AttrBits bits;
+
+ filename = g_test_get_filename (G_TEST_DIST, "SentenceBreakTest.txt", NULL);
bits.bits = 0;
bits.attr.is_sentence_boundary = 1;
do_test (filename, bits, FALSE);
+}
+
+static void
+test_line_break (void)
+{
+ const gchar *filename;
+ AttrBits bits;
- filename = g_strdup_printf ("%s/LineBreakTest.txt", srcdir);
+ filename = g_test_get_filename (G_TEST_DIST, "LineBreakTest.txt", NULL);
bits.bits = 0;
bits.attr.is_line_break = 1;
bits.attr.is_mandatory_break = 1;
do_test (filename, bits, TRUE);
+}
+
+
+gint
+main (gint argc,
+ gchar **argv)
+{
+ setlocale (LC_ALL, "");
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/text/break/grapheme", test_grapheme_break);
+ g_test_add_func ("/text/break/word", test_word_break);
+ g_test_add_func ("/text/break/sentence", test_sentence_break);
+ g_test_add_func ("/text/break/line", test_line_break);
- exit (failed);
+ return g_test_run ();
}