[cairo] [PATCH 1/2] test: Add white-in-noop
Andrea Canciani
ranma42 at gmail.com
Mon Jan 17 01:45:23 PST 2011
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.
---
test/Makefile.sources | 1 +
test/white-in-noop.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
test/white-in-noop.ref.png | Bin 0 -> 95 bytes
3 files changed, 53 insertions(+), 0 deletions(-)
create mode 100644 test/white-in-noop.c
create mode 100644 test/white-in-noop.ref.png
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 9e5e4d2..76a5273 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 0000000..e6a93e8
--- /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 at 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 0000000000000000000000000000000000000000..f42bb8d5f3bbbfcb776cfa88a8109b08e8406e19
GIT binary patch
literal 95
zcmeAS at N?(olHy`uVBq!ia0vp^EFjFm1SHiab7}%9wj^(N7l!{JxM1({$v_biPZ!4!
oj+x1S{{OdU<}ol-V7w#4FfEUnl{q(~8Ys`;>FVdQ&MBb at 0HyF2`Tzg`
literal 0
HcmV?d00001
--
1.7.1
More information about the cairo
mailing list