[Pixman] [PATCH 1/2] Add test for _intersect_rect(<region>, <empty-rectangle>)

Bill McCloskey wmccloskey at mozilla.com
Tue Feb 2 17:35:28 PST 2016


This test ensures that calling _intersect_rect on an empty
rectangle produces an empty region.

Reviewed-by: Siarhei Siamashka <siarhei.siamashka at gmail.com>
---
 test/region-test.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/region-test.c b/test/region-test.c
index bfc219b..e5743e8 100644
--- a/test/region-test.c
+++ b/test/region-test.c
@@ -116,10 +116,19 @@ main ()

        assert (pixman_region32_equal (&r1, &r2));
        pixman_region32_fini (&r1);
        pixman_region32_fini (&r2);

     }
     pixman_image_unref (fill);

+    /* This would produce a region containing an empty
+     * rectangle in it. Such regions are considered malformed,
+     * but using an empty rectangle for initialization should
+     * work.
+     */
+    pixman_region32_init_rects (&r1, boxes, 3);
+    pixman_region32_intersect_rect (&r1, &r1, 11, 11, 0, 0);
+    assert (!pixman_region32_not_empty(&r1));
+
     return 0;
 }
-- 
2.7.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20160202/86c3dc3a/attachment.html>


More information about the Pixman mailing list