summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 03:06:40 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 03:06:40 (GMT)
commit15752b9ee436f7c0cb49c3ad29a2d81104d64d5d (patch)
treedd8f0975845cd8d48510dde1a013565d8c96d003 /tests/auto
parentb443a7b302c2e87920ee62370a1f6bd828d23192 (diff)
downloadQt-15752b9ee436f7c0cb49c3ad29a2d81104d64d5d.zip
Qt-15752b9ee436f7c0cb49c3ad29a2d81104d64d5d.tar.gz
Qt-15752b9ee436f7c0cb49c3ad29a2d81104d64d5d.tar.bz2
Add more resiliant TEST_FILE() method
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp15
-rw-r--r--tests/auto/declarative/qmlparser/tst_qmlparser.cpp14
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
index a0554f3..a1efc5f 100644
--- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
+++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
@@ -3,10 +3,21 @@
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlexpression.h>
#include <QtDeclarative/qmlcontext.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
#include "testtypes.h"
-#define TEST_FILE(filename) \
- QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename)
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
class tst_qmlbindengine : public QObject
{
diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp
index 65ee5e2..089c116 100644
--- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp
+++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp
@@ -3,6 +3,8 @@
#include <QtDeclarative/qmlcomponent.h>
#include <QtCore/qfile.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
#include "testtypes.h"
class tst_qmlparser : public QObject
@@ -73,8 +75,16 @@ private:
QCOMPARE(expected, actual); \
}
-#define TEST_FILE(filename) \
- QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename)
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
void tst_qmlparser::errors_data()
{