Add xml-serialization to the serializeAttributes test. Add comment to readAttributeFromXML that userPointers are intentionally set to 0.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3033 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
6cc3ffc5be
commit
e7afb972b8
@ -1487,6 +1487,12 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader)
|
|||||||
}
|
}
|
||||||
addArray(name.c_str(),tmpArray);
|
addArray(name.c_str(),tmpArray);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (element == L"userPointer")
|
||||||
|
{
|
||||||
|
// It's debatable if a pointer should be set or not, but it's more likely that adding it now would wreck user-applications.
|
||||||
|
// Also it probably doesn't makes sense setting this to a value when it comes from file.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Write these attributes into a xml file
|
//! Write these attributes into a xml file
|
||||||
|
@ -4,7 +4,7 @@ using namespace irr;
|
|||||||
using namespace core;
|
using namespace core;
|
||||||
using namespace io;
|
using namespace io;
|
||||||
|
|
||||||
#define COMPARE(a, b) if ( (a) != (b) ) { logTestString("Not identical %s in %s:%d", #a, __FILE__, __LINE__ ); return false; }
|
#define COMPARE(a, b) if ( (a) != (b) ) { logTestString("Not identical %s in %s:%d\n", #a, __FILE__, __LINE__ ); return false; }
|
||||||
|
|
||||||
const u32 BINARY_BLOCK_SIZE = 10;
|
const u32 BINARY_BLOCK_SIZE = 10;
|
||||||
|
|
||||||
@ -25,183 +25,181 @@ const c8* const MockEnumNames[EME_COUNT+1] =
|
|||||||
class SerializableMock : public virtual io::IAttributeExchangingObject
|
class SerializableMock : public virtual io::IAttributeExchangingObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SerializableMock(bool comparePointers=true) : ComparePointers(comparePointers)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
|
||||||
{
|
{
|
||||||
out->addInt("valInt", valInt);
|
out->addInt("ValInt", ValInt);
|
||||||
out->addFloat("valFloat", valFloat);
|
out->addFloat("ValFloat", ValFloat);
|
||||||
out->addString("valString", valString.c_str());
|
out->addString("ValString", ValString.c_str());
|
||||||
out->addString("valStringW", valStringW.c_str());
|
out->addString("ValStringW", ValStringW.c_str());
|
||||||
out->addBinary("valBinary", (void*)valBinary, BINARY_BLOCK_SIZE);
|
out->addBinary("ValBinary", (void*)ValBinary, BINARY_BLOCK_SIZE);
|
||||||
out->addArray("valStringWArray", valStringWArray);
|
out->addArray("ValStringWArray", ValStringWArray);
|
||||||
out->addBool("valBool", valBool);
|
out->addBool("ValBool", ValBool);
|
||||||
out->addEnum("valEnum", valEnum, MockEnumNames);
|
out->addEnum("ValEnum", ValEnum, MockEnumNames);
|
||||||
out->addColor("valColor", valColor);
|
out->addColor("ValColor", ValColor);
|
||||||
out->addColorf("valColorf", valColorf);
|
out->addColorf("ValColorf", ValColorf);
|
||||||
out->addVector3d("valVector3df", valVector3df);
|
out->addVector3d("ValVector3df", ValVector3df);
|
||||||
out->addPosition2d("valPosition2di", valPosition2di);
|
out->addPosition2d("ValPosition2di", ValPosition2di);
|
||||||
out->addRect("valRect", valRect);
|
out->addRect("ValRect", ValRect);
|
||||||
out->addMatrix("valMatrix", valMatrix);
|
out->addMatrix("ValMatrix", ValMatrix);
|
||||||
out->addQuaternion("valQuaternion", valQuaternion);
|
out->addQuaternion("ValQuaternion", ValQuaternion);
|
||||||
out->addBox3d("valAabbox3df", valAabbox3df);
|
out->addBox3d("ValAabbox3df", ValAabbox3df);
|
||||||
out->addPlane3d("valPlane3df", valPlane3df);
|
out->addPlane3d("ValPlane3df", ValPlane3df);
|
||||||
out->addTriangle3d("valTriangle3df", valTriangle3df);
|
out->addTriangle3d("ValTriangle3df", ValTriangle3df);
|
||||||
out->addLine2d("valLine2df", valLine2df);
|
out->addLine2d("ValLine2df", ValLine2df);
|
||||||
out->addLine3d("valLine3df", valLine3df);
|
out->addLine3d("ValLine3df", ValLine3df);
|
||||||
out->addTexture("valTexture", valTexture );
|
out->addTexture("ValTexture", ValTexture );
|
||||||
out->addUserPointer("valPointer", valPointer);
|
out->addUserPointer("ValPointer", ValPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
|
||||||
{
|
{
|
||||||
valInt = in->getAttributeAsInt("valInt");
|
ValInt = in->getAttributeAsInt("ValInt");
|
||||||
valFloat = in->getAttributeAsFloat("valFloat");
|
ValFloat = in->getAttributeAsFloat("ValFloat");
|
||||||
valString = in->getAttributeAsString("valString");
|
ValString = in->getAttributeAsString("ValString");
|
||||||
valStringW = in->getAttributeAsStringW("valStringW");
|
ValStringW = in->getAttributeAsStringW("ValStringW");
|
||||||
in->getAttributeAsBinaryData("valBinary", valBinary, BINARY_BLOCK_SIZE);
|
in->getAttributeAsBinaryData("ValBinary", ValBinary, BINARY_BLOCK_SIZE);
|
||||||
valStringWArray = in->getAttributeAsArray("valStringWArray");
|
ValStringWArray = in->getAttributeAsArray("ValStringWArray");
|
||||||
valBool = in->getAttributeAsBool("valBool");
|
ValBool = in->getAttributeAsBool("ValBool");
|
||||||
valEnum = (EMockEnum)in->getAttributeAsEnumeration("valEnum", MockEnumNames);
|
ValEnum = (EMockEnum)in->getAttributeAsEnumeration("ValEnum", MockEnumNames);
|
||||||
valColor = in->getAttributeAsColor("valColor");
|
ValColor = in->getAttributeAsColor("ValColor");
|
||||||
valColorf = in->getAttributeAsColorf("valColorf");
|
ValColorf = in->getAttributeAsColorf("ValColorf");
|
||||||
valVector3df = in->getAttributeAsVector3d("valVector3df");
|
ValVector3df = in->getAttributeAsVector3d("ValVector3df");
|
||||||
valPosition2di = in->getAttributeAsPosition2d("valPosition2di");
|
ValPosition2di = in->getAttributeAsPosition2d("ValPosition2di");
|
||||||
valRect = in->getAttributeAsRect("valRect");
|
ValRect = in->getAttributeAsRect("ValRect");
|
||||||
valMatrix = in->getAttributeAsMatrix("valMatrix");
|
ValMatrix = in->getAttributeAsMatrix("ValMatrix");
|
||||||
valQuaternion = in->getAttributeAsQuaternion("valQuaternion");
|
ValQuaternion = in->getAttributeAsQuaternion("ValQuaternion");
|
||||||
valAabbox3df = in->getAttributeAsBox3d("valAabbox3df");
|
ValAabbox3df = in->getAttributeAsBox3d("ValAabbox3df");
|
||||||
valPlane3df = in->getAttributeAsPlane3d("valPlane3df");
|
ValPlane3df = in->getAttributeAsPlane3d("ValPlane3df");
|
||||||
valTriangle3df = in->getAttributeAsTriangle3d("valTriangle3df");
|
ValTriangle3df = in->getAttributeAsTriangle3d("ValTriangle3df");
|
||||||
valLine2df = in->getAttributeAsLine2d("valLine2df");
|
ValLine2df = in->getAttributeAsLine2d("ValLine2df");
|
||||||
valLine3df = in->getAttributeAsLine3d("valLine3df");
|
ValLine3df = in->getAttributeAsLine3d("ValLine3df");
|
||||||
valTexture = in->getAttributeAsTexture("valTexture");
|
ValTexture = in->getAttributeAsTexture("ValTexture");
|
||||||
valPointer = in->getAttributeAsUserPointer("valPointer");
|
ValPointer = in->getAttributeAsUserPointer("ValPointer");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const SerializableMock& other)
|
bool operator==(const SerializableMock& other)
|
||||||
{
|
{
|
||||||
COMPARE(valInt, other.valInt);
|
COMPARE(ValInt, other.ValInt);
|
||||||
COMPARE(valFloat, other.valFloat);
|
COMPARE(ValFloat, other.ValFloat);
|
||||||
COMPARE(valString, other.valString);
|
COMPARE(ValString, other.ValString);
|
||||||
COMPARE(valStringW, other.valStringW);
|
COMPARE(ValStringW, other.ValStringW);
|
||||||
if ( memcmp( valBinary, other.valBinary, BINARY_BLOCK_SIZE) != 0 )
|
if ( memcmp( ValBinary, other.ValBinary, BINARY_BLOCK_SIZE) != 0 )
|
||||||
{
|
{
|
||||||
logTestString("Not identical %s in %s:%d", "valBinary", __FILE__, __LINE__ );
|
logTestString("Not identical %s in %s:%d", "ValBinary", __FILE__, __LINE__ );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
COMPARE(valStringWArray, other.valStringWArray);
|
COMPARE(ValStringWArray, other.ValStringWArray);
|
||||||
COMPARE(valBool, other.valBool);
|
COMPARE(ValBool, other.ValBool);
|
||||||
COMPARE(valEnum, other.valEnum);
|
COMPARE(ValEnum, other.ValEnum);
|
||||||
COMPARE(valColor, other.valColor);
|
COMPARE(ValColor, other.ValColor);
|
||||||
if ( valColorf.r != other.valColorf.r || valColorf.g != other.valColorf.g || valColorf.b != other.valColorf.b || valColorf.a != other.valColorf.a )
|
if ( ValColorf.r != other.ValColorf.r || ValColorf.g != other.ValColorf.g || ValColorf.b != other.ValColorf.b || ValColorf.a != other.ValColorf.a )
|
||||||
{
|
{
|
||||||
logTestString("Not identical %s in %s:%d", "valColorf", __FILE__, __LINE__ );
|
logTestString("Not identical %s in %s:%d", "ValColorf", __FILE__, __LINE__ );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
COMPARE(valVector3df, other.valVector3df);
|
COMPARE(ValVector3df, other.ValVector3df);
|
||||||
COMPARE(valPosition2di, other.valPosition2di);
|
COMPARE(ValPosition2di, other.ValPosition2di);
|
||||||
COMPARE(valRect, other.valRect);
|
COMPARE(ValRect, other.ValRect);
|
||||||
COMPARE(valMatrix, other.valMatrix);
|
COMPARE(ValMatrix, other.ValMatrix);
|
||||||
COMPARE(valQuaternion, other.valQuaternion);
|
COMPARE(ValQuaternion, other.ValQuaternion);
|
||||||
COMPARE(valAabbox3df, other.valAabbox3df);
|
COMPARE(ValAabbox3df, other.ValAabbox3df);
|
||||||
COMPARE(valPlane3df, other.valPlane3df);
|
COMPARE(ValPlane3df, other.ValPlane3df);
|
||||||
COMPARE(valTriangle3df, other.valTriangle3df);
|
COMPARE(ValTriangle3df, other.ValTriangle3df);
|
||||||
COMPARE(valLine2df, other.valLine2df);
|
COMPARE(ValLine2df, other.ValLine2df);
|
||||||
COMPARE(valLine3df, other.valLine3df);
|
COMPARE(ValLine3df, other.ValLine3df);
|
||||||
// valTexture;
|
// ValTexture; // TODO
|
||||||
COMPARE(valPointer, other.valPointer);
|
if ( ComparePointers )
|
||||||
|
COMPARE(ValPointer, other.ValPointer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
valInt = 0;
|
ValInt = 0;
|
||||||
valFloat = 0.f;
|
ValFloat = 0.f;
|
||||||
valString = "";
|
ValString = "";
|
||||||
valStringW = L"";
|
ValStringW = L"";
|
||||||
memset(valBinary, 0, BINARY_BLOCK_SIZE);
|
memset(ValBinary, 0, BINARY_BLOCK_SIZE);
|
||||||
valStringWArray.clear();
|
ValStringWArray.clear();
|
||||||
valBool = false;
|
ValBool = false;
|
||||||
valEnum = EME_NONE;
|
ValEnum = EME_NONE;
|
||||||
valColor.set(0,0,0,0);
|
ValColor.set(0,0,0,0);
|
||||||
valColorf.set(0.f, 0.f, 0.f, 0.f);
|
ValColorf.set(0.f, 0.f, 0.f, 0.f);
|
||||||
valVector3df.set(0.f, 0.f, 0.f);
|
ValVector3df.set(0.f, 0.f, 0.f);
|
||||||
valPosition2di.set(0,0);
|
ValPosition2di.set(0,0);
|
||||||
valRect = core::rect<s32>(0,0,0,0);
|
ValRect = core::rect<s32>(0,0,0,0);
|
||||||
valMatrix.makeIdentity();
|
ValMatrix.makeIdentity();
|
||||||
valQuaternion.set(0,0,0,0);
|
ValQuaternion.set(0,0,0,0);
|
||||||
valAabbox3df.reset(0,0,0);
|
ValAabbox3df.reset(0,0,0);
|
||||||
valPlane3df.setPlane(vector3df(0.f,0.f,0.f), 0.f);
|
ValPlane3df.setPlane(vector3df(0.f,0.f,0.f), 0.f);
|
||||||
valTriangle3df.set( vector3df(0.f,0.f,0.f), vector3df(0.f,0.f,0.f), vector3df(0.f,0.f,0.f) );
|
ValTriangle3df.set( vector3df(0.f,0.f,0.f), vector3df(0.f,0.f,0.f), vector3df(0.f,0.f,0.f) );
|
||||||
valLine2df.setLine(0.f, 0.f, 0.f, 0.f);
|
ValLine2df.setLine(0.f, 0.f, 0.f, 0.f);
|
||||||
valLine3df.setLine(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
ValLine3df.setLine(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
||||||
valTexture = NULL;
|
ValTexture = NULL;
|
||||||
valPointer = 0;
|
ValPointer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set()
|
void set()
|
||||||
{
|
{
|
||||||
valInt = 1;
|
ValInt = 1;
|
||||||
valFloat = 1.f;
|
ValFloat = 1.f;
|
||||||
valString = "one";
|
ValString = "one";
|
||||||
valStringW = L"ONE";
|
ValStringW = L"ONE";
|
||||||
memset(valBinary, 0xff, BINARY_BLOCK_SIZE);
|
memset(ValBinary, 0xff, BINARY_BLOCK_SIZE);
|
||||||
valStringWArray.push_back( stringw("ONE") );
|
ValStringWArray.push_back( stringw("ONE") );
|
||||||
valStringWArray.push_back( stringw("TWO") );
|
ValStringWArray.push_back( stringw("TWO") );
|
||||||
valStringWArray.push_back( stringw("THREE") );
|
ValStringWArray.push_back( stringw("THREE") );
|
||||||
valBool = true;
|
ValBool = true;
|
||||||
valEnum = EME_ONE;
|
ValEnum = EME_ONE;
|
||||||
valColor.set(1,2,3,4);
|
ValColor.set(1,2,3,4);
|
||||||
valColorf.set(1.f, 2.f, 3.f, 4.f);
|
ValColorf.set(1.f, 2.f, 3.f, 4.f);
|
||||||
valVector3df.set(1.f, 2.f, 3.f);
|
ValVector3df.set(1.f, 2.f, 3.f);
|
||||||
valPosition2di.set(1,2);
|
ValPosition2di.set(1,2);
|
||||||
valRect = core::rect<s32>(1,2,3,4);
|
ValRect = core::rect<s32>(1,2,3,4);
|
||||||
valMatrix = 99.9f;
|
ValMatrix = 99.9f;
|
||||||
valQuaternion.set(1,2,3,4);
|
ValQuaternion.set(1,2,3,4);
|
||||||
valAabbox3df.reset(1,2,3);
|
ValAabbox3df.reset(1,2,3);
|
||||||
valPlane3df.setPlane(vector3df(1.f,2.f,3.f), 4.f);
|
ValPlane3df.setPlane(vector3df(1.f,2.f,3.f), 4.f);
|
||||||
valTriangle3df.set( vector3df(1.f,2.f,3.f), vector3df(4.f,5.f,6.f), vector3df(7.f,8.f,9.f) );
|
ValTriangle3df.set( vector3df(1.f,2.f,3.f), vector3df(4.f,5.f,6.f), vector3df(7.f,8.f,9.f) );
|
||||||
valLine2df.setLine(1.f, 2.f, 3.f, 4.f);
|
ValLine2df.setLine(1.f, 2.f, 3.f, 4.f);
|
||||||
valLine3df.setLine(1.f, 2.f, 3.f, 4.f, 5.f, 6.f);
|
ValLine3df.setLine(1.f, 2.f, 3.f, 4.f, 5.f, 6.f);
|
||||||
valTexture = NULL; // TODO
|
ValTexture = NULL; // TODO
|
||||||
valPointer = (void*)0xffffff;
|
ValPointer = (void*)0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 valInt;
|
s32 ValInt;
|
||||||
f32 valFloat;
|
f32 ValFloat;
|
||||||
core::stringc valString;
|
core::stringc ValString;
|
||||||
core::stringw valStringW;
|
core::stringw ValStringW;
|
||||||
char valBinary[BINARY_BLOCK_SIZE];
|
char ValBinary[BINARY_BLOCK_SIZE];
|
||||||
core::array<core::stringw> valStringWArray;
|
core::array<core::stringw> ValStringWArray;
|
||||||
bool valBool;
|
bool ValBool;
|
||||||
EMockEnum valEnum;
|
EMockEnum ValEnum;
|
||||||
video::SColor valColor;
|
video::SColor ValColor;
|
||||||
video::SColorf valColorf;
|
video::SColorf ValColorf;
|
||||||
core::vector3df valVector3df;
|
core::vector3df ValVector3df;
|
||||||
core::position2di valPosition2di;
|
core::position2di ValPosition2di;
|
||||||
core::rect<s32> valRect;
|
core::rect<s32> ValRect;
|
||||||
core::matrix4 valMatrix;
|
core::matrix4 ValMatrix;
|
||||||
core::quaternion valQuaternion;
|
core::quaternion ValQuaternion;
|
||||||
core::aabbox3df valAabbox3df;
|
core::aabbox3df ValAabbox3df;
|
||||||
core::plane3df valPlane3df;
|
core::plane3df ValPlane3df;
|
||||||
core::triangle3df valTriangle3df;
|
core::triangle3df ValTriangle3df;
|
||||||
core::line2df valLine2df;
|
core::line2df ValLine2df;
|
||||||
core::line3df valLine3df;
|
core::line3df ValLine3df;
|
||||||
video::ITexture* valTexture;
|
video::ITexture* ValTexture;
|
||||||
void* valPointer;
|
void* ValPointer;
|
||||||
|
|
||||||
|
bool ComparePointers;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool serializeAttributes()
|
// Serialization in memory
|
||||||
|
bool MemorySerialization(io::IFileSystem * fs )
|
||||||
{
|
{
|
||||||
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
|
|
||||||
assert(device);
|
|
||||||
if(!device)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
io::IFileSystem * fs = device->getFileSystem ();
|
|
||||||
if ( !fs )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
SerializableMock origMock, copyMock;
|
SerializableMock origMock, copyMock;
|
||||||
origMock.set();
|
origMock.set();
|
||||||
copyMock.reset();
|
copyMock.reset();
|
||||||
@ -209,6 +207,113 @@ bool serializeAttributes()
|
|||||||
io::IAttributes* attr = fs->createEmptyAttributes();
|
io::IAttributes* attr = fs->createEmptyAttributes();
|
||||||
origMock.serializeAttributes(attr, 0);
|
origMock.serializeAttributes(attr, 0);
|
||||||
copyMock.deserializeAttributes(attr, 0);
|
copyMock.deserializeAttributes(attr, 0);
|
||||||
|
attr->drop();
|
||||||
|
|
||||||
return origMock == copyMock;
|
return origMock == copyMock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serialization to/from an xml-file
|
||||||
|
bool XmlSerialization(io::IFileSystem * fs, video::IVideoDriver * driver )
|
||||||
|
{
|
||||||
|
const io::path XML_FILENAME("media/attributeSerialization.xml");
|
||||||
|
SerializableMock origMock(false), copyMock;
|
||||||
|
origMock.set();
|
||||||
|
copyMock.reset();
|
||||||
|
|
||||||
|
// write to xml
|
||||||
|
io::IWriteFile* fileWrite = fs->createAndWriteFile(XML_FILENAME);
|
||||||
|
if (!fileWrite)
|
||||||
|
{
|
||||||
|
logTestString("Could not create xml in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io::IXMLWriter* writer = fs->createXMLWriter(fileWrite);
|
||||||
|
if (!writer)
|
||||||
|
{
|
||||||
|
logTestString("Could not create xml-writer in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
writer->writeXMLHeader();
|
||||||
|
writer->writeLineBreak();
|
||||||
|
io::IAttributes* attrToXml = fs->createEmptyAttributes();
|
||||||
|
origMock.serializeAttributes(attrToXml, 0);
|
||||||
|
attrToXml->write(writer);
|
||||||
|
attrToXml->drop();
|
||||||
|
writer->writeLineBreak();
|
||||||
|
writer->drop();
|
||||||
|
fileWrite->drop();
|
||||||
|
|
||||||
|
// read from xml
|
||||||
|
io::IReadFile* fileRead = fs->createAndOpenFile(XML_FILENAME);
|
||||||
|
if (!fileRead)
|
||||||
|
{
|
||||||
|
logTestString("Could not open xml-file in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io::IXMLReader* reader = fs->createXMLReader(fileRead);
|
||||||
|
if (!reader)
|
||||||
|
{
|
||||||
|
logTestString("createXMLReader failed in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while(reader->read())
|
||||||
|
{
|
||||||
|
switch (reader->getNodeType())
|
||||||
|
{
|
||||||
|
case EXN_ELEMENT:
|
||||||
|
{
|
||||||
|
// read attributes
|
||||||
|
io::IAttributes* attr = fs->createEmptyAttributes(driver);
|
||||||
|
if ( attr->read(reader, true) )
|
||||||
|
{
|
||||||
|
copyMock.deserializeAttributes(attr, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logTestString("attr->read failed in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
}
|
||||||
|
attr->drop();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reader->drop();
|
||||||
|
fileRead->drop();
|
||||||
|
|
||||||
|
return origMock == copyMock;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool serializeAttributes()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
|
||||||
|
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
|
||||||
|
assert(device);
|
||||||
|
if(!device)
|
||||||
|
{
|
||||||
|
logTestString("device creation failed in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io::IFileSystem * fs = device->getFileSystem ();
|
||||||
|
if ( !fs )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result &= MemorySerialization(fs);
|
||||||
|
if ( !result )
|
||||||
|
{
|
||||||
|
logTestString("MemorySerialization failed in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
}
|
||||||
|
|
||||||
|
result &= XmlSerialization(fs, device->getVideoDriver());
|
||||||
|
if ( !result )
|
||||||
|
{
|
||||||
|
logTestString("XmlSerialization failed in %s:%d\n", __FILE__, __LINE__ );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Test suite pass at GMT Tue Dec 8 04:35:12 2009
|
Test suite pass at GMT Wed Dec 9 01:28:55 2009
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user