16 #define QCOMPARE(actual, expected) \
17 QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)
19 #define QVERIFY(statement) \
20 QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)
23 #define IS_NOT_IMPL() QSKIP("not implemented yet", SkipSingle)
37 explicit TestBase(QObject *parent = 0);
67 #include <QSignalBlocker>
82 #include <QDomDocument>
83 #include <QXmlStreamWriter>
90 template <
class T,
typename N>
99 void testDump(
const QString &title = QString());
103 template <
class T,
typename N>
107 QXmlStreamWriter stream(&xml);
108 stream.writeStartElement(
"unittest");
109 T::saveToXMI(stream);
110 stream.writeEndElement();
114 template <
class T,
typename N>
120 if (!qDoc.setContent(xml, &error, &line))
122 QDomElement root = qDoc.childNodes().at(0).toElement();
123 QDomElement e = root.childNodes().at(0).toElement();
124 bool result = T::loadFromXMI(e);
127 result = T::resolveRef();
132 template <
class T,
typename N>
135 QString xml = testSave1();
136 qDebug() << title << xml;
140 template <
class T,
typename N>
143 return T::m_pSecondary.data();
149 template <
class T,
typename N>
156 void testDump(
const QString &title = QString());
159 template <
class T,
typename N>
163 QXmlStreamWriter stream(&xml);
164 stream.writeStartElement(
"unittest");
165 T::saveToXMI(stream);
166 stream.writeEndElement();
170 template <
class T,
typename N>
176 if (!qDoc.setContent(xml, &error, &line))
178 QDomElement root = qDoc.childNodes().at(0).toElement();
179 QDomElement e = root.childNodes().at(0).toElement();
180 bool result = T::loadFromXMI(e);
183 result = T::activate(
nullptr);
188 template <
class T,
typename N>
191 QString xml = testSave1();
192 qDebug() << title << xml;
virtual void initTestCase()
Definition: testbase.cpp:28
TestBase(QObject *parent=0)
Definition: testbase.cpp:23
virtual void cleanupTestCase()
Definition: testbase.cpp:36
static UMLApp * app()
Definition: uml.cpp:306
Definition: testbase.h:56
virtual void initTestCase()
Definition: testbase.cpp:49
void testDump(const QString &title=QString())
Definition: testbase.h:133
QSignalBlocker SignalBlocker
Definition: testbase.h:68
Definition: testbase.h:91
The base class for UML objects.
Definition: umlobject.h:69
virtual void cleanupOnExit(QObject *p)
Definition: testbase.cpp:44
Definition: testbase.h:73
UMLObject * secondary() const
Definition: testbase.h:141
Definition: testbase.h:33
QString temporaryPath()
Definition: testbase.cpp:62
bool testLoad1(const QString &xml)
Definition: testbase.h:115
QList< QPointer< QObject > > m_objectsToDelete
Definition: testbase.h:45
QString m_tempPath
holds path to temporary directory
Definition: testbase.h:63
QString testSave1()
Definition: testbase.h:104
SetLoading()
Definition: testbase.cpp:67
~SetLoading()
Definition: testbase.cpp:73
Definition: umlscene.h:64
bool _state
Definition: testbase.h:79