Trying to track down a crashing bug when calling render before FaceSize();
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index 1ebd4d2..03859bc 100755
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -60,6 +60,7 @@ class FTFontTest : public CppUnit::TestCase
CPPUNIT_TEST( testGetCharmapList);
CPPUNIT_TEST( testBoundingBox);
CPPUNIT_TEST( testAdvance);
+ CPPUNIT_TEST( testRender);
CPPUNIT_TEST_SUITE_END();
public:
@@ -105,6 +106,7 @@ class FTFontTest : public CppUnit::TestCase
{
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Descender(), 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->LineHeight(), 0.01);
float advance = testFont->Advance( GOOD_UNICODE_TEST_STRING);
CPPUNIT_ASSERT( advance == 0);
@@ -116,6 +118,7 @@ class FTFontTest : public CppUnit::TestCase
CPPUNIT_ASSERT_DOUBLES_EQUAL( 52, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, testFont->Descender(), 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 81.86, testFont->LineHeight(), 0.01);
CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE * 2));
CPPUNIT_ASSERT( testFont->Error() == 0);
@@ -124,6 +127,7 @@ class FTFontTest : public CppUnit::TestCase
CPPUNIT_ASSERT_DOUBLES_EQUAL( 104, testFont->Ascender(), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL( -29, testFont->Descender(), 0.01);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 163.72, testFont->LineHeight(), 0.01);
}
@@ -219,6 +223,12 @@ class FTFontTest : public CppUnit::TestCase
CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, advance, 0.01);
}
+ void testRender()
+ {
+ testFont->Render(GOOD_ASCII_TEST_STRING);
+ CPPUNIT_ASSERT( testFont->Error() == 0);
+ }
+
void setUp()
{
diff --git a/test/FTGLPixmapFont-Test.cpp b/test/FTGLPixmapFont-Test.cpp
index f73670c..5904145 100644
--- a/test/FTGLPixmapFont-Test.cpp
+++ b/test/FTGLPixmapFont-Test.cpp
@@ -13,6 +13,7 @@ class FTGLPixmapFontTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE( FTGLPixmapFontTest);
CPPUNIT_TEST( testConstructor);
+ CPPUNIT_TEST( testRender);
CPPUNIT_TEST_SUITE_END();
public:
@@ -36,6 +37,18 @@ class FTGLPixmapFontTest : public CppUnit::TestCase
CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
}
+ void testRender()
+ {
+ buildGLContext();
+
+ FTGLPixmapFont* pixmapFont = new FTGLPixmapFont( FONT_FILE);
+ pixmapFont->FaceSize(18);
+ pixmapFont->Render(GOOD_ASCII_TEST_STRING);
+
+ CPPUNIT_ASSERT( pixmapFont->Error() == 0);
+ CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
+ }
+
void setUp()
{}