summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.sources1
-rw-r--r--test/colored-glyph.c66
-rw-r--r--test/reference/colored-glyph.image16.xfail.pngbin0 -> 1684 bytes
-rw-r--r--test/reference/colored-glyph.ref.pngbin0 -> 2514 bytes
-rw-r--r--test/reference/colored-glyph.xfail.pngbin0 -> 2046 bytes
5 files changed, 67 insertions, 0 deletions
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 1ae62464f..bfc025b77 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -80,6 +80,7 @@ test_sources = \
clipped-surface.c \
close-path.c \
close-path-current-point.c \
+ colored-glyph.c \
composite-integer-translate-source.c \
composite-integer-translate-over.c \
composite-integer-translate-over-repeat.c \
diff --git a/test/colored-glyph.c b/test/colored-glyph.c
new file mode 100644
index 000000000..ad408d429
--- /dev/null
+++ b/test/colored-glyph.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2017 Andrea Canciani
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Andrea Canciani not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Andrea Canciani makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * ANDREA CANCIANI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL ANDREA CANCIANI BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Andrea Canciani <ranma42@gmail.com>
+ */
+
+#include "cairo-test.h"
+
+#define TEXT_SIZE 32
+#define GLYPH_BASE (-0.2 * TEXT_SIZE)
+#define GLYPH_SIZE (1.25 * TEXT_SIZE)
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+
+ cairo_set_source_rgb (cr, 0, 0, 0); /* black */
+
+ /*
+ * FIXME:
+ * Quartz (using Quartz fonts) is the only backend that supports
+ * colored glyphs right now, but eventually other backends will
+ * grow support for them, too. To let all of them pass this test,
+ * we will need to use a free font with colored glyphs instead of
+ * an Apple-specific one.
+ */
+ cairo_select_font_face (cr, "Apple Color Emoji",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+
+ cairo_set_font_size (cr, TEXT_SIZE);
+ cairo_translate (cr, 0.5 * GLYPH_SIZE, 1.5 * GLYPH_SIZE + GLYPH_BASE);
+
+ /* U+1F600, GRINNING FACE */
+ cairo_show_text (cr, "\xf0\x9f\x98\x80");
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (colored_glyph,
+ "Test handing of colored glyphs",
+ "text, glyphs, color", /* keywords */
+ NULL, /* requirements */
+ 2 * GLYPH_SIZE, 2 * GLYPH_SIZE,
+ NULL, draw)
diff --git a/test/reference/colored-glyph.image16.xfail.png b/test/reference/colored-glyph.image16.xfail.png
new file mode 100644
index 000000000..de69ff204
--- /dev/null
+++ b/test/reference/colored-glyph.image16.xfail.png
Binary files differ
diff --git a/test/reference/colored-glyph.ref.png b/test/reference/colored-glyph.ref.png
new file mode 100644
index 000000000..aed913848
--- /dev/null
+++ b/test/reference/colored-glyph.ref.png
Binary files differ
diff --git a/test/reference/colored-glyph.xfail.png b/test/reference/colored-glyph.xfail.png
new file mode 100644
index 000000000..33959c763
--- /dev/null
+++ b/test/reference/colored-glyph.xfail.png
Binary files differ