#include <cppunit/TestSuite.h> |
#include <cppunit/TestSuite.h> |
#include <cppunit/TestResult.h> |
#include <cppunit/TestResult.h> |
#include <cppunit/TextTestRunner.h> |
#include <cppunit/TextTestRunner.h> |
|
#include <cppunit/extensions/HelperMacros.h> |
#include "BitmapFont.h" |
#include "BitmapFont.h" |
|
#include <iostream> |
|
#include <algorithm> |
|
|
using namespace CppUnit; |
class BitmapFontTest : public CppUnit::TestFixture { |
|
CPPUNIT_TEST_SUITE( BitmapFontTest ); |
class BitmapFontTest : public TestCase { |
CPPUNIT_TEST( testGet ); |
|
CPPUNIT_TEST( testShow ); |
|
CPPUNIT_TEST( testPixel ); |
|
CPPUNIT_TEST_SUITE_END(); |
private: |
private: |
BitmapFont *space, *a; |
BitmapFont *space, *a; |
public: |
public: |
void setUp(){ |
void setUp(); |
space=new BitmapFont(24,24); |
void tearDown(); |
a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); |
void testGet(); |
} |
void testShow(); |
void tearDown(){ |
void testPixel(); |
delete space; delete a; |
|
} |
|
void testGet(){ |
|
CPPUNIT_ASSERT( space->get(10,10) == false ); |
|
CPPUNIT_ASSERT( (*a).get(10,1) == true ); |
|
CPPUNIT_ASSERT( (*a).get(-10,1) == false ); |
|
CPPUNIT_ASSERT( (*a).get(100,1) == false ); |
|
CPPUNIT_ASSERT( (*a).get(10,-10) == false ); |
|
CPPUNIT_ASSERT( (*a).get(10,100) == false ); |
|
} |
|
void testShow(){ |
|
cout << "a\n"; |
|
cout << *a << "\n"; |
|
cout << "space\n"; |
|
cout << *space << "\n"; |
|
} |
|
static Test *suite() { |
|
TestSuite *suiteOfTests = new TestSuite; |
|
suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testGet", &BitmapFontTest::testGet)); |
|
suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testShow", &BitmapFontTest::testShow)); |
|
return suiteOfTests; |
|
} |
|
}; |
}; |
|
|
#endif /* _BITMAP_FONT_TEST_H */ |
#endif /* _BITMAP_FONT_TEST_H */ |