summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-08-24 21:30:34 -0500
committerJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2008-08-27 10:14:27 -0500
commit56a1b81d7e9cd7c3b3ef198e3bd1e5b7f8199f0c (patch)
tree19755c1019febf1ed5ec9962b402189ffd02882b /tests
parente4f223c6d9a5c8e7bb35fe91a14377f11b99cda8 (diff)
Add LcdFilter enum and FontOptions API for LCD filtering
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/test-font-options.cc36
2 files changed, 38 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 485e5a5..f0efcc3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,12 +1,13 @@
if AUTOTESTS
# build automated 'tests'
-TESTS=test-context test-font-face test-surface test-scaled-font
+TESTS=test-context test-font-face test-surface test-scaled-font test-font-options
noinst_PROGRAMS = $(TESTS)
test_context_SOURCES=test-context.cc
test_font_face_SOURCES=test-font-face.cc
test_surface_SOURCES=test-surface.cc
test_scaled_font_SOURCES=test-scaled-font.cc
+test_font_options_SOURCES=test-font-options.cc
else
diff --git a/tests/test-font-options.cc b/tests/test-font-options.cc
new file mode 100644
index 0000000..25a0cda
--- /dev/null
+++ b/tests/test-font-options.cc
@@ -0,0 +1,36 @@
+#include <boost/test/unit_test.hpp>
+#include <boost/test/test_tools.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include <cairomm/fontoptions.h>
+
+using namespace boost::unit_test;
+using namespace Cairo;
+
+void test_lcd_filter()
+{
+ FontOptions fo;
+ fo.set_lcd_filter(LCD_FILTER_DEFAULT);
+ BOOST_CHECK_EQUAL(fo.get_lcd_filter(), LCD_FILTER_DEFAULT);
+ fo.set_lcd_filter(LCD_FILTER_NONE);
+ BOOST_CHECK_EQUAL(fo.get_lcd_filter(), LCD_FILTER_NONE);
+ fo.set_lcd_filter(LCD_FILTER_INTRA_PIXEL);
+ BOOST_CHECK_EQUAL(fo.get_lcd_filter(), LCD_FILTER_INTRA_PIXEL);
+ fo.set_lcd_filter(LCD_FILTER_FIR3);
+ BOOST_CHECK_EQUAL(fo.get_lcd_filter(), LCD_FILTER_FIR3);
+ fo.set_lcd_filter(LCD_FILTER_FIR5);
+ BOOST_CHECK_EQUAL(fo.get_lcd_filter(), LCD_FILTER_FIR5);
+}
+
+test_suite*
+init_unit_test_suite(int argc, char* argv[])
+{
+ // compile even with -Werror
+ if (argc && argv) {}
+
+ test_suite* test= BOOST_TEST_SUITE( "Cairo::Context Tests" );
+
+ test->add (BOOST_TEST_CASE (&test_lcd_filter));
+
+ return test;
+}