Now uses FT_Outline_Get_CBox where possible
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/test/FTBBox-Test.cpp b/test/FTBBox-Test.cpp
index 02dfb62..c271f11 100755
--- a/test/FTBBox-Test.cpp
+++ b/test/FTBBox-Test.cpp
@@ -17,6 +17,7 @@ class FTBBoxTest : public CppUnit::TestCase
CPPUNIT_TEST_SUITE( FTBBoxTest);
CPPUNIT_TEST( testDefaultConstructor);
CPPUNIT_TEST( testGlyphConstructor);
+ CPPUNIT_TEST( testBitmapConstructor);
CPPUNIT_TEST( testMoveBBox);
CPPUNIT_TEST( testPlusEquals);
CPPUNIT_TEST( testSetDepth);
@@ -63,8 +64,30 @@ class FTBBoxTest : public CppUnit::TestCase
CPPUNIT_ASSERT_DOUBLES_EQUAL( 38, boundingBox2.upperY, 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, boundingBox2.upperZ, 0.01);
+
tearDownFreetype();
- }
+ }
+
+ void testBitmapConstructor()
+ {
+ setUpFreetype();
+
+ FT_Error error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL);
+ if(0 != error)
+ {}
+// CPPUNIT_ASSERT( 0 != error);
+ CPPUNIT_ASSERT( ft_glyph_format_bitmap != face->glyph->format);
+
+ FTBBox boundingBox3( face->glyph);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 2, boundingBox3.lowerX, 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, boundingBox3.lowerY, 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, boundingBox3.lowerZ, 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 35, boundingBox3.upperX, 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 38, boundingBox3.upperY, 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, boundingBox3.upperZ, 0.01);
+
+ }
void testMoveBBox()
{
@@ -158,12 +181,10 @@ class FTBBoxTest : public CppUnit::TestCase
error = FT_New_Face( library, GOOD_FONT_FILE, 0, &face);
assert(!error);
- long glyphIndex = FT_Get_Char_Index( face, CHARACTER_CODE_G);
-
FT_Set_Char_Size( face, 0L, FONT_POINT_SIZE * 64, RESOLUTION, RESOLUTION);
- error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
- assert(!error);
+ error = FT_Load_Char( face, CHARACTER_CODE_G, FT_LOAD_DEFAULT);
+ assert( !error);
}
void tearDownFreetype()