Commit 60376204c6c9e44d68cde79defcb6fe0ae5b1c8f

henry 2004-09-28T03:55:46

Added assert for gl error

diff --git a/test/FTBitmapGlyph-Test.cpp b/test/FTBitmapGlyph-Test.cpp
index c4b595b..6570f2e 100644
--- a/test/FTBitmapGlyph-Test.cpp
+++ b/test/FTBitmapGlyph-Test.cpp
@@ -45,6 +45,7 @@ class FTBitmapGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTExtrdGlyph-Test.cpp b/test/FTExtrdGlyph-Test.cpp
index 0e8c490..7ffec5a 100644
--- a/test/FTExtrdGlyph-Test.cpp
+++ b/test/FTExtrdGlyph-Test.cpp
@@ -49,6 +49,7 @@ class FTExtrdGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTGLBitmapFont-Test.cpp b/test/FTGLBitmapFont-Test.cpp
index 17882ca..a807298 100644
--- a/test/FTGLBitmapFont-Test.cpp
+++ b/test/FTGLBitmapFont-Test.cpp
@@ -28,11 +28,12 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLBitmapFont* bitmapFont = new FTGLBitmapFont( FONT_FILE);            
             CPPUNIT_ASSERT( bitmapFont->Error() == 0);
         
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTGLExtrdFont.cpp-Test.cpp b/test/FTGLExtrdFont.cpp-Test.cpp
index a8a85b3..71b8cec 100644
--- a/test/FTGLExtrdFont.cpp-Test.cpp
+++ b/test/FTGLExtrdFont.cpp-Test.cpp
@@ -9,30 +9,31 @@
 
 extern void buildGLContext();
 
-class FTGLPolygonFontTest : public CppUnit::TestCase
+class FTGLExtrdFontTest : public CppUnit::TestCase
 {
-    CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
+    CPPUNIT_TEST_SUITE( FTGLExtrdFontTest);
         CPPUNIT_TEST( testConstructor);
     CPPUNIT_TEST_SUITE_END();
         
     public:
-        FTGLPolygonFontTest() : CppUnit::TestCase( "FTGLPolygonFont Test")
+        FTGLExtrdFontTest() : CppUnit::TestCase( "FTGLExtrdFont Test")
         {
         }
         
-        FTGLPolygonFontTest( const std::string& name) : CppUnit::TestCase(name) {}
+        FTGLExtrdFontTest( const std::string& name) : CppUnit::TestCase(name) {}
         
-        ~FTGLPolygonFontTest()
+        ~FTGLExtrdFontTest()
         {
         }
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLExtrdFont* extrudedFont = new FTGLExtrdFont( FONT_FILE);            
             CPPUNIT_ASSERT( extrudedFont->Error() == 0);
         
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
@@ -44,5 +45,5 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
     private:
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPolygonFontTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( FTGLExtrdFontTest);
 
diff --git a/test/FTGLOutlineFont-Test.cpp b/test/FTGLOutlineFont-Test.cpp
index 000eb0b..46f2d81 100644
--- a/test/FTGLOutlineFont-Test.cpp
+++ b/test/FTGLOutlineFont-Test.cpp
@@ -9,30 +9,31 @@
 
 extern void buildGLContext();
 
-class FTGLPolygonFontTest : public CppUnit::TestCase
+class FTGLOutlineFontTest : public CppUnit::TestCase
 {
-    CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
+    CPPUNIT_TEST_SUITE( FTGLOutlineFontTest);
         CPPUNIT_TEST( testConstructor);
     CPPUNIT_TEST_SUITE_END();
         
     public:
-        FTGLPolygonFontTest() : CppUnit::TestCase( "FTGLPolygonFont Test")
+        FTGLOutlineFontTest() : CppUnit::TestCase( "FTGLOutlineFont Test")
         {
         }
         
-        FTGLPolygonFontTest( const std::string& name) : CppUnit::TestCase(name) {}
+        FTGLOutlineFontTest( const std::string& name) : CppUnit::TestCase(name) {}
         
-        ~FTGLPolygonFontTest()
+        ~FTGLOutlineFontTest()
         {
         }
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLOutlineFont* outlineFont = new FTGLOutlineFont( FONT_FILE);            
             CPPUNIT_ASSERT( outlineFont->Error() == 0);
         
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
@@ -44,5 +45,5 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
     private:
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPolygonFontTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( FTGLOutlineFontTest);
 
diff --git a/test/FTGLPixmapFont-Test.cpp b/test/FTGLPixmapFont-Test.cpp
index c46cd1b..f73670c 100644
--- a/test/FTGLPixmapFont-Test.cpp
+++ b/test/FTGLPixmapFont-Test.cpp
@@ -9,30 +9,31 @@
 
 extern void buildGLContext();
 
-class FTGLPolygonFontTest : public CppUnit::TestCase
+class FTGLPixmapFontTest : public CppUnit::TestCase
 {
-    CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
+    CPPUNIT_TEST_SUITE( FTGLPixmapFontTest);
         CPPUNIT_TEST( testConstructor);
     CPPUNIT_TEST_SUITE_END();
         
     public:
-        FTGLPolygonFontTest() : CppUnit::TestCase( "FTGLPolygonFont Test")
+        FTGLPixmapFontTest() : CppUnit::TestCase( "FTGLPixmapFont Test")
         {
         }
         
-        FTGLPolygonFontTest( const std::string& name) : CppUnit::TestCase(name) {}
+        FTGLPixmapFontTest( const std::string& name) : CppUnit::TestCase(name) {}
         
-        ~FTGLPolygonFontTest()
+        ~FTGLPixmapFontTest()
         {
         }
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLPixmapFont* pixmapFont = new FTGLPixmapFont( FONT_FILE);            
             CPPUNIT_ASSERT( pixmapFont->Error() == 0);
         
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
@@ -44,5 +45,5 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
     private:
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPolygonFontTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPixmapFontTest);
 
diff --git a/test/FTGLPolygonFont-Test.cpp b/test/FTGLPolygonFont-Test.cpp
index 352531d..eb8eec1 100644
--- a/test/FTGLPolygonFont-Test.cpp
+++ b/test/FTGLPolygonFont-Test.cpp
@@ -28,11 +28,12 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLPolygonFont* polygonFont = new FTGLPolygonFont( FONT_FILE);            
             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 126d4da..dd9b12c 100644
--- a/test/FTGLTextureFont-Test.cpp
+++ b/test/FTGLTextureFont-Test.cpp
@@ -9,30 +9,47 @@
 
 extern void buildGLContext();
 
-class FTGLPolygonFontTest : public CppUnit::TestCase
+class FTGLTextureFontTest : public CppUnit::TestCase
 {
-    CPPUNIT_TEST_SUITE( FTGLPolygonFontTest);
+    CPPUNIT_TEST_SUITE( FTGLTextureFontTest);
         CPPUNIT_TEST( testConstructor);
+        CPPUNIT_TEST( testResizeBug);
     CPPUNIT_TEST_SUITE_END();
         
     public:
-        FTGLPolygonFontTest() : CppUnit::TestCase( "FTGLPolygonFont Test")
+        FTGLTextureFontTest() : CppUnit::TestCase( "FTGLTextureFontTest Test")
         {
         }
         
-        FTGLPolygonFontTest( const std::string& name) : CppUnit::TestCase(name) {}
+        FTGLTextureFontTest( const std::string& name) : CppUnit::TestCase(name) {}
         
-        ~FTGLPolygonFontTest()
+        ~FTGLTextureFontTest()
         {
         }
         
         void testConstructor()
         {
-//            buildGLContext();
+            buildGLContext();
         
             FTGLTextureFont* textureFont = new FTGLTextureFont( FONT_FILE);            
-            CPPUNIT_ASSERT( textureFont->Error() == 0);
+            CPPUNIT_ASSERT( textureFont->Error() == 0);            
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
+        }
+
+        void testResizeBug()
+        {
+            buildGLContext();
         
+            FTGLTextureFont* textureFont = new FTGLTextureFont( FONT_FILE);            
+            CPPUNIT_ASSERT( textureFont->Error() == 0);
+            
+            textureFont->FaceSize(18);
+            textureFont->Render("blah");
+
+            textureFont->FaceSize(38);
+            textureFont->Render("blah");
+            
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
@@ -44,5 +61,5 @@ class FTGLPolygonFontTest : public CppUnit::TestCase
     private:
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION( FTGLPolygonFontTest);
+CPPUNIT_TEST_SUITE_REGISTRATION( FTGLTextureFontTest);
 
diff --git a/test/FTOutlineGlyph-Test.cpp b/test/FTOutlineGlyph-Test.cpp
index a5d878a..fefa476 100644
--- a/test/FTOutlineGlyph-Test.cpp
+++ b/test/FTOutlineGlyph-Test.cpp
@@ -49,6 +49,7 @@ class FTOutlineGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTPixmapGlyph-Test.cpp b/test/FTPixmapGlyph-Test.cpp
index 0ba213e..436fcd8 100644
--- a/test/FTPixmapGlyph-Test.cpp
+++ b/test/FTPixmapGlyph-Test.cpp
@@ -1,3 +1,5 @@
+#include <iostream>
+
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/TestCaller.h>
 #include <cppunit/TestCase.h>
@@ -7,6 +9,10 @@
 #include "Fontdefs.h"
 #include "FTPixmapGlyph.h"
 
+#define GL_ASSERT() {GLenum sci_err; while ((sci_err = glGetError()) != GL_NO_ERROR) \
+        std::cerr << "OpenGL error: " << (char *)gluErrorString(sci_err) << " at " << __FILE__ <<":" << __LINE__ << std::endl;}
+
+
 extern void buildGLContext();
 
 class FTPixmapGlyphTest : public CppUnit::TestCase
@@ -49,6 +55,7 @@ class FTPixmapGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTPolyGlyph-Test.cpp b/test/FTPolyGlyph-Test.cpp
index 7fdead3..47fb1dd 100644
--- a/test/FTPolyGlyph-Test.cpp
+++ b/test/FTPolyGlyph-Test.cpp
@@ -49,6 +49,7 @@ class FTPolyGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp() 
diff --git a/test/FTTextureGlyph-Test.cpp b/test/FTTextureGlyph-Test.cpp
index d974c8e..0d8f2b2 100644
--- a/test/FTTextureGlyph-Test.cpp
+++ b/test/FTTextureGlyph-Test.cpp
@@ -50,6 +50,7 @@ class FTTextureGlyphTest : public CppUnit::TestCase
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
         void setUp()