From 07a7576547bc34aefa6085b03d4508286097d3af Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 15 Nov 2008 04:33:22 +0000 Subject: [PATCH] Test, fixes, etc. Originally committed to SVN as r2459. --- athenasub/include/athenasub/interfaces.h | 1 - athenasub/include/athenasub/tr1.h | 11 +++++++++-- athenasub/src/athenastring.cpp | 8 ++++---- athenasub/src/text_file_reader.h | 2 +- unit_test/src/athenasub/test_format_ass.cpp | 13 ++++++++++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/athenasub/include/athenasub/interfaces.h b/athenasub/include/athenasub/interfaces.h index 71126638c..6436fddd7 100644 --- a/athenasub/include/athenasub/interfaces.h +++ b/athenasub/include/athenasub/interfaces.h @@ -38,7 +38,6 @@ #include "tr1.h" #include "athenatime.h" #include "athenastring.h" -#include #include #include diff --git a/athenasub/include/athenasub/tr1.h b/athenasub/include/athenasub/tr1.h index 74829b550..59e28d982 100644 --- a/athenasub/include/athenasub/tr1.h +++ b/athenasub/include/athenasub/tr1.h @@ -39,8 +39,15 @@ // Include the Technical Report 1 headers // This is necessary because some compilers put them on different places -#include -#include +#ifdef _MSC_VER + // MSVC + #include + #include +#else + // Fix this if it breaks on non-MSVC + #include + #include +#endif namespace Athenasub { using std::tr1::shared_ptr; diff --git a/athenasub/src/athenastring.cpp b/athenasub/src/athenastring.cpp index cadd467ee..3c678129e 100644 --- a/athenasub/src/athenastring.cpp +++ b/athenasub/src/athenastring.cpp @@ -264,16 +264,16 @@ void String::WriteNumber(Character *temp,int number,int pad,size_t &pos) bool String::AsciiCompareNoCase(const Character *src) const { - const Character mask = -96; // 0xDF - Character c1,c2; + unsigned char mask = 0xDF; // 0xDF + unsigned char c1,c2; size_t len = size(); for (size_t i=0;i diff --git a/unit_test/src/athenasub/test_format_ass.cpp b/unit_test/src/athenasub/test_format_ass.cpp index d8172c4cf..1c559a507 100644 --- a/unit_test/src/athenasub/test_format_ass.cpp +++ b/unit_test/src/athenasub/test_format_ass.cpp @@ -63,10 +63,21 @@ public: void testDialogueParse() { - DialogueASS diag; DialogueASS refDiag; String refText = "Dialogue: 3,1:23:45.67,2:34:56.78,style name,actor name,0001,0020,3300,effect field,Text, why halo thar?"; CPPUNIT_ASSERT_NO_THROW(refDiag = DialogueASS(refText,1)); + CPPUNIT_ASSERT(refDiag.GetLayer() == 3); + CPPUNIT_ASSERT(refDiag.GetStartTime() == Time(1,23,45,670)); + CPPUNIT_ASSERT(refDiag.GetEndTime() == Time(2,34,56,780)); + CPPUNIT_ASSERT(refDiag.GetStyle() == "style name"); + CPPUNIT_ASSERT(refDiag.GetActor() == "actor name"); + CPPUNIT_ASSERT(refDiag.GetMargin(0) == 1); + CPPUNIT_ASSERT(refDiag.GetMargin(1) == 20); + CPPUNIT_ASSERT(refDiag.GetMargin(2) == 3300); + CPPUNIT_ASSERT(refDiag.GetUserField() == "effect field"); + CPPUNIT_ASSERT(refDiag.GetText() == "Text, why halo thar?"); + + DialogueASS diag; } };