[wadalabfont-kit] / jis2prim / BitmapFontTest.h  

View of /jis2prim/BitmapFontTest.h

Parent Directory | Revision Log
Revision: 1.3 - (download) (as text) (annotate)
Tue Aug 6 06:30:43 2002 UTC (22 years, 3 months ago) by ktanaka
Branch: MAIN
Changes since 1.2: +8 -6 lines
*** empty log message ***
#ifndef _BITMAP_FONT_TEST_H
#define _BITMAP_FONT_TEST_H
#include <cppunit/TestCase.h>
#include <cppunit/TestCaller.h>
#include <cppunit/TestSuite.h>
#include <cppunit/TestResult.h>
#include <cppunit/TextTestRunner.h>
#include "BitmapFont.h"
#include <iostream>
#include <algorithm>

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(){
    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 */

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help