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);
68#include <QSignalBlocker>
83#include <QDomDocument>
84#include <QXmlStreamWriter>
91template <
class T,
typename N>
100 void testDump(
const QString &title = QString());
104template <
class T,
typename N>
108 QXmlStreamWriter stream(&xml);
109 stream.writeStartElement(
"unittest");
110 T::saveToXMI(stream);
111 stream.writeEndElement();
115template <
class T,
typename N>
121 if (!qDoc.setContent(xml, &error, &line))
123 QDomElement root = qDoc.childNodes().at(0).toElement();
124 QDomElement e = root.childNodes().at(0).toElement();
125 bool result = T::loadFromXMI(e);
128 result = T::resolveRef();
133template <
class T,
typename N>
136 QString xml = testSave1();
137 qDebug() << title << xml;
141template <
class T,
typename N>
144 return T::m_pSecondary.data();
150template <
class T,
typename N>
157 void testDump(
const QString &title = QString());
160template <
class T,
typename N>
164 QXmlStreamWriter stream(&xml);
165 stream.writeStartElement(
"unittest");
166 T::saveToXMI(stream);
167 stream.writeEndElement();
171template <
class T,
typename N>
177 if (!qDoc.setContent(xml, &error, &line))
179 QDomElement root = qDoc.childNodes().at(0).toElement();
180 QDomElement e = root.childNodes().at(0).toElement();
181 bool result = T::loadFromXMI(e);
184 result = T::activate(
nullptr);
189template <
class T,
typename N>
192 QString xml = testSave1();
193 qDebug() << title << xml;
Definition: testbase.h:75
SetLoading()
Definition: testbase.cpp:93
~SetLoading()
Definition: testbase.cpp:99
bool _state
Definition: testbase.h:80
Definition: testbase.h:34
virtual void initTestCase()
Definition: testbase.cpp:40
virtual void cleanupOnExit(QObject *p)
Definition: testbase.cpp:70
virtual void cleanupTestCase()
Definition: testbase.cpp:59
QWidget * m_mainWidget
Definition: testbase.h:46
QList< QPointer< QObject > > m_objectsToDelete
Definition: testbase.h:45
Definition: testbase.h:58
virtual void initTestCase()
Definition: testbase.cpp:75
QString temporaryPath()
Definition: testbase.cpp:88
QString m_tempPath
holds path to temporary directory
Definition: testbase.h:64
Definition: testbase.h:93
TestUML(N name)
Definition: testbase.h:96
QString testSave1()
Definition: testbase.h:105
TestUML()
Definition: testbase.h:95
UMLObject * secondary() const
Definition: testbase.h:142
void testDump(const QString &title=QString())
Definition: testbase.h:134
bool testLoad1(const QString &xml)
Definition: testbase.h:116
TestUML(N p1, UMLObject *p2, UMLObject *p3)
Definition: testbase.h:97
static UMLApp * app()
Definition: umlapp.cpp:284
The base class for UML objects.
Definition: umlobject.h:70
Definition: umlscene.h:66
QSignalBlocker SignalBlocker
Definition: testbase.h:69