Port badxml autotest to QMetaObjectBuilder
The meta-object format is going to change for Qt5. Use QMOB to insulate the badxml test from such changes. (It just so happens that the QFAIL("a failure") statement is still on line 109 after the refactoring, so the expected_badxml.* files' location tags did not have to be changed.) Change-Id: I04421d13c4df71c8004fa71cafc4823a59079a41 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
parent
c69106d1bf
commit
12520e8300
@ -1,5 +1,5 @@
|
|||||||
SOURCES += tst_badxml.cpp
|
SOURCES += tst_badxml.cpp
|
||||||
QT = core testlib
|
QT = core-private testlib
|
||||||
|
|
||||||
mac:CONFIG -= app_bundle
|
mac:CONFIG -= app_bundle
|
||||||
CONFIG -= debug_and_release_target
|
CONFIG -= debug_and_release_target
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <private/qmetaobjectbuilder_p.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test makes a testlog containing lots of characters which have a special meaning in
|
This test makes a testlog containing lots of characters which have a special meaning in
|
||||||
@ -73,27 +74,26 @@ class EmptyClass : public tst_BadXml
|
|||||||
class tst_BadXmlSub : public tst_BadXml
|
class tst_BadXmlSub : public tst_BadXml
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
tst_BadXmlSub()
|
||||||
|
: className("tst_BadXml"), mo(0) {}
|
||||||
|
~tst_BadXmlSub() { qFree(mo); }
|
||||||
|
|
||||||
const QMetaObject* metaObject() const;
|
const QMetaObject* metaObject() const;
|
||||||
|
|
||||||
static char const* className;
|
QByteArray className;
|
||||||
|
private:
|
||||||
|
QMetaObject *mo;
|
||||||
};
|
};
|
||||||
char const* tst_BadXmlSub::className = "tst_BadXml";
|
|
||||||
|
|
||||||
const QMetaObject* tst_BadXmlSub::metaObject() const
|
const QMetaObject* tst_BadXmlSub::metaObject() const
|
||||||
{
|
{
|
||||||
const QMetaObject& empty = EmptyClass::staticMetaObject;
|
if (!mo || (mo->className() != className)) {
|
||||||
static QMetaObject mo = {
|
qFree(mo);
|
||||||
{ empty.d.superdata, empty.d.stringdata, empty.d.data, empty.d.extradata }
|
QMetaObjectBuilder builder(&EmptyClass::staticMetaObject);
|
||||||
};
|
builder.setClassName(className);
|
||||||
static char currentClassName[1024];
|
const_cast<tst_BadXmlSub *>(this)->mo = builder.toMetaObject();
|
||||||
qstrcpy(currentClassName, className);
|
}
|
||||||
int len = qstrlen(className);
|
return mo;
|
||||||
currentClassName[len] = 0;
|
|
||||||
currentClassName[len+1] = 0;
|
|
||||||
|
|
||||||
mo.d.stringdata = currentClassName;
|
|
||||||
|
|
||||||
return &mo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user