[cairo-commit] test/Makefile.sources test/white-in-noop.c test/white-in-noop.ref.png
Andrea Canciani
ranma42 at kemper.freedesktop.org
Mon Jan 17 02:03:16 PST 2011
test/Makefile.sources | 1
test/white-in-noop.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
test/white-in-noop.ref.png |binary
3 files changed, 53 insertions(+)
New commits:
commit 2af0b0f5dae88469113e5b10ccd8405f041bf109
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Mon Jan 17 10:21:06 2011 +0100
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.
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 0000000..f42bb8d
Binary files /dev/null and b/test/white-in-noop.ref.png differ
More information about the cairo-commit
mailing list