summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-12 21:39:29 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-14 15:33:26 -0500
commitfaba43776a844a458f0c47339e5b1f236ab66dc8 (patch)
treee0edbb00fa27bc2fb3159e00a9165dbc731f5a90
parent137aa66fcc07f73cb4d320146cedc74c0ee9bba9 (diff)
downloadpango-line-breaking-fixes.tar.gz
testrandom: Add other wrap modesline-breaking-fixes
-rw-r--r--tests/testrandom.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/testrandom.c b/tests/testrandom.c
index 9f132b92..643692ff 100644
--- a/tests/testrandom.c
+++ b/tests/testrandom.c
@@ -93,10 +93,10 @@ layout_check_size (PangoLayout *layout,
}
static void
-test_wrap_char (gconstpointer data)
+test_random (PangoDirection dir,
+ PangoWrapMode wrap)
{
#define N_SENTENCES 20
- PangoDirection dir = GPOINTER_TO_UINT (data);
PangoFontDescription *desc;
PangoContext *context;
PangoLayout *layout;
@@ -118,7 +118,7 @@ test_wrap_char (gconstpointer data)
if (g_test_verbose ())
g_print ("%s\n", sentence);
g_free (sentence);
- pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ pango_layout_set_wrap (layout, wrap);
layout_check_size (layout, -1, &max);
layout_check_size (layout, 0, &min);
@@ -176,6 +176,27 @@ test_wrap_char (gconstpointer data)
g_object_unref (context);
}
+static void
+test_wrap_word_char (gconstpointer data)
+{
+ PangoDirection dir = GPOINTER_TO_UINT (data);
+ test_random (dir, PANGO_WRAP_WORD_CHAR);
+}
+
+static void
+test_wrap_char (gconstpointer data)
+{
+ PangoDirection dir = GPOINTER_TO_UINT (data);
+ test_random (dir, PANGO_WRAP_CHAR);
+}
+
+static void
+test_wrap_word (gconstpointer data)
+{
+ PangoDirection dir = GPOINTER_TO_UINT (data);
+ test_random (dir, PANGO_WRAP_WORD);
+}
+
static gboolean
load_hunspell_words (GStrvBuilder *builder,
const char *language)
@@ -280,9 +301,15 @@ main (int argc, char *argv[])
rtl_words = init_rtl_words ();
n_rtl_words = g_strv_length (rtl_words);
+ g_test_add_data_func ("/layout/ltr/wrap-word-char", GUINT_TO_POINTER (PANGO_DIRECTION_LTR), test_wrap_word_char);
+ g_test_add_data_func ("/layout/rtl/wrap-word-char", GUINT_TO_POINTER (PANGO_DIRECTION_RTL), test_wrap_word_char);
+ g_test_add_data_func ("/layout/any/wrap-word-char", GUINT_TO_POINTER (PANGO_DIRECTION_NEUTRAL), test_wrap_word_char);
g_test_add_data_func ("/layout/ltr/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_LTR), test_wrap_char);
g_test_add_data_func ("/layout/rtl/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_RTL), test_wrap_char);
g_test_add_data_func ("/layout/any/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_NEUTRAL), test_wrap_char);
+ g_test_add_data_func ("/layout/ltr/wrap-word", GUINT_TO_POINTER (PANGO_DIRECTION_LTR), test_wrap_word);
+ g_test_add_data_func ("/layout/rtl/wrap-word", GUINT_TO_POINTER (PANGO_DIRECTION_RTL), test_wrap_word);
+ g_test_add_data_func ("/layout/any/wrap-word", GUINT_TO_POINTER (PANGO_DIRECTION_NEUTRAL), test_wrap_word);
result = g_test_run ();