diff --git a/test/Makefile.am b/test/Makefile.am index 8e271fe9b..a74d71a7c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -27,7 +27,7 @@ endif # Need to add quartz-surface-source if CAIRO_HAS_QUARTZ_SURFACE -test_sources += $(quartz_surface_test_sources) +test_sources += "$(quartz_surface_test_sources) $(quartz_color_font_test_sources)" endif if CAIRO_HAS_PDF_SURFACE diff --git a/test/Makefile.sources b/test/Makefile.sources index c180289ab..330aa9da1 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -434,6 +434,8 @@ egl_surface_test_sources = \ quartz_surface_test_sources = quartz-surface-source.c +quartz_color_font_test_sources = quartz-color-font.c + pdf_surface_test_sources = \ pdf-features.c \ pdf-mime-data.c \ diff --git a/test/meson.build b/test/meson.build index c0be0e086..21a0588e7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -438,6 +438,7 @@ test_egl_sources = [ test_quartz_sources = [ 'quartz-surface-source.c', + 'quartz-color-font.c', ] test_pdf_sources = [ diff --git a/test/quartz-color-font.c b/test/quartz-color-font.c new file mode 100644 index 000000000..7dae214f6 --- /dev/null +++ b/test/quartz-color-font.c @@ -0,0 +1,54 @@ +/* + * Copyright © 2022 John Ralls + * + * 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. + * + */ + +#include "cairo-test.h" +#include + +#define WIDTH 100 +#define HEIGHT 50 + +#define FONT "Apple Color Emoji" + +static const char smiley_face_utf8[] = { 0xf0, 0x9f, 0x99, 0x82, 0x00 }; /* U+1F642 */ + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_select_font_face(cr, FONT, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size (cr, HEIGHT/2); + cairo_move_to (cr, width/5, 2*height/3); + + cairo_show_text(cr, smiley_face_utf8); + cairo_show_text(cr, smiley_face_utf8); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (quartz_color_font, + "Test color font", + "quartz, font", /* keywords */ + NULL, /* requirements */ + WIDTH, HEIGHT, + NULL, draw) diff --git a/test/reference/quartz-color-font.quartz.rgb24.ref.png b/test/reference/quartz-color-font.quartz.rgb24.ref.png new file mode 100644 index 000000000..00a0c4499 Binary files /dev/null and b/test/reference/quartz-color-font.quartz.rgb24.ref.png differ diff --git a/test/reference/quartz-color-font.ref.png b/test/reference/quartz-color-font.ref.png new file mode 100644 index 000000000..e52674ba0 Binary files /dev/null and b/test/reference/quartz-color-font.ref.png differ