diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2008-10-07 22:55:02 +0900 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2008-10-07 22:55:02 +0900 |
commit | 794aa436a4bc5b7d453c21ab8a00e6098c3a9e85 (patch) | |
tree | 2f956cde75f1ef4466317e7c9797eb943b502eda /tests | |
parent | 643262b3bf7ee36c9ae366cb5adb184d9d4e6c79 (diff) |
Update API to officially released 1.8 API
* cairomm/context.cc:
* cairomm/context.h: remove has_show_text_glyphs() (moved to Surface)
* cairomm/surface.cc:
* cairomm/surface.h: added has_show_text_glyphs() (moved from Context)
* cairomm/enums.h: removed LcdFilter enum, added a TextClusterFlags enum
* cairomm/fontface.cc:
* cairomm/fontface.h: changed the 'backwards' bool argument of
SlotTextToGlyphs to use TextClusterFlags instead. Same general change for the
C callback text_to_glyphs_cb
* cairomm/fontoptions.cc:
* cairomm/fontoptions.h: remove get/set_lcd_filter() since it was removed from
cairo just before the 1.8 release
* cairomm/scaledfont.cc:
* cairomm/scaledfont.h: changed the 'backwards' bool argument of
text_to_glyphs() to use TextClusterFlags instead
* tests/test-context.cc:
* tests/test-font-face.cc:
* tests/test-font-options.cc:
* tests/test-scaled-font.cc:
* tests/test-surface.cc: update tests for API changes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-context.cc | 13 | ||||
-rw-r--r-- | tests/test-font-face.cc | 2 | ||||
-rw-r--r-- | tests/test-font-options.cc | 38 | ||||
-rw-r--r-- | tests/test-scaled-font.cc | 4 | ||||
-rw-r--r-- | tests/test-surface.cc | 11 |
5 files changed, 39 insertions, 29 deletions
diff --git a/tests/test-context.cc b/tests/test-context.cc index fee9565..471581d 100644 --- a/tests/test-context.cc +++ b/tests/test-context.cc @@ -352,18 +352,6 @@ void test_font_options() BOOST_CHECK(options == other); } -void test_show_text_glyphs() -{ - // image surface doesn't support show_text_glyphs - Cairo::RefPtr<Cairo::Surface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \ - Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surf); - BOOST_CHECK(!cr->has_show_text_glyphs()); - // but pdf surface should - surf = Cairo::PdfSurface::create("test.pdf", 10.0, 10.0); - cr = Cairo::Context::create(surf); - BOOST_CHECK(cr->has_show_text_glyphs()); -} - test_suite* init_unit_test_suite(int argc, char* argv[]) { @@ -391,7 +379,6 @@ init_unit_test_suite(int argc, char* argv[]) test->add (BOOST_TEST_CASE (&test_target)); test->add (BOOST_TEST_CASE (&test_scaled_font)); test->add (BOOST_TEST_CASE (&test_font_options)); - test->add (BOOST_TEST_CASE (&test_show_text_glyphs)); return test; } diff --git a/tests/test-font-face.cc b/tests/test-font-face.cc index 57a4a99..0ebe91e 100644 --- a/tests/test-font-face.cc +++ b/tests/test-font-face.cc @@ -75,7 +75,7 @@ Cairo::ErrorStatus my_render_glyph(const Cairo::RefPtr<Cairo::ScaledFont>&, unsi } static unsigned int text_to_glyphs_call_count = 0; -Cairo::ErrorStatus my_text_to_glyphs(const Cairo::RefPtr<Cairo::ScaledFont>&, const std::string& utf8, std::vector<Cairo::Glyph>& glyphs, std::vector<Cairo::TextCluster>& /*clusters*/, bool& /*backward*/) +Cairo::ErrorStatus my_text_to_glyphs(const Cairo::RefPtr<Cairo::ScaledFont>&, const std::string& utf8, std::vector<Cairo::Glyph>& glyphs, std::vector<Cairo::TextCluster>& /*clusters*/, Cairo::TextClusterFlags& /*cluster_flags*/) { text_to_glyphs_call_count++; if (glyphs.size()) diff --git a/tests/test-font-options.cc b/tests/test-font-options.cc index 25a0cda..a6690f8 100644 --- a/tests/test-font-options.cc +++ b/tests/test-font-options.cc @@ -7,19 +7,31 @@ using namespace boost::unit_test; using namespace Cairo; -void test_lcd_filter() +void test_excercise() { - 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); + // just excercise all of the methods + Cairo::FontOptions options; + + Cairo::FontOptions other; + options.merge(other); + + options.hash(); + + options.set_antialias(Cairo::ANTIALIAS_SUBPIXEL); + Cairo::Antialias antialias = options.get_antialias(); + BOOST_CHECK_EQUAL(Cairo::ANTIALIAS_SUBPIXEL, antialias); + + options.set_subpixel_order(Cairo::SUBPIXEL_ORDER_DEFAULT); + Cairo::SubpixelOrder order = options.get_subpixel_order(); + BOOST_CHECK_EQUAL(Cairo::SUBPIXEL_ORDER_DEFAULT, order); + + options.set_hint_style(Cairo::HINT_STYLE_SLIGHT); + Cairo::HintStyle hint_style = options.get_hint_style(); + BOOST_CHECK_EQUAL(Cairo::HINT_STYLE_SLIGHT, hint_style); + + options.set_hint_metrics(Cairo::HINT_METRICS_OFF); + Cairo::HintMetrics metrics = options.get_hint_metrics(); + BOOST_CHECK_EQUAL(Cairo::HINT_METRICS_OFF, metrics); } test_suite* @@ -30,7 +42,7 @@ init_unit_test_suite(int argc, char* argv[]) test_suite* test= BOOST_TEST_SUITE( "Cairo::Context Tests" ); - test->add (BOOST_TEST_CASE (&test_lcd_filter)); + test->add (BOOST_TEST_CASE (&test_excercise)); return test; } diff --git a/tests/test-scaled-font.cc b/tests/test-scaled-font.cc index 2bb5e69..62bbd6e 100644 --- a/tests/test-scaled-font.cc +++ b/tests/test-scaled-font.cc @@ -29,8 +29,8 @@ void test_text_to_glyphs() std::vector<Glyph> glyphs; std::vector<TextCluster> clusters; - bool backwards = false; - font->text_to_glyphs(0, 0, "foo", glyphs, clusters, backwards); + TextClusterFlags flags; + font->text_to_glyphs(0, 0, "foo", glyphs, clusters, flags); BOOST_CHECK_EQUAL(3, glyphs.size()); BOOST_CHECK_EQUAL(3, clusters.size()); diff --git a/tests/test-surface.cc b/tests/test-surface.cc index 3a5e6ae..c1654ca 100644 --- a/tests/test-surface.cc +++ b/tests/test-surface.cc @@ -114,6 +114,16 @@ void test_fallback_resolution() BOOST_CHECK_EQUAL(y, new_y); } +void test_show_text_glyphs() +{ + // image surface doesn't support show_text_glyphs + Cairo::RefPtr<Cairo::Surface> surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 10, 10); \ + BOOST_CHECK(!surf->has_show_text_glyphs()); + // but pdf surface should + surf = Cairo::PdfSurface::create("test.pdf", 10.0, 10.0); + BOOST_CHECK(surf->has_show_text_glyphs()); +} + test_suite* init_unit_test_suite(int argc, char* argv[]) @@ -130,6 +140,7 @@ init_unit_test_suite(int argc, char* argv[]) test->add (BOOST_TEST_CASE (&test_create_from_png)); test->add (BOOST_TEST_CASE (&test_ps_eps)); test->add (BOOST_TEST_CASE (&test_content)); + test->add (BOOST_TEST_CASE (&test_show_text_glyphs)); return test; } |