[gtk/wip/otte/for-master] transform: Make sure the identity transform is equal to NULL
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master] transform: Make sure the identity transform is equal to NULL
- Date: Fri, 21 Feb 2020 17:32:04 +0000 (UTC)
commit b50093d044324ac9ed0cc39368a35a0733c41483
Author: Benjamin Otte <otte redhat com>
Date: Fri Feb 21 18:25:05 2020 +0100
transform: Make sure the identity transform is equal to NULL
gsk/gsktransform.c | 7 +++++--
testsuite/gsk/transform.c | 13 +++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c
index df6cb63bdd..19aa543b23 100644
--- a/gsk/gsktransform.c
+++ b/gsk/gsktransform.c
@@ -1683,8 +1683,11 @@ gsk_transform_equal (GskTransform *first,
if (first == second)
return TRUE;
- if (first == NULL || second == NULL)
- return FALSE;
+ if (first == NULL)
+ return gsk_transform_is_identity (second);
+
+ if (second == NULL)
+ return gsk_transform_is_identity (first);
if (first->transform_class != second->transform_class)
return FALSE;
diff --git a/testsuite/gsk/transform.c b/testsuite/gsk/transform.c
index 605d6f53cd..71ade76a49 100644
--- a/testsuite/gsk/transform.c
+++ b/testsuite/gsk/transform.c
@@ -332,6 +332,19 @@ test_identity (void)
g_free (string);
}
+static void
+test_identity_equal (void)
+{
+ GskTransform *id = gsk_transform_new ();
+
+ g_assert_true (gsk_transform_equal (NULL, NULL));
+ g_assert_true (gsk_transform_equal (id, NULL));
+ g_assert_true (gsk_transform_equal (NULL, id));
+ g_assert_true (gsk_transform_equal (id, id));
+
+ gsk_transform_unref (id);
+}
+
static void
test_print_parse (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]