#ifndef _BITMAP_FONT_TEST_H #define _BITMAP_FONT_TEST_H #include #include #include #include #include #include "BitmapFont.h" using namespace CppUnit; class BitmapFontTest : public TestCase { private: BitmapFont *space, *a; public: void setUp(){ space=new BitmapFont(24,24); a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); } void tearDown(){ 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("testGet", &BitmapFontTest::testGet)); suiteOfTests->addTest (new TestCaller("testShow", &BitmapFontTest::testShow)); return suiteOfTests; } }; #endif /* _BITMAP_FONT_TEST_H */