summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-06-09 11:41:43 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-06-09 11:49:44 -0400
commitde880e25b3fde23cbaa2c87bb92df9c2662c7b4f (patch)
tree0557f8c65b9fc645761bfaaf2f7434ac4bb1e4f9
parent1f06c9154675fb6f956ecfadcf9dcdf790413c8e (diff)
downloadpango-fix-shape-tab-crash.tar.gz
Add a test for a crash in shape_tabfix-shape-tab-crash
This verifies the fix in the previous commit.
-rw-r--r--tests/meson.build1
-rw-r--r--tests/testmisc.c52
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/meson.build b/tests/meson.build
index 9b78fbfd..234fbf63 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -20,6 +20,7 @@ tests = [
[ 'testboundaries' ],
[ 'testboundaries_ucd' ],
[ 'testcolor' ],
+ [ 'testmisc', [ 'testmisc.c' ], [ libpangocairo_dep ] ],
[ 'testscript' ],
[ 'test-harfbuzz', [ 'test-harfbuzz.c' ], [ libpangocairo_dep ] ],
[ 'cxx-test', [ 'cxx-test.cpp' ], [ libpangocairo_dep ] ],
diff --git a/tests/testmisc.c b/tests/testmisc.c
new file mode 100644
index 00000000..a078944d
--- /dev/null
+++ b/tests/testmisc.c
@@ -0,0 +1,52 @@
+/* Pango
+ * testmisc.c: Test program for miscellaneous things
+ *
+ * Copyright (C) 2020 Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include <glib.h>
+#include <pango/pangocairo.h>
+
+/* test that we don't crash in shape_tab when the layout
+ * is such that we don't have effective attributes
+ */
+static void
+test_shape_tab_crash (void)
+{
+ PangoContext *context;
+ PangoLayout *layout;
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ layout = pango_layout_new (context);
+ pango_layout_set_text (layout, "one\ttwo", -1);
+ pango_layout_is_ellipsized (layout);
+
+ g_object_unref (layout);
+ g_object_unref (context);
+}
+
+int
+main (int argc, char *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/layout/shape-tab-crash", test_shape_tab_crash);
+
+ return g_test_run ();
+}