From 37da09eeb4ac168217a0d05ae40adfd8c0f35e64 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Thu, 2 Sep 2010 09:28:28 +0000 Subject: load test files from resources so the tests can be run from any path --- tests/tests.cpp | 3 ++- tests/tests.pro | 2 +- tests/tests.qrc | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/tests.qrc (limited to 'tests') diff --git a/tests/tests.cpp b/tests/tests.cpp index 69f0cd2a..4ad3fc59 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -109,7 +109,8 @@ void TestUtils::testJid() static void testMimeType(const QString &fileName, const QString fileType) { - QFile file(fileName); + // load file from resources + QFile file(":/" + fileName); QCOMPARE(file.open(QIODevice::ReadOnly), true); QCOMPARE(getImageType(file.readAll()), fileType); file.close(); diff --git a/tests/tests.pro b/tests/tests.pro index 1ce95d39..2848c2ed 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -4,8 +4,8 @@ QT += network xml testlib TARGET = tests +RESOURCES += tests.qrc SOURCES += tests.cpp - HEADERS += tests.h INCLUDEPATH += $$QXMPP_INCLUDE_DIR diff --git a/tests/tests.qrc b/tests/tests.qrc new file mode 100644 index 00000000..6bc9605e --- /dev/null +++ b/tests/tests.qrc @@ -0,0 +1,11 @@ + + + test.bmp + test.gif + test.jpg + test.mng + test.png + test.svg + test.xpm + + -- cgit v1.2.3