From 3b15fb81fe0078cb70fe5ff128d53e1cb146d3c7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 17 Mar 2022 07:43:30 -0400 Subject: ci: Use the timeout multiplier when running tests --- .gitlab-ci/run-tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh index 683c031b..c071bd18 100755 --- a/.gitlab-ci/run-tests.sh +++ b/.gitlab-ci/run-tests.sh @@ -13,6 +13,7 @@ export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer export G_SLICE=always-malloc meson test -C ${builddir} \ + --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \ --print-errorlogs \ --suite=pango -- cgit v1.2.1 From b36001e880dc13ba4d782a4f2a4a58467284229d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 18 Mar 2022 23:25:14 -0400 Subject: Maintain order in pango_attr_list_change When PangoAttrList was changed to use an array, we lost the code that maintained non-decreasing order in pango_attr_list_change. Bring it back, and add a test for this. --- pango/pango-attributes.c | 3 +++ tests/testattributes.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 60d14706..4d7111fa 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -2184,6 +2184,9 @@ pango_attr_list_change (PangoAttrList *list, if (tmp_attr2->start_index >= tmp_attr->start_index) break; + + g_ptr_array_index (list->attributes, k - 1) = tmp_attr2; + g_ptr_array_index (list->attributes, k) = tmp_attr; } } } diff --git a/tests/testattributes.c b/tests/testattributes.c index d396269f..4a6b69b4 100644 --- a/tests/testattributes.c +++ b/tests/testattributes.c @@ -237,12 +237,32 @@ assert_attributes (GSList *attrs, pango_attr_list_unref (list2); } +static void +assert_attr_list_order (PangoAttrList *list) +{ + GSList *attrs, *l; + guint start = 0; + + attrs = pango_attr_list_get_attributes (list); + + for (l = attrs; l; l = l->next) + { + PangoAttribute *attr = l->data; + g_assert (start <= attr->start_index); + start = attr->start_index; + } + + g_slist_free_full (attrs, (GDestroyNotify) pango_attribute_destroy); +} + static void assert_attr_list (PangoAttrList *list, const char *expected) { PangoAttrList *list2; + assert_attr_list_order (list); + list2 = pango_attr_list_from_string (expected); if (!pango_attr_list_equal (list, list2)) { @@ -1355,6 +1375,29 @@ test_gnumeric_splice (void) pango_attr_list_unref (list2); } +static void +test_change_order (void) +{ + PangoAttrList *list; + PangoAttribute *attr; + + list = pango_attr_list_from_string ("1 -1 font-features \"tnum=1\"\n" + "0 20 font-desc \"sans-serif\"\n" + "0 9 size 102400\n"); + + attr = pango_attr_font_features_new ("tnum=2"); + attr->end_index = 9; + + pango_attr_list_change (list, attr); + + assert_attr_list (list, "0 9 font-features \"tnum=2\"\n" + "0 20 font-desc \"sans-serif\"\n" + "0 9 size 102400\n" + "9 4294967295 font-features \"tnum=1\"\n"); + + pango_attr_list_unref (list); +} + int main (int argc, char *argv[]) { @@ -1395,6 +1438,7 @@ main (int argc, char *argv[]) g_test_add_func ("/attributes/iter/get_attrs", test_iter_get_attrs); g_test_add_func ("/attributes/iter/epsilon_zero", test_iter_epsilon_zero); g_test_add_func ("/attributes/gnumeric-splice", test_gnumeric_splice); + g_test_add_func ("/attributes/list/change_order", test_change_order); return g_test_run (); } -- cgit v1.2.1