summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-01-17 10:21:06 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-01-17 10:59:33 +0100
commit2af0b0f5dae88469113e5b10ccd8405f041bf109 (patch)
tree11d6adc8195a7ab082b9a45e26a810a2dee0b55a /test
parenta35180714798ace2299aad531e2eacfa7968f16e (diff)
test: Add white-in-noop
Exercise an incorrect optimization in cairo-surface.c. It replaces with a noop any region-based fill with solid white source and an IN operator.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/white-in-noop.c52
-rw-r--r--test/white-in-noop.ref.pngbin0 -> 95 bytes
3 files changed, 53 insertions, 0 deletions
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 9e5e4d2bb..76a527306 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -293,6 +293,7 @@ test_sources = \
user-font-mask.c \
user-font-proxy.c \
user-font-rescale.c \
+ white-in-noop.c \
xcomposite-projection.c \
xlib-expose-event.c \
zero-alpha.c \
diff --git a/test/white-in-noop.c b/test/white-in-noop.c
new file mode 100644
index 000000000..e6a93e801
--- /dev/null
+++ b/test/white-in-noop.c
@@ -0,0 +1,52 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright 2011 Andrea Canciani
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Andrea Canciani <ranma42@gmail.com>
+ */
+
+#include "cairo-test.h"
+
+#define HEIGHT 4
+#define WIDTH 4
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_paint (cr);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_IN);
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (white_in_noop,
+ "Test an invalid optimization of the IN operator with white sources",
+ "operator", /* keywords */
+ NULL, /* requirements */
+ WIDTH, HEIGHT,
+ NULL, draw)
diff --git a/test/white-in-noop.ref.png b/test/white-in-noop.ref.png
new file mode 100644
index 000000000..f42bb8d5f
--- /dev/null
+++ b/test/white-in-noop.ref.png
Binary files differ