Test, fixes, etc.

Originally committed to SVN as r2459.
This commit is contained in:
Rodrigo Braz Monteiro 2008-11-15 04:33:22 +00:00
parent 86500452ae
commit 07a7576547
5 changed files with 26 additions and 9 deletions

View File

@ -38,7 +38,6 @@
#include "tr1.h"
#include "athenatime.h"
#include "athenastring.h"
#include <wx/string.h>
#include <vector>
#include <list>

View File

@ -39,8 +39,15 @@
// Include the Technical Report 1 headers
// This is necessary because some compilers put them on different places
#include <memory>
#include <array>
#ifdef _MSC_VER
// MSVC
#include <memory>
#include <array>
#else
// Fix this if it breaks on non-MSVC
#include <tr1/memory>
#include <tr1/array>
#endif
namespace Athenasub {
using std::tr1::shared_ptr;

View File

@ -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<len;i++) {
// Abort on end of string 2
c2 = operator[](i);
c2 = (unsigned char) operator[](i);
if (!c2) return false;
// Upper case both, this ONLY WORKS FOR ASCII
c1 = src[i] & mask;
c1 = ((unsigned char)src[i]) & mask;
c2 = c2 & mask;
// Check them

View File

@ -38,7 +38,7 @@
// Headers
#include "Athenasub.h"
#include "athenasub.h"
#include "fastbuffer.h"
#include <wx/stream.h>

View File

@ -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;
}
};