summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-08-14 09:59:13 -0500
committerJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-08-14 09:59:13 -0500
commitfdda3cf2c56d8b06a89a4233166dd27c8ec9fa2e (patch)
tree573dea55bb01c61cc49da83c23787442940c3640 /tests
parentc8f07e579c84af18b93f504614f7c903afe4749d (diff)
Implement the ToyFontFace class
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/test-font-face.cc52
2 files changed, 55 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f69eb0..03e58a0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,9 +1,10 @@
if AUTOTESTS
# build automated 'tests'
-noinst_PROGRAMS = test-context
+TESTS=test-context test-font-face
+noinst_PROGRAMS = $(TESTS)
test_context_SOURCES=test-context.cc
-TESTS=test-context
+test_font_face_SOURCES=test-font-face.cc
else
diff --git a/tests/test-font-face.cc b/tests/test-font-face.cc
new file mode 100644
index 0000000..973f956
--- /dev/null
+++ b/tests/test-font-face.cc
@@ -0,0 +1,52 @@
+// vim: ts=2 sw=2 et
+/*
+ * These tests are of limited usefulness. In fact, you might even say that
+ * they're not really tests at all. But I felt that it would be useful to have
+ * some basic usage of most functions just to verify that things compile and
+ * work generally
+ */
+
+#include <cfloat>
+#include <boost/test/unit_test.hpp>
+#include <boost/test/test_tools.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+using namespace boost::unit_test;
+#include <cairomm/fontface.h>
+
+void
+test_create_toy ()
+{
+ Cairo::RefPtr<Cairo::ToyFontFace> toy =
+ Cairo::ToyFontFace::create("sans",
+ Cairo::FONT_SLANT_ITALIC,
+ Cairo::FONT_WEIGHT_NORMAL);
+ BOOST_CHECK (toy);
+ BOOST_CHECK_EQUAL (CAIRO_STATUS_SUCCESS, toy->get_status());
+}
+
+void test_toy_getters ()
+{
+ Cairo::RefPtr<Cairo::ToyFontFace> toy =
+ Cairo::ToyFontFace::create("sans",
+ Cairo::FONT_SLANT_ITALIC,
+ Cairo::FONT_WEIGHT_NORMAL);
+ BOOST_CHECK_EQUAL ("sans", toy->get_family());
+ BOOST_CHECK_EQUAL (Cairo::FONT_SLANT_ITALIC, toy->get_slant());
+ BOOST_CHECK_EQUAL (Cairo::FONT_WEIGHT_NORMAL, toy->get_weight());
+ BOOST_CHECK_EQUAL (Cairo::FONT_TYPE_TOY, toy->get_type());
+}
+
+
+test_suite*
+init_unit_test_suite(int argc, char* argv[])
+{
+ // compile even with -Werror
+ if (argc && argv) {}
+
+ test_suite* test= BOOST_TEST_SUITE( "Cairo::FontFace Tests" );
+
+ test->add (BOOST_TEST_CASE (&test_create_toy));
+ test->add (BOOST_TEST_CASE (&test_toy_getters));
+
+ return test;
+}