diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp | 15 | ||||
-rw-r--r-- | tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 14 |
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() { |