Skip to content
Extraits de code Groupes Projets
Valider ac9bd6e0 rédigé par Rodrigo Braz Monteiro's avatar Rodrigo Braz Monteiro
Parcourir les fichiers

Blah athenasub blah.

Originally committed to SVN as r2470.
parent 8692fe42
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -48,7 +48,7 @@ Athenasub::TextReaderCache::TextReaderCache(shared_ptr<TextReader> src) ...@@ -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 "";
......
...@@ -94,7 +94,7 @@ int main() ...@@ -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();
......
...@@ -79,24 +79,34 @@ public: ...@@ -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);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter