GUITESTS: More flexible test data paths.
Use build-time define to set the path to the source files directory. Which then can be used to format path to the test data. This allows running tests from out-of-source-tree -builds that e.g. QtCreator does.
This commit is contained in:
parent
7ae2536784
commit
08ab764f63
|
@ -37,13 +37,13 @@ void TestXmlReport::testUnquoteMessage()
|
||||||
|
|
||||||
void TestXmlReport::testGetVersion1()
|
void TestXmlReport::testGetVersion1()
|
||||||
{
|
{
|
||||||
const QString filepath("../xmlfiles/xmlreport_v1.xml");
|
const QString filepath(QString(SRCDIR) + "/../xmlfiles/xmlreport_v1.xml");
|
||||||
QCOMPARE(XmlReport::determineVersion(filepath), 1);
|
QCOMPARE(XmlReport::determineVersion(filepath), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestXmlReport::testGetVersion2()
|
void TestXmlReport::testGetVersion2()
|
||||||
{
|
{
|
||||||
const QString filepath("../xmlfiles/xmlreport_v2.xml");
|
const QString filepath(QString(SRCDIR) + "/../xmlfiles/xmlreport_v2.xml");
|
||||||
QCOMPARE(XmlReport::determineVersion(filepath), 2);
|
QCOMPARE(XmlReport::determineVersion(filepath), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ INCLUDEPATH += .
|
||||||
OBJECTS_DIR = ../build
|
OBJECTS_DIR = ../build
|
||||||
MOC_DIR = ../build
|
MOC_DIR = ../build
|
||||||
|
|
||||||
|
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||||
|
|
||||||
include(../common.pri)
|
include(../common.pri)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
void TestXmlReportV1::readXml()
|
void TestXmlReportV1::readXml()
|
||||||
{
|
{
|
||||||
const QString filepath("../xmlfiles/xmlreport_v1.xml");
|
const QString filepath(QString(SRCDIR) + "/../xmlfiles/xmlreport_v1.xml");
|
||||||
XmlReportV1 report(filepath);
|
XmlReportV1 report(filepath);
|
||||||
QVERIFY(report.Open());
|
QVERIFY(report.Open());
|
||||||
QList<ErrorItem> errors = report.Read();
|
QList<ErrorItem> errors = report.Read();
|
||||||
|
|
|
@ -5,6 +5,8 @@ INCLUDEPATH += .
|
||||||
OBJECTS_DIR = ../build
|
OBJECTS_DIR = ../build
|
||||||
MOC_DIR = ../build
|
MOC_DIR = ../build
|
||||||
|
|
||||||
|
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||||
|
|
||||||
include(../common.pri)
|
include(../common.pri)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
void TestXmlReportV2::readXml()
|
void TestXmlReportV2::readXml()
|
||||||
{
|
{
|
||||||
const QString filepath("../xmlfiles/xmlreport_v2.xml");
|
const QString filepath(QString(SRCDIR) + "/../xmlfiles/xmlreport_v2.xml");
|
||||||
XmlReportV2 report(filepath);
|
XmlReportV2 report(filepath);
|
||||||
QVERIFY(report.Open());
|
QVERIFY(report.Open());
|
||||||
QList<ErrorItem> errors = report.Read();
|
QList<ErrorItem> errors = report.Read();
|
||||||
|
|
|
@ -7,6 +7,8 @@ MOC_DIR = ../build
|
||||||
|
|
||||||
include(../common.pri)
|
include(../common.pri)
|
||||||
|
|
||||||
|
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
SOURCES += testxmlreportv2.cpp
|
SOURCES += testxmlreportv2.cpp
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue