Revision: 1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | #ifndef _BITMAP_FONT_TEST_H |
2 : | #define _BITMAP_FONT_TEST_H | ||
3 : | #include <cppunit/TestCase.h> | ||
4 : | #include <cppunit/TestCaller.h> | ||
5 : | #include <cppunit/TestSuite.h> | ||
6 : | #include <cppunit/TestResult.h> | ||
7 : | #include <cppunit/TextTestRunner.h> | ||
8 : | #include "BitmapFont.h" | ||
9 : | |||
10 : | using namespace CppUnit; | ||
11 : | |||
12 : | class BitmapFontTest : public TestCase { | ||
13 : | private: | ||
14 : | BitmapFont *space, *a; | ||
15 : | public: | ||
16 : | void setUp(){ | ||
17 : | space=new BitmapFont(24,24); | ||
18 : | a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); | ||
19 : | } | ||
20 : | void tearDown(){ | ||
21 : | delete space; delete a; | ||
22 : | } | ||
23 : | void testGet(){ | ||
24 : | CPPUNIT_ASSERT( space->get(10,10) == false ); | ||
25 : | CPPUNIT_ASSERT( (*a).get(10,1) == true ); | ||
26 : | CPPUNIT_ASSERT( (*a).get(-10,1) == false ); | ||
27 : | CPPUNIT_ASSERT( (*a).get(100,1) == false ); | ||
28 : | CPPUNIT_ASSERT( (*a).get(10,-10) == false ); | ||
29 : | CPPUNIT_ASSERT( (*a).get(10,100) == false ); | ||
30 : | } | ||
31 : | void testShow(){ | ||
32 : | cout << "a\n"; | ||
33 : | cout << *a << "\n"; | ||
34 : | cout << "space\n"; | ||
35 : | cout << *space << "\n"; | ||
36 : | } | ||
37 : | static Test *suite() { | ||
38 : | TestSuite *suiteOfTests = new TestSuite; | ||
39 : | suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testGet", &BitmapFontTest::testGet)); | ||
40 : | suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testShow", &BitmapFontTest::testShow)); | ||
41 : | return suiteOfTests; | ||
42 : | } | ||
43 : | }; | ||
44 : | |||
45 : | #endif /* _BITMAP_FONT_TEST_H */ |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |