[pango/wip/baedert/for-master: 53/53] tests: Add some tests for pango_attr_list_equal
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/wip/baedert/for-master: 53/53] tests: Add some tests for pango_attr_list_equal
- Date: Wed, 10 Jun 2020 04:13:25 +0000 (UTC)
commit 45d18265d1f13a736d607f527f5d033b191f7b96
Author: Timm Bäder <mail baedert org>
Date: Wed Jun 10 06:11:48 2020 +0200
tests: Add some tests for pango_attr_list_equal
tests/testattributes.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
---
diff --git a/tests/testattributes.c b/tests/testattributes.c
index 6b5e849b..068083eb 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -618,6 +618,48 @@ test_list_update (void)
pango_attr_list_unref (list);
}
+static void
+test_list_equal (void)
+{
+ PangoAttrList *list1, *list2;
+ PangoAttribute *attr;
+
+ list1 = pango_attr_list_new ();
+ list2 = pango_attr_list_new ();
+
+ attr = pango_attr_size_new (10 * PANGO_SCALE);
+ attr->start_index = 0;
+ attr->end_index = 7;
+ pango_attr_list_insert (list1, pango_attribute_copy (attr));
+ pango_attr_list_insert (list2, pango_attribute_copy (attr));
+ pango_attribute_destroy (attr);
+
+ g_assert_true (pango_attr_list_equal (list1, list2));
+
+ attr = pango_attr_stretch_new (PANGO_STRETCH_CONDENSED);
+ attr->start_index = 0;
+ attr->end_index = 1;
+ pango_attr_list_insert (list1, pango_attribute_copy (attr));
+ g_assert_true (!pango_attr_list_equal (list1, list2));
+
+ pango_attr_list_insert (list2, pango_attribute_copy (attr));
+ g_assert_true (pango_attr_list_equal (list1, list2));
+ pango_attribute_destroy (attr);
+
+ attr = pango_attr_size_new (30 * PANGO_SCALE);
+ /* Same range as the first attribute */
+ attr->start_index = 0;
+ attr->end_index = 7;
+ pango_attr_list_insert (list2, pango_attribute_copy (attr));
+ g_assert_true (!pango_attr_list_equal (list1, list2));
+ pango_attr_list_insert (list1, pango_attribute_copy (attr));
+ g_assert_true (pango_attr_list_equal (list1, list2));
+ pango_attribute_destroy (attr);
+
+ pango_attr_list_unref (list1);
+ pango_attr_list_unref (list2);
+}
+
int
main (int argc, char *argv[])
{
@@ -630,6 +672,7 @@ main (int argc, char *argv[])
g_test_add_func ("/attributes/list/splice", test_list_splice);
g_test_add_func ("/attributes/list/filter", test_list_filter);
g_test_add_func ("/attributes/list/update", test_list_update);
+ g_test_add_func ("/attributes/list/equal", test_list_equal);
g_test_add_func ("/attributes/iter/basic", test_iter);
g_test_add_func ("/attributes/iter/get", test_iter_get);
g_test_add_func ("/attributes/iter/get_font", test_iter_get_font);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]