[wadalabfont-kit] / jis2prim / BitmapFontTest.h  

Annotation of /jis2prim/BitmapFontTest.h

Parent Directory | Revision Log

Revision: 1.2 - (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 : ktanaka 1.2 void testPixel(){
38 :     CPPUNIT_ASSERT( (*a).getIndex(pair<int,int>(0,1)) == 2);
39 :     CPPUNIT_ASSERT( (*a).getIndex(pair<int,int>(22,0)) == 1);
40 :     }
41 : ktanaka 1.1 static Test *suite() {
42 :     TestSuite *suiteOfTests = new TestSuite;
43 :     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testGet", &BitmapFontTest::testGet));
44 :     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testShow", &BitmapFontTest::testShow));
45 : ktanaka 1.2 suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testPixel", &BitmapFontTest::testPixel));
46 : ktanaka 1.1 return suiteOfTests;
47 :     }
48 :     };
49 :    
50 :     #endif /* _BITMAP_FONT_TEST_H */

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help