Added assert for gl error
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
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()