Commit 5c9149d577ae2c032afd106b4d0cc9707d94a2b2

henry 2004-09-29T03:01:40

Fixing render tests. Must set size before rendering.

diff --git a/test/FTGLBitmapFont-Test.cpp b/test/FTGLBitmapFont-Test.cpp
index a807298..a74cd70 100644
--- a/test/FTGLBitmapFont-Test.cpp
+++ b/test/FTGLBitmapFont-Test.cpp
@@ -9,20 +9,21 @@
 
 extern void buildGLContext();
 
-class FTGLPolygonFontTest : public CppUnit::TestCase
+class FTGLBitmapFontTest : public CppUnit::TestCase
 {
-    CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
+    CPPUNIT_TEST_SUITE( FTGLBitmapFontTest);
         CPPUNIT_TEST( testConstructor);
+        CPPUNIT_TEST( testRender);
     CPPUNIT_TEST_SUITE_END();
         
     public:
-        FTGLPolygonFontTest() : CppUnit::TestCase( "FTGLPolygonFont Test")
+        FTGLBitmapFontTest() : CppUnit::TestCase( "FTGLBitmapFont Test")
         {
         }
         
-        FTGLPolygonFontTest( const std::string& name) : CppUnit::TestCase(name) {}
+        FTGLBitmapFontTest( const std::string& name) : CppUnit::TestCase(name) {}
         
-        ~FTGLPolygonFontTest()
+        ~FTGLBitmapFontTest()
         {
         }
         
@@ -36,6 +37,23 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testRender()
+        {
+            buildGLContext();
+        
+            FTGLBitmapFont* bitmapFont = new FTGLBitmapFont( FONT_FILE);            
+            bitmapFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( bitmapFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
+            bitmapFont->FaceSize(18);
+            bitmapFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( bitmapFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
+
         void setUp() 
         {}
         
@@ -45,5 +63,5 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
     private:
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPolygonFontTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( FTGLBitmapFontTest);
 
diff --git a/test/FTGLExtrdFont.cpp-Test.cpp b/test/FTGLExtrdFont.cpp-Test.cpp
index 71b8cec..85f1aca 100644
--- a/test/FTGLExtrdFont.cpp-Test.cpp
+++ b/test/FTGLExtrdFont.cpp-Test.cpp
@@ -13,6 +13,7 @@ class FTGLExtrdFontTest : public CppUnit::TestCase
 {
     CPPUNIT_TEST_SUITE( FTGLExtrdFontTest);
         CPPUNIT_TEST( testConstructor);
+        CPPUNIT_TEST( testRender);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -36,6 +37,23 @@ class FTGLExtrdFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testRender()
+        {
+            buildGLContext();
+        
+            FTGLExtrdFont* extrudedFont = new FTGLExtrdFont( FONT_FILE);            
+            extrudedFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( extrudedFont->Error() == 0x97);   // Invalid pixels per em
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
+            extrudedFont->FaceSize(18);
+            extrudedFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( extrudedFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
+
         void setUp() 
         {}
         
diff --git a/test/FTGLOutlineFont-Test.cpp b/test/FTGLOutlineFont-Test.cpp
index 46f2d81..636238b 100644
--- a/test/FTGLOutlineFont-Test.cpp
+++ b/test/FTGLOutlineFont-Test.cpp
@@ -13,6 +13,7 @@ class FTGLOutlineFontTest : public CppUnit::TestCase
 {
     CPPUNIT_TEST_SUITE( FTGLOutlineFontTest);
         CPPUNIT_TEST( testConstructor);
+        CPPUNIT_TEST( testRender);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -35,6 +36,23 @@ class FTGLOutlineFontTest : public CppUnit::TestCase
         
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
+        
+        void testRender()
+        {
+            buildGLContext();
+        
+            FTGLOutlineFont* outlineFont = new FTGLOutlineFont( FONT_FILE);            
+            outlineFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( outlineFont->Error() == 0x97);   // Invalid pixels per em
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
+            outlineFont->FaceSize(18);
+            outlineFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( outlineFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
 
         void setUp() 
         {}
diff --git a/test/FTGLPixmapFont-Test.cpp b/test/FTGLPixmapFont-Test.cpp
index 5904145..70c2bf8 100644
--- a/test/FTGLPixmapFont-Test.cpp
+++ b/test/FTGLPixmapFont-Test.cpp
@@ -42,6 +42,11 @@ class FTGLPixmapFontTest : public CppUnit::TestCase
             buildGLContext();
         
             FTGLPixmapFont* pixmapFont = new FTGLPixmapFont( FONT_FILE);            
+
+            pixmapFont->Render(GOOD_ASCII_TEST_STRING);
+            CPPUNIT_ASSERT( pixmapFont->Error() == 0x97);   // Invalid pixels per em       
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
             pixmapFont->FaceSize(18);
             pixmapFont->Render(GOOD_ASCII_TEST_STRING);
 
diff --git a/test/FTGLPolygonFont-Test.cpp b/test/FTGLPolygonFont-Test.cpp
index eb8eec1..0d7a96e 100644
--- a/test/FTGLPolygonFont-Test.cpp
+++ b/test/FTGLPolygonFont-Test.cpp
@@ -13,6 +13,7 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
 {
     CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
         CPPUNIT_TEST( testConstructor);
+        CPPUNIT_TEST( testRender);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -36,6 +37,24 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testRender()
+        {
+            buildGLContext();
+        
+            FTGLPolygonFont* polygonFont = new FTGLPolygonFont( FONT_FILE);            
+
+            polygonFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( polygonFont->Error() == 0x97);   // Invalid pixels per em       
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
+            polygonFont->FaceSize(18);
+            polygonFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( polygonFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
+
         void setUp() 
         {}
         
diff --git a/test/FTGLTextureFont-Test.cpp b/test/FTGLTextureFont-Test.cpp
index 52a9c8f..0d85316 100644
--- a/test/FTGLTextureFont-Test.cpp
+++ b/test/FTGLTextureFont-Test.cpp
@@ -14,6 +14,7 @@ class FTGLTextureFontTest : public CppUnit::TestCase
     CPPUNIT_TEST_SUITE( FTGLTextureFontTest);
         CPPUNIT_TEST( testConstructor);
         CPPUNIT_TEST( testResizeBug);
+        CPPUNIT_TEST( testRender);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -52,6 +53,23 @@ class FTGLTextureFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testRender()
+        {
+            buildGLContext();
+        
+            FTGLTextureFont* textureFont = new FTGLTextureFont( FONT_FILE);            
+
+            textureFont->Render(GOOD_ASCII_TEST_STRING);
+            CPPUNIT_ASSERT( textureFont->Error() == 0x97);   // Invalid pixels per em       
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+
+            textureFont->FaceSize(18);
+            textureFont->Render(GOOD_ASCII_TEST_STRING);
+
+            CPPUNIT_ASSERT( textureFont->Error() == 0);        
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
+
         void setUp() 
         {}