summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-09-10 00:01:21 -0500
committerJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-09-10 00:01:21 -0500
commit00396cf43a7fd70c667ffd69b3603617be037573 (patch)
tree0d92954ce6410cf06f8fabbbef973ac4f229af01 /tests
parentb113c28cfd9b9a2398c58d92e0c30258698dedec (diff)
add Freetype font support
Diffstat (limited to 'tests')
-rw-r--r--tests/test-font-face.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test-font-face.cc b/tests/test-font-face.cc
index cb6f150..3da8f54 100644
--- a/tests/test-font-face.cc
+++ b/tests/test-font-face.cc
@@ -277,6 +277,28 @@ void test_user_font_replace_callback()
BOOST_CHECK_EQUAL (init_call_count, 0);
}
+#ifdef CAIRO_HAS_FT_FONT
+void test_ft_font_face()
+{
+ FcPattern* invalid = FcPatternCreate();
+ Cairo::RefPtr<Cairo::FtFontFace> invalid_face;
+ BOOST_CHECK_THROW(invalid_face = Cairo::FtFontFace::create(invalid), std::bad_alloc);
+
+ // basically taken from the cairo test case -- we don't care what font we're
+ // using so just create an empty pattern and do the minimal substitution to
+ // get a valid pattern
+ FcPattern* pattern = FcPatternCreate();
+ FcConfigSubstitute (NULL, pattern, FcMatchPattern);
+ FcDefaultSubstitute (pattern);
+ FcResult result;
+ FcPattern* resolved = FcFontMatch (NULL, pattern, &result);
+ Cairo::RefPtr<Cairo::FtFontFace> face = Cairo::FtFontFace::create(resolved);
+ BOOST_CHECK(face);
+
+ // FIXME: test creating from a FT_Face
+}
+#endif // CAIRO_HAS_FT_FONT
+
test_suite*
init_unit_test_suite(int argc, char* argv[])
@@ -297,6 +319,9 @@ init_unit_test_suite(int argc, char* argv[])
test->add (BOOST_TEST_CASE (&test_user_font_callbacks_mem));
test->add (BOOST_TEST_CASE (&test_user_font_callbacks_exception));
test->add (BOOST_TEST_CASE (&test_user_font_replace_callback));
+#ifdef CAIRO_HAS_FT_FONT
+ test->add (BOOST_TEST_CASE (&test_ft_font_face));
+#endif // CAIRO_HAS_FT_FONT
return test;
}