[wadalabfont-kit] / jis2prim / BitmapFontTest.h  

Annotation of /jis2prim/BitmapFontTest.h

Parent Directory | Revision Log

Revision: 1.3 - (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 : ktanaka 1.3 #include <iostream>
10 :     #include <algorithm>
11 : ktanaka 1.1
12 :     using namespace CppUnit;
13 :    
14 :     class BitmapFontTest : public TestCase {
15 :     private:
16 :     BitmapFont *space, *a;
17 :     public:
18 :     void setUp(){
19 :     space=new BitmapFont(24,24);
20 :     a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000");
21 :     }
22 :     void tearDown(){
23 :     delete space; delete a;
24 :     }
25 :     void testGet(){
26 :     CPPUNIT_ASSERT( space->get(10,10) == false );
27 :     CPPUNIT_ASSERT( (*a).get(10,1) == true );
28 :     CPPUNIT_ASSERT( (*a).get(-10,1) == false );
29 :     CPPUNIT_ASSERT( (*a).get(100,1) == false );
30 :     CPPUNIT_ASSERT( (*a).get(10,-10) == false );
31 :     CPPUNIT_ASSERT( (*a).get(10,100) == false );
32 :     }
33 :     void testShow(){
34 : ktanaka 1.3 std::cout << "a\n";
35 :     std::cout << *a << "\n";
36 :     std::cout << "space\n";
37 :     std::cout << *space << "\n";
38 : ktanaka 1.1 }
39 : ktanaka 1.2 void testPixel(){
40 : ktanaka 1.3 CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(0,1)) == 2);
41 :     CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(22,0)) == 1);
42 : ktanaka 1.2 }
43 : ktanaka 1.1 static Test *suite() {
44 :     TestSuite *suiteOfTests = new TestSuite;
45 :     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testGet", &BitmapFontTest::testGet));
46 :     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testShow", &BitmapFontTest::testShow));
47 : ktanaka 1.2 suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testPixel", &BitmapFontTest::testPixel));
48 : ktanaka 1.1 return suiteOfTests;
49 :     }
50 :     };
51 :    
52 :     #endif /* _BITMAP_FONT_TEST_H */

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help