mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Test, fixes, etc.
Originally committed to SVN as r2459.
This commit is contained in:
parent
86500452ae
commit
07a7576547
@ -38,7 +38,6 @@
|
|||||||
#include "tr1.h"
|
#include "tr1.h"
|
||||||
#include "athenatime.h"
|
#include "athenatime.h"
|
||||||
#include "athenastring.h"
|
#include "athenastring.h"
|
||||||
#include <wx/string.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
@ -39,8 +39,15 @@
|
|||||||
// Include the Technical Report 1 headers
|
// Include the Technical Report 1 headers
|
||||||
// This is necessary because some compilers put them on different places
|
// This is necessary because some compilers put them on different places
|
||||||
|
|
||||||
#include <memory>
|
#ifdef _MSC_VER
|
||||||
#include <array>
|
// MSVC
|
||||||
|
#include <memory>
|
||||||
|
#include <array>
|
||||||
|
#else
|
||||||
|
// Fix this if it breaks on non-MSVC
|
||||||
|
#include <tr1/memory>
|
||||||
|
#include <tr1/array>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Athenasub {
|
namespace Athenasub {
|
||||||
using std::tr1::shared_ptr;
|
using std::tr1::shared_ptr;
|
||||||
|
@ -264,16 +264,16 @@ void String::WriteNumber(Character *temp,int number,int pad,size_t &pos)
|
|||||||
|
|
||||||
bool String::AsciiCompareNoCase(const Character *src) const
|
bool String::AsciiCompareNoCase(const Character *src) const
|
||||||
{
|
{
|
||||||
const Character mask = -96; // 0xDF
|
unsigned char mask = 0xDF; // 0xDF
|
||||||
Character c1,c2;
|
unsigned char c1,c2;
|
||||||
size_t len = size();
|
size_t len = size();
|
||||||
for (size_t i=0;i<len;i++) {
|
for (size_t i=0;i<len;i++) {
|
||||||
// Abort on end of string 2
|
// Abort on end of string 2
|
||||||
c2 = operator[](i);
|
c2 = (unsigned char) operator[](i);
|
||||||
if (!c2) return false;
|
if (!c2) return false;
|
||||||
|
|
||||||
// Upper case both, this ONLY WORKS FOR ASCII
|
// Upper case both, this ONLY WORKS FOR ASCII
|
||||||
c1 = src[i] & mask;
|
c1 = ((unsigned char)src[i]) & mask;
|
||||||
c2 = c2 & mask;
|
c2 = c2 & mask;
|
||||||
|
|
||||||
// Check them
|
// Check them
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Headers
|
// Headers
|
||||||
#include "Athenasub.h"
|
#include "athenasub.h"
|
||||||
#include "fastbuffer.h"
|
#include "fastbuffer.h"
|
||||||
#include <wx/stream.h>
|
#include <wx/stream.h>
|
||||||
|
|
||||||
|
@ -63,10 +63,21 @@ public:
|
|||||||
|
|
||||||
void testDialogueParse()
|
void testDialogueParse()
|
||||||
{
|
{
|
||||||
DialogueASS diag;
|
|
||||||
DialogueASS refDiag;
|
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?";
|
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_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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user