From ac9bd6e0db28a3c94bf335a29630c320cc606627 Mon Sep 17 00:00:00 2001
From: Rodrigo Braz Monteiro <zeratul@cellosoft.com>
Date: Fri, 21 Nov 2008 02:14:15 +0000
Subject: [PATCH] Blah athenasub blah.

Originally committed to SVN as r2470.
---
 athenasub/src/text_reader_cache.cpp   |  2 +-
 athenasub/test/src/main.cpp           |  2 +-
 unit_test/src/athenasub/test_file.cpp | 18 ++++++++++++++----
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/athenasub/src/text_reader_cache.cpp b/athenasub/src/text_reader_cache.cpp
index e6e37caf1..99dc79ef5 100644
--- a/athenasub/src/text_reader_cache.cpp
+++ b/athenasub/src/text_reader_cache.cpp
@@ -48,7 +48,7 @@ Athenasub::TextReaderCache::TextReaderCache(shared_ptr<TextReader> src)
 String TextReaderCache::ReadLineFromFile()
 {
 	if (bufferPos == buffer.size()) {
-		LoadMore(10);
+		LoadMore(1);
 	}
 	if (bufferPos == buffer.size()) {
 		return "";
diff --git a/athenasub/test/src/main.cpp b/athenasub/test/src/main.cpp
index 285b2ec52..b7c8275cf 100644
--- a/athenasub/test/src/main.cpp
+++ b/athenasub/test/src/main.cpp
@@ -94,7 +94,7 @@ int main()
 #ifdef WXDEBUG
 		int n = 1;
 #else
-		int n = 1000;
+		int n = 100;
 #endif
 		cout << "Executing action " << n << " times... ";
 		timer.Start();
diff --git a/unit_test/src/athenasub/test_file.cpp b/unit_test/src/athenasub/test_file.cpp
index 64f386f16..8e92f0297 100644
--- a/unit_test/src/athenasub/test_file.cpp
+++ b/unit_test/src/athenasub/test_file.cpp
@@ -79,24 +79,34 @@ public:
 	void testLoad()
 	{
 		CPPUNIT_ASSERT_NO_THROW(controller->LoadFile(fileFolder+"in_test1.ass","UTF-8"));
-		ConstModel csubs = subs;
-		CPPUNIT_ASSERT(csubs->GetSectionCount() == 3);
+		CPPUNIT_ASSERT(subs->GetSectionCount() == 3);
 		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->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()
 	{
 		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->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()
 	{
 		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(AreFilesIdentical(fileFolder+"out_test1.ass",fileFolder+"out_test2.ass"));
 		CPPUNIT_ASSERT(AreFilesIdentical(fileFolder+"in_test1.ass",fileFolder+"out_test1.ass") == false);
-- 
GitLab