Blah athenasub blah.

Originally committed to SVN as r2470.
This commit is contained in:
Rodrigo Braz Monteiro 2008-11-21 02:14:15 +00:00
parent 8692fe4220
commit ac9bd6e0db
3 changed files with 16 additions and 6 deletions

View file

@ -48,7 +48,7 @@ Athenasub::TextReaderCache::TextReaderCache(shared_ptr<TextReader> src)
String TextReaderCache::ReadLineFromFile() String TextReaderCache::ReadLineFromFile()
{ {
if (bufferPos == buffer.size()) { if (bufferPos == buffer.size()) {
LoadMore(10); LoadMore(1);
} }
if (bufferPos == buffer.size()) { if (bufferPos == buffer.size()) {
return ""; return "";

View file

@ -94,7 +94,7 @@ int main()
#ifdef WXDEBUG #ifdef WXDEBUG
int n = 1; int n = 1;
#else #else
int n = 1000; int n = 100;
#endif #endif
cout << "Executing action " << n << " times... "; cout << "Executing action " << n << " times... ";
timer.Start(); timer.Start();

View file

@ -79,24 +79,34 @@ public:
void testLoad() void testLoad()
{ {
CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"in_test1.ass","UTF-8")); CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"in_test1.ass","UTF-8"));
ConstModel csubs = subs; CPPUNIT_ASSERT(subs->GetSectionCount() == 3);
CPPUNIT_ASSERT(csubs->GetSectionCount() == 3);
ConstSection section; ConstSection section;
CPPUNIT_ASSERT_NO_THROW(section = csubs->GetSection("Script Info")); CPPUNIT_ASSERT_NO_THROW(section = subs->GetSection("Script Info"));
CPPUNIT_ASSERT(section->HasProperty("ScriptType")); CPPUNIT_ASSERT(section->HasProperty("ScriptType"));
CPPUNIT_ASSERT(section->GetProperty("ScriptType") == "v4.00+"); CPPUNIT_ASSERT(section->GetProperty("ScriptType") == "v4.00+");
CPPUNIT_ASSERT_NO_THROW(section = subs->GetSection("V4+ Styles"));
CPPUNIT_ASSERT(section->GetEntryCount() == 7);
CPPUNIT_ASSERT_NO_THROW(section = subs->GetSection("Events"));
CPPUNIT_ASSERT(section->GetEntryCount() == 362);
} }
void testSave() void testSave()
{ {
CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"in_test1.ass","UTF-8")); CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"in_test1.ass","UTF-8"));
CPPUNIT_ASSERT_NO_THROW(controller->SaveFile(fileFolder+"out_test1.ass","UTF-8")); CPPUNIT_ASSERT_NO_THROW(controller->SaveFile(fileFolder+"out_test1.ass","UTF-8"));
CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"out_test1.ass","UTF-8"));
CPPUNIT_ASSERT(subs->GetSectionCount() == 3);
ConstSection section;
CPPUNIT_ASSERT_NO_THROW(section = subs->GetSection("V4+ Styles"));
CPPUNIT_ASSERT(section->GetEntryCount() == 7);
CPPUNIT_ASSERT_NO_THROW(section = subs->GetSection("Events"));
CPPUNIT_ASSERT(section->GetEntryCount() == 362);
} }
void testStableRewrite() void testStableRewrite()
{ {
CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"out_test1.ass","UTF-8")); CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"out_test1.ass","UTF-8"));
CPPUNIT_ASSERT(subs->GetSectionCount() == 3);
CPPUNIT_ASSERT_NO_THROW(controller->SaveFile(fileFolder+"out_test2.ass","UTF-8")); CPPUNIT_ASSERT_NO_THROW(controller->SaveFile(fileFolder+"out_test2.ass","UTF-8"));
CPPUNIT_ASSERT(AreFilesIdentical(fileFolder+"out_test1.ass",fileFolder+"out_test2.ass")); CPPUNIT_ASSERT(AreFilesIdentical(fileFolder+"out_test1.ass",fileFolder+"out_test2.ass"));
CPPUNIT_ASSERT(AreFilesIdentical(fileFolder+"in_test1.ass",fileFolder+"out_test1.ass") == false); CPPUNIT_ASSERT(AreFilesIdentical(fileFolder+"in_test1.ass",fileFolder+"out_test1.ass") == false);