[pango/test-for-564] Add a testcase for pango_attr_list_change




commit cbeaceced0cc728312ed834a2f4f41fa6a68fd01
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 9 07:12:34 2021 -0400

    Add a testcase for pango_attr_list_change
    
    This recreates the scenario described in #564.
    It works fine.

 tests/testattributes.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/tests/testattributes.c b/tests/testattributes.c
index 26277b56..849e47cb 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -258,6 +258,27 @@ test_list_change (void)
   pango_attr_list_unref (list);
 }
 
+/* See https://gitlab.gnome.org/GNOME/pango/-/issues/564 */
+static void
+test_list_change2 (void)
+{
+  PangoAttrList *list;
+  PangoAttribute *attr;
+
+  list = attributes_from_string ("[6,11]weight=700\n"
+                                 "[18,23]weight=700\n");
+
+  /* insertion with joining */
+  attr = pango_attr_weight_new (700);
+  attr->start_index = 0;
+  attr->end_index = 29;
+  pango_attr_list_change (list, attr);
+
+  assert_attr_list (list, "[0,29]weight=700\n");
+
+  pango_attr_list_unref (list);
+}
+
 static void
 test_list_splice (void)
 {
@@ -1003,6 +1024,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/attributes/register", test_attributes_register);
   g_test_add_func ("/attributes/list/basic", test_list);
   g_test_add_func ("/attributes/list/change", test_list_change);
+  g_test_add_func ("/attributes/list/change2", test_list_change2);
   g_test_add_func ("/attributes/list/splice", test_list_splice);
   g_test_add_func ("/attributes/list/splice2", test_list_splice2);
   g_test_add_func ("/attributes/list/splice3", test_list_splice3);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]