[wadalabfont-kit] / jis2prim / BitmapFontTest.h  

Diff of /jis2prim/BitmapFontTest.h

Parent Directory | Revision Log

version 1.3, Tue Aug 6 06:30:43 2002 UTC version 1.4, Tue Aug 20 11:10:36 2002 UTC
Line 5 
Line 5 
 #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 <iostream>
 #include <algorithm>  #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(){  
     std::cout << "a\n";  
     std::cout << *a << "\n";  
     std::cout << "space\n";  
     std::cout << *space << "\n";  
   }  
   void testPixel(){  
     CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(0,1)) == 2);  
     CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(22,0)) == 1);  
   }  
   static Test *suite() {  
     TestSuite *suiteOfTests = new TestSuite;  
     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testGet", &BitmapFontTest::testGet));  
     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testShow", &BitmapFontTest::testShow));  
     suiteOfTests->addTest (new TestCaller<BitmapFontTest>("testPixel", &BitmapFontTest::testPixel));  
     return suiteOfTests;  
   }  
 };  };
   
 #endif /* _BITMAP_FONT_TEST_H */  #endif /* _BITMAP_FONT_TEST_H */


Generate output suitable for use with a patch program
Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help