Revision Log
*** empty log message ***
#include <strstream>
#include "BitmapFontTest.h"
void BitmapFontTest::setUp(){
space=new BitmapFont(24,24);
a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000");
}
void BitmapFontTest::tearDown(){
delete space; delete a;
}
void BitmapFontTest::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 );
}
static const char *showImage=
".....................@@.\n"
"@@@@@@@@@@@@@@@@@@@@@@@@\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@........\n"
"..@.....@@....@@....@@..\n"
"..@@@@@@@@@@@@@@@@@@@@@.\n"
"..@@....@@....@@....@@..\n"
"..@@....@@....@@....@@..\n"
"..@@....@@....@@....@@..\n"
"..@@....@@....@@....@@..\n"
"..@@....@@....@@....@@..\n"
"..@@....@@....@@....@@..\n"
"..@@@@@@@@@@@@@@@@@@@@..\n"
"..@@....@@....@@....@@..\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@........\n"
"........@@....@@.....@@.\n"
"@@@@@@@@@@@@@@@@@@@@@@@@\n"
"........................\n";
void BitmapFontTest::testShow(){
std::ostrstream os;
os << *a;
os.freeze();
CPPUNIT_ASSERT( os.pcount() == strlen(showImage));
CPPUNIT_ASSERT( !strncmp(os.str(),showImage,sizeof(showImage)));
}
void BitmapFontTest::testPixel(){
CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(0,1)) == 2);
CPPUNIT_ASSERT( (*a).getIndex(std::pair<int,int>(22,0)) == 1);
}
|
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |