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:
Kimmo Varis 2011-06-16 13:05:00 +03:00
parent 7ae2536784
commit 08ab764f63
6 changed files with 10 additions and 4 deletions

View File

@ -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);
} }

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -7,6 +7,8 @@ MOC_DIR = ../build
include(../common.pri) include(../common.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\"
# tests # tests
SOURCES += testxmlreportv2.cpp SOURCES += testxmlreportv2.cpp