30 #define QCOMPARE(actual, expected) \
31 QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)
33 #define QVERIFY(statement) \
34 QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)
37 #define IS_NOT_IMPL() QSKIP("not implemented yet", SkipSingle)
51 explicit TestBase(QObject *parent = 0);
81 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
91 _state = _o->blockSignals(
true);
97 _state = _o->blockSignals(
true);
102 _o->blockSignals(_state);
110 #include <QSignalBlocker>
126 #include <QDomDocument>
127 #include <QXmlStreamWriter>
134 template <
class T,
typename N>
143 void testDump(
const QString &title = QString());
147 template <
class T,
typename N>
151 QXmlStreamWriter stream(&xml);
152 stream.writeStartElement(
"unittest");
153 T::saveToXMI1(stream);
154 stream.writeEndElement();
158 template <
class T,
typename N>
164 if (!qDoc.setContent(xml, &error, &line))
166 QDomElement root = qDoc.childNodes().at(0).toElement();
167 QDomElement e = root.childNodes().at(0).toElement();
168 bool result = T::loadFromXMI1(e);
171 result = T::resolveRef();
176 template <
class T,
typename N>
179 QString xml = testSave1();
180 qDebug() << title << xml;
184 template <
class T,
typename N>
187 return T::m_pSecondary.data();
193 template <
class T,
typename N>
200 void testDump(
const QString &title = QString());
203 template <
class T,
typename N>
207 QXmlStreamWriter stream(&xml);
208 stream.writeStartElement(
"unittest");
209 T::saveToXMI1(stream);
210 stream.writeEndElement();
214 template <
class T,
typename N>
220 if (!qDoc.setContent(xml, &error, &line))
222 QDomElement root = qDoc.childNodes().at(0).toElement();
223 QDomElement e = root.childNodes().at(0).toElement();
224 bool result = T::loadFromXMI1(e);
227 result = T::activate(
nullptr);
232 template <
class T,
typename N>
235 QString xml = testSave1();
236 qDebug() << title << xml;
Definition: testbase.h:118
SetLoading()
Definition: testbase.cpp:91
~SetLoading()
Definition: testbase.cpp:97
bool _state
Definition: testbase.h:123
Definition: testbase.h:48
virtual void initTestCase()
Definition: testbase.cpp:48
virtual void cleanupOnExit(QObject *p)
Definition: testbase.cpp:63
TestBase(QObject *parent=0)
Definition: testbase.cpp:43
virtual void cleanupTestCase()
Definition: testbase.cpp:55
QList< QPointer< QObject > > m_objectsToDelete
Definition: testbase.h:59
Definition: testbase.h:71
virtual void initTestCase()
Definition: testbase.cpp:68
QString temporaryPath()
Definition: testbase.cpp:86
QString m_tempPath
holds path to temporary directory
Definition: testbase.h:77
Definition: testbase.h:136
QString testSave1()
Definition: testbase.h:148
UMLObject * secondary() const
Definition: testbase.h:185
void testDump(const QString &title=QString())
Definition: testbase.h:177
bool testLoad1(const QString &xml)
Definition: testbase.h:159
static UMLApp * app()
Definition: uml.cpp:280
The base class for UML objects.
Definition: umlobject.h:75
Definition: umlscene.h:70
QSignalBlocker SignalBlocker
Definition: testbase.h:111