#include <cppunit/TestResult.h> |
#include <cppunit/TestResult.h> |
#include <cppunit/TextTestRunner.h> |
#include <cppunit/TextTestRunner.h> |
#include "Matchers.h" |
#include "Matchers.h" |
|
#include <vector> |
|
#include <iostream> |
|
|
using namespace CppUnit; |
using namespace CppUnit; |
|
|
private: |
private: |
BitmapFont *a; |
BitmapFont *a; |
Matchers *mat; |
Matchers *mat; |
|
BitmapFontFile *ff; |
public: |
public: |
void setUp(){ |
void setUp(){ |
/* |
/* |
|
|
a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); |
a=new BitmapFont(24,24,"000006FFFFFF00C30000C30000C30000C30020C30C3FFFFE30C30C30C30C30C30C30C30C30C30C30C30C3FFFFC30C30C00C30000C30000C30000C30000C30000C306FFFFFF000000"); |
mat=new Matchers(); |
mat=new Matchers(); |
|
ff=new BitmapFontFile("jiskan24.bdf"); |
} |
} |
void tearDown(){ |
void tearDown(){ |
delete a; delete mat; |
delete a; delete mat; |
|
delete ff; |
} |
} |
void testShow(){ |
void testShow(){ |
cout << *mat << '\n'; |
std::cout << *mat << '\n'; |
} |
} |
void testMatch(){ |
void testMatch(){ |
vector<MatchResult> mr=mat->findMatch(*a); |
std::vector<MatchResult> mr=mat->findMatch(*a); |
vector<MatchResult>::iterator it; |
std::vector<MatchResult>::iterator it; |
for(it=mr.begin();it!=mr.end();it++) |
for(it=mr.begin();it!=mr.end();it++) |
cout << *it << '\n'; |
std::cout << *it << '\n'; |
|
} |
|
void testCover(){ |
|
for(int code=0x3021;code<=0x307e;code++){ |
|
BitmapFont bf=ff->find(code); |
|
std::vector<pixel> nc=mat->notCovered(bf); |
|
if(!nc.empty()){ |
|
std::cout << "---------------------------------------\n"; |
|
std::cout << bf; |
|
std::cout << BitmapFont(bf.getWidth(),bf.getHeight(),nc) ; |
|
} |
|
} |
} |
} |
static Test *suite(){ |
static Test *suite(){ |
TestSuite *suiteOfTests = new TestSuite; |
TestSuite *suiteOfTests = new TestSuite; |
suiteOfTests->addTest (new TestCaller<MatchersTest>("testShow", &MatchersTest::testShow)); |
suiteOfTests->addTest (new TestCaller<MatchersTest>("testShow", &MatchersTest::testShow)); |
suiteOfTests->addTest (new TestCaller<MatchersTest>("testMatch", &MatchersTest::testMatch)); |
suiteOfTests->addTest (new TestCaller<MatchersTest>("testMatch", &MatchersTest::testMatch)); |
|
suiteOfTests->addTest (new TestCaller<MatchersTest>("testCover", &MatchersTest::testCover)); |
return suiteOfTests; |
return suiteOfTests; |
} |
} |
}; |
}; |