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 =
nullptr);
67#include <QSignalBlocker>
82#include <QDomDocument>
83#include <QXmlStreamWriter>
90template <
class T,
typename N>
99 void testDump(
const QString &title = QString());
103template <
class T,
typename N>
107 QXmlStreamWriter stream(&xml);
108 stream.writeStartElement(
"unittest");
109 T::saveToXMI(stream);
110 stream.writeEndElement();
114template <
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();
132template <
class T,
typename N>
135 QString xml = testSave1();
136 qDebug() << title << xml;
140template <
class T,
typename N>
143 return T::m_pSecondary.data();
149template <
class T,
typename N>
156 void testDump(
const QString &title = QString());
159template <
class T,
typename N>
163 QXmlStreamWriter stream(&xml);
164 stream.writeStartElement(
"unittest");
165 T::saveToXMI(stream);
166 stream.writeEndElement();
170template <
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);
188template <
class T,
typename N>
191 QString xml = testSave1();
192 qDebug() << title << xml;
SetLoading()
Definition testbase.cpp:65
~SetLoading()
Definition testbase.cpp:71
bool _state
Definition testbase.h:79
virtual void initTestCase()
Definition testbase.cpp:28
virtual void cleanupOnExit(QObject *p)
Definition testbase.cpp:42
virtual void cleanupTestCase()
Definition testbase.cpp:36
QList< QPointer< QObject > > m_objectsToDelete
Definition testbase.h:45
virtual void initTestCase()
Definition testbase.cpp:47
QString temporaryPath()
Definition testbase.cpp:60
QString m_tempPath
holds path to temporary directory
Definition testbase.h:63
QString testSave1()
Definition testbase.h:104
UMLObject * secondary() const
Definition testbase.h:141
void testDump(const QString &title=QString())
Definition testbase.h:133
bool testLoad1(const QString &xml)
Definition testbase.h:115
static UMLApp * app()
Definition uml.cpp:304
The base class for UML objects.
Definition umlobject.h:70
QSignalBlocker SignalBlocker
Definition testbase.h:68