summaryrefslogtreecommitdiff
path: root/test/ft-color-font.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2022-06-18 05:59:38 +0930
committerAdrian Johnson <ajohnson@redneon.com>2022-06-26 09:54:15 +0930
commit99d59f00d649c2b347f41e6e24fb0ddb2abb077b (patch)
tree120620b7c58413fe9f21a7fe7bc452f2104a4bfe /test/ft-color-font.c
parent6bd549e8df66cc450b40cf26ef56f0ae5d8f37de (diff)
downloadcairo-99d59f00d649c2b347f41e6e24fb0ddb2abb077b.tar.gz
Test color_mode option in ft-color-font test
Diffstat (limited to 'test/ft-color-font.c')
-rw-r--r--test/ft-color-font.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/ft-color-font.c b/test/ft-color-font.c
index 58a1dc3ca..d10555dcf 100644
--- a/test/ft-color-font.c
+++ b/test/ft-color-font.c
@@ -27,9 +27,9 @@
#include "cairo-test.h"
#include <cairo-ft.h>
-#define WIDTH 50
-#define HEIGHT WIDTH
-
+#define SIZE 40
+#define HEIGHT SIZE
+#define WIDTH (SIZE * 1.5)
#define FONT "Noto Color Emoji"
static const char smiley_face_utf8[] = { 0xf0, 0x9f, 0x99, 0x82, 0x00 }; /* U+1F642 */
@@ -87,13 +87,23 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_test_status_t result;
+ cairo_font_options_t *font_options;
result = set_color_emoji_font (cr);
if (result != CAIRO_TEST_SUCCESS)
return result;
- cairo_set_font_size (cr, HEIGHT/2);
- cairo_move_to (cr, width/4, 3*height/4);
+ cairo_set_font_size (cr, SIZE/2);
+ cairo_move_to (cr, SIZE/8, 0.7 * SIZE);
+
+ cairo_show_text(cr, smiley_face_utf8);
+
+ /* Show that the color mode font option can disable color rendering */
+ font_options = cairo_font_options_create ();
+ cairo_get_font_options (cr, font_options);
+ cairo_font_options_set_color_mode (font_options, CAIRO_COLOR_MODE_NO_COLOR);
+ cairo_set_font_options (cr, font_options);
+ cairo_font_options_destroy (font_options);
cairo_show_text(cr, smiley_face_utf8);