on xenial help sign in
More test fixes
commitc1acb7d2555a3fce6ea8ca131a0a08ff89337972 authorMichael Terry <michael.terry@canonical.com> dateFri 22 Apr 2016, 13:56 (10 years ago) parentcea014f
27 files changed+72−41
include/paths.h.in+4−1 plugins/Wizard/PageList.cpp+3−1 tests/plugins/Dash/CMakeLists.txt+6−1 tests/plugins/Dash/cardcreatortest.cpp+4−2 tests/plugins/Dash/horizontaljournaltest.cpp+3−1 tests/plugins/Dash/horizontaljournaltry.cpp+3−1 tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1 tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1 tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1 tests/plugins/Dash/organicgridtest.cpp+3−1 tests/plugins/Dash/organicgridtry.cpp+3−1 tests/plugins/Dash/verticaljournaltest.cpp+3−1 tests/plugins/Dash/verticaljournaltry.cpp+3−1 tests/plugins/GlobalShortcut/CMakeLists.txt+1−4 tests/plugins/GlobalShortcut/GlobalShortcutTest.cpp+3−2 tests/plugins/Greeter/Unity/Launcher/CMakeLists.txt+1−1 tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp+1−1 tests/plugins/ScreenGrabber/CMakeLists.txt+1−4 tests/plugins/ScreenGrabber/ScreenGrabberTest.cpp+3−2 tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1 tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1 tests/plugins/Unity/Launcher/CMakeLists.txt+1−1 tests/plugins/Unity/Launcher/launchermodeltest.cpp+1−1 tests/qmltests/CMakeLists.txt+2 tests/qmltests/Components/CMakeLists.txt+4−5 tests/qmltests/Components/tst_DragHandle.cpp+4−2 tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2
include/paths.h.in+4−1
@@ -28,9 +28,12 @@
2828#include <QStandardPaths>
2929
3030inline bool isRunningInstalled() {
31+ // Tests don't use the normal binary, so we want to check binary *and*
32+ // the environment. Installed tests have UNITY_TESTING_DATADIR set.
3133 static bool installed = (QCoreApplication::applicationDirPath() ==
3234 QDir(QStringLiteral("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
33− return installed;
35+ static bool installed_test_env = !qgetenv("UNITY_TESTING_DATADIR").isEmpty();
36+ return installed || installed_test_env;
3437}
3538
3639inline QString buildDirectory() {
plugins/Wizard/PageList.cpp+3−1
@@ -45,7 +45,9 @@ PageList::PageList(QObject *parent)
4545 QSet<QString> disabledPages;
4646 QStringList dataDirs;
4747
48− if (!isRunningInstalled() && getenv("WIZARD_TESTING") == nullptr) {
48+ if (getenv("WIZARD_TESTING") != nullptr) {
49+ dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
50+ } else if (!isRunningInstalled()) {
4951 dataDirs << qmlDirectory();
5052 } else {
5153 dataDirs = shellDataDirs();
tests/plugins/Dash/CMakeLists.txt+6−1
@@ -22,7 +22,7 @@ include_directories(
2222
2323remove_definitions(-DQT_NO_KEYWORDS)
2424
25−add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
25+add_definitions(-DTEST_DIR="plugins/Dash")
2626
2727macro(add_lvwph_test FILENAME TESTNAME)
2828 add_executable(${TESTNAME}TestExec
@@ -72,6 +72,10 @@ add_dashview_try_test(verticaljournal VerticalJournal)
7272add_dashview_try_test(horizontaljournal HorizontalJournal)
7373add_dashview_try_test(organicgrid OrganicGrid)
7474
75+# Install data files needed for tests
76+file(GLOB qml_files *.qml)
77+install(FILES ${qml_files} DESTINATION "${SHELL_APP_DIR}/tests/plugins/Dash")
78+
7579# CardCreator test
7680add_executable(CardCreatorTestExec cardcreatortest.cpp)
7781qt5_use_modules(CardCreatorTestExec Test Core Qml)
@@ -80,6 +84,7 @@ install(TARGETS CardCreatorTestExec
8084 DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
8185)
8286add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
87+install(DIRECTORY cardcreator DESTINATION "${SHELL_APP_DIR}/tests/plugins/Dash")
8388
8489# plain qml test
8590foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
tests/plugins/Dash/cardcreatortest.cpp+4−2
@@ -22,6 +22,8 @@
2222#include <QDebug>
2323#include <QTemporaryFile>
2424
25+#include <paths.h>
26+
2527class CardCreatorTest : public QObject
2628{
2729 Q_OBJECT
@@ -35,7 +37,7 @@ private Q_SLOTS:
3537 void init()
3638 {
3739 view = new QQuickView();
38− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
40+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/cardcreatortest.qml"));
3941 view->show();
4042 QTest::qWaitForWindowExposed(view);
4143 }
@@ -75,7 +77,7 @@ private Q_SLOTS:
7577 const QString componentsString("components: ");
7678 const QString resultString("result: ");
7779
78− const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
80+ const QString testDirPath = testDataDir() + "/" TEST_DIR "/cardcreator/";
7981 QDir d(testDirPath);
8082 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
8183 foreach(const QString &testFileName, testFiles) {
tests/plugins/Dash/horizontaljournaltest.cpp+3−1
@@ -30,6 +30,8 @@
3030
3131#include "horizontaljournal.h"
3232
33+#include <paths.h>
34+
3335class WidthModel : public QAbstractListModel {
3436public:
3537 QHash<int, QByteArray> roleNames() const override
@@ -129,7 +131,7 @@ private Q_SLOTS:
129131 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
130132 model->setStringList(widthList);
131133
132− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltest.qml"));
134+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltest.qml"));
133135
134136 view->show();
135137 view->resize(470, 400);
tests/plugins/Dash/horizontaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "horizontaljournal.h"
2828
29+#include <paths.h>
30+
2931class QWidthModela : public QStringListModel {
3032 Q_OBJECT
3133public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
7577 view->rootContext()->setContextProperty("listModel", &listModel);
7678 view->rootContext()->setContextProperty("vjModel", &model);
7779
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltry.qml"));
7981
8082 view->show();
8183 view->resize(530, 400);
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1
@@ -29,6 +29,8 @@
2929#include <private/qquickitem_p.h>
3030#pragma GCC diagnostic pop
3131
32+#include <paths.h>
33+
3234class StringListModel : public QAbstractListModel
3335{
3436public:
@@ -168,7 +170,7 @@ private Q_SLOTS:
168170 void init()
169171 {
170172 view = new QQuickView();
171− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
173+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsectionexternalmodel.qml"));
172174 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
173175 QVERIFY(lvwph);
174176 view->show();
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1
@@ -28,6 +28,8 @@
2828#include <private/qquickitem_p.h>
2929#pragma GCC diagnostic pop
3030
31+#include <paths.h>
32+
3133class ListViewWithPageHeaderTestSection : public QObject
3234{
3335 Q_OBJECT
@@ -133,7 +135,7 @@ private Q_SLOTS:
133135 void init()
134136 {
135137 view = new QQuickView();
136− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
138+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsection.qml"));
137139 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
138140 model = view->rootObject()->findChild<QQmlListModel*>();
139141 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1
@@ -30,6 +30,8 @@
3030
3131#include <limits>
3232
33+#include <paths.h>
34+
3335// TODO Think on how doing a test for lost items
3436// particullary making sure that lost items are culled
3537// and then removed in the next updatePolish cycle
@@ -119,7 +121,7 @@ private Q_SLOTS:
119121 void init()
120122 {
121123 view = new QQuickView();
122− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
124+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertest.qml"));
123125 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
124126 model = view->rootObject()->findChild<QQmlListModel*>();
125127 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/organicgridtest.cpp+3−1
@@ -30,6 +30,8 @@
3030
3131#include "organicgrid.h"
3232
33+#include <paths.h>
34+
3335class DummyModel : public QAbstractListModel {
3436public:
3537 DummyModel() : m_count(0) {}
@@ -130,7 +132,7 @@ private Q_SLOTS:
130132 model = new DummyModel();
131133 model->setCount(21);
132134
133− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
135+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtest.qml"));
134136
135137 view->show();
136138 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/organicgridtry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "verticaljournal.h"
2828
29+#include <paths.h>
30+
2931class DummyModel : public QAbstractListModel {
3032 Q_OBJECT
3133public:
@@ -83,7 +85,7 @@ int main(int argc, char *argv[])
8385 view->rootContext()->setContextProperty("listModel", &listModel);
8486 view->rootContext()->setContextProperty("gridModel", &model);
8587
86− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtry.qml"));
88+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtry.qml"));
8789
8890 view->show();
8991 view->resize(530, 400);
tests/plugins/Dash/verticaljournaltest.cpp+3−1
@@ -30,6 +30,8 @@
3030
3131#include "verticaljournal.h"
3232
33+#include <paths.h>
34+
3335class HeightModel : public QAbstractListModel {
3436public:
3537 QHash<int, QByteArray> roleNames() const override
@@ -131,7 +133,7 @@ private Q_SLOTS:
131133 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
132134 model->setStringList(heightList);
133135
134− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
136+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltest.qml"));
135137
136138 view->show();
137139 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/verticaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "verticaljournal.h"
2828
29+#include <paths.h>
30+
2931class QHeightModel : public QStringListModel {
3032 Q_OBJECT
3133public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
7577 view->rootContext()->setContextProperty("listModel", &listModel);
7678 view->rootContext()->setContextProperty("vjModel", &model);
7779
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltry.qml"));
7981
8082 view->show();
8183 view->resize(530, 400);
tests/plugins/GlobalShortcut/CMakeLists.txt+1−4
@@ -3,10 +3,7 @@ include_directories(
33 ${CMAKE_CURRENT_BINARY_DIR}
44 )
55
6−add_definitions(
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
6+add_definitions(-DTEST_DIR="plugins/GlobalShortcut")
107
118add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
129qt5_use_modules(GlobalShortcutTestExec Test Quick)
tests/plugins/GlobalShortcut/GlobalShortcutTest.cpp+3−2
@@ -21,6 +21,8 @@
2121#include <QtQuick/QQuickItem>
2222#include <QQmlEngine>
2323
24+#include <paths.h>
25+
2426class GlobalShortcutTest: public QObject
2527{
2628 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
3032 void initTestCase()
3133 {
3234 m_view = new QQuickView();
33− m_view->engine()->addImportPath(BUILT_PLUGINS_DIR);
34− m_view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/shortcut.qml"));
35+ m_view->setSource(QUrl::fromLocalFile(testLibDir() + "/" TEST_DIR "/shortcut.qml"));
3536 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
3637 QVERIFY(m_shortcut);
3738 m_inactiveShortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("inactiveShortcut").value<QObject*>());
tests/plugins/Greeter/Unity/Launcher/CMakeLists.txt+1−1
@@ -9,7 +9,7 @@ include_directories(
99 )
1010
1111add_definitions(-DSM_BUSNAME=sessionBus)
12−add_definitions(-DTESTDIR="plugins/Greeter/Unity/Launcher")
12+add_definitions(-DTEST_DIR="plugins/Greeter/Unity/Launcher")
1313add_definitions(-DLAUNCHER_TESTING)
1414
1515### LauncherModelASTest
tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp+1−1
@@ -47,7 +47,7 @@ private Q_SLOTS:
4747
4848 void init() {
4949 // Launcher will look in current dir in testing mode for data
50− QDir::setCurrent(testLibDir() + "/" + TESTDIR);
50+ QDir::setCurrent(testLibDir() + "/" + TEST_DIR);
5151
5252 // Prepare some fake list
5353 QList<QVariantMap> list;
tests/plugins/ScreenGrabber/CMakeLists.txt+1−4
@@ -3,10 +3,7 @@ include_directories(
33 ${CMAKE_CURRENT_BINARY_DIR}
44 )
55
6−add_definitions(
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
6+add_definitions(-DTEST_DIR="plugins/ScreenGrabber")
107
118add_executable(ScreenGrabberTestExec ScreenGrabberTest.cpp ${CMAKE_SOURCE_DIR}/plugins/ScreenGrabber/screengrabber.cpp)
129qt5_use_modules(ScreenGrabberTestExec Test Quick Concurrent)
tests/plugins/ScreenGrabber/ScreenGrabberTest.cpp+3−2
@@ -21,6 +21,8 @@
2121#include <QtQuick/QQuickItem>
2222#include <QQmlEngine>
2323
24+#include <paths.h>
25+
2426class ScreenGrabberTest: public QObject
2527{
2628 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
3032 void initTestCase()
3133 {
3234 m_view = new QQuickView();
33− m_view->engine()->addImportPath(BUILT_PLUGINS_DIR);
34− m_view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/grabber.qml"));
35+ m_view->setSource(QUrl::fromLocalFile(testLibDir() + "/" TEST_DIR "/grabber.qml"));
3536 m_grabber = dynamic_cast<ScreenGrabber*>(m_view->rootObject()->property("grabber").value<QObject*>());
3637 QVERIFY(m_grabber);
3738 m_view->show();
tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1
@@ -31,7 +31,7 @@ private Q_SLOTS:
3131
3232 void initTestCase()
3333 {
34− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
34+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
3535 }
3636
3737 void cleanupTestCase()
tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1
@@ -32,7 +32,7 @@ private Q_SLOTS:
3232
3333 void initTestCase()
3434 {
35− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
3636 }
3737
3838 void cleanupTestCase()
tests/plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -11,7 +11,7 @@ include_directories(
1111 )
1212
1313add_definitions(-DSM_BUSNAME=sessionBus)
14−add_definitions(-DTESTDIR="plugins/Unity/Launcher")
14+add_definitions(-DTEST_DIR="plugins/Unity/Launcher")
1515add_definitions(-DLAUNCHER_TESTING)
1616
1717### LauncherModelTest
tests/plugins/Unity/Launcher/launchermodeltest.cpp+1−1
@@ -166,7 +166,7 @@ private Q_SLOTS:
166166 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
167167 void init() {
168168 // Launcher will look in current dir in testing mode for data
169− QDir::setCurrent(testLibDir() + "/" + TESTDIR);
169+ QDir::setCurrent(testLibDir() + "/" + TEST_DIR);
170170
171171 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
172172 QStringLiteral("/org/freedesktop/Accounts"),
tests/qmltests/CMakeLists.txt+2
@@ -108,6 +108,8 @@ add_unity8_qmltest_data(Stages SurfaceManagerControls)
108108add_unity8_qmltest_data(Stages SurfaceManagerField)
109109add_unity8_qmltest(Tutorial Tutorial LIGHTDM)
110110add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
111+add_unity8_qmltest_data(Wizard licenses)
112+add_unity8_qmltest_data(Wizard nolicenses)
111113add_unity8_qmltest(utils/Unity/Test UnityTest)
112114add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTest)
113115add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTestChild)
tests/qmltests/Components/CMakeLists.txt+4−5
@@ -1,4 +1,4 @@
1−add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")
1+add_definitions(-DTEST_DIR="qmltests/Components")
22
33########## tst_DragHandle
44
@@ -22,10 +22,8 @@ set_target_properties(DragHandleTestExec PROPERTIES
2222
2323add_unity8_uitest(DragHandle DragHandleTestExec)
2424add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
25−add_unity8_qmltest_data(tst_DragHandle BidirectionalShowable)
26−add_unity8_qmltest_data(tst_DragHandle HorizontalShowable)
27−add_unity8_qmltest_data(tst_DragHandle SimpleButton)
28−add_unity8_qmltest_data(tst_DragHandle VerticalShowable)
25+add_unity8_qmltest_data(. tst_DragHandle.qml)
26+add_unity8_qmltest_data(. tst_DragHandle)
2927
3028########## tst_EdgeDragEvaluator
3129add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
@@ -39,3 +37,4 @@ set_target_properties(EdgeDragEvaluatorTestExec PROPERTIES
3937 )
4038
4139add_unity8_uitest(EdgeDragEvaluator EdgeDragEvaluatorTestExec)
40+add_unity8_qmltest_data(. tst_EdgeDragEvaluator.qml)
tests/qmltests/Components/tst_DragHandle.cpp+4−2
@@ -27,6 +27,8 @@
2727#include <DirectionalDragArea_p.h>
2828#include <Timer.h>
2929
30+#include <paths.h>
31+
3032using namespace UbuntuGestures;
3133
3234class tst_DragHandle: public QObject
@@ -84,7 +86,7 @@ void tst_DragHandle::cleanupTestCase()
8486void tst_DragHandle::init()
8587{
8688 m_view = createView();
87− m_view->setSource(QUrl::fromLocalFile(TEST_DIR"/tst_DragHandle.qml"));
89+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/tst_DragHandle.qml"));
8890 m_view->show();
8991 QVERIFY(QTest::qWaitForWindowExposed(m_view));
9092 QVERIFY(m_view->rootObject() != 0);
@@ -113,7 +115,7 @@ QQuickView *tst_DragHandle::createView()
113115{
114116 QQuickView *window = new QQuickView(0);
115117 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(TEST_DIR));
118+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
117119
118120 return window;
119121}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2
@@ -26,6 +26,8 @@
2626#include <Direction.h>
2727#include <Timer.h>
2828
29+#include <paths.h>
30+
2931using namespace UbuntuGestures;
3032
3133class tst_EdgeDragEvaluator: public QObject
@@ -67,7 +69,7 @@ void tst_EdgeDragEvaluator::init()
6769{
6870
6971 m_view = createView();
70− m_view->setSource(QUrl::fromLocalFile(TEST_DIR"/tst_EdgeDragEvaluator.qml"));
72+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/tst_EdgeDragEvaluator.qml"));
7173 m_view->show();
7274 QVERIFY(QTest::qWaitForWindowExposed(m_view));
7375 QVERIFY(m_view->rootObject() != 0);
@@ -99,7 +101,7 @@ QQuickView *tst_EdgeDragEvaluator::createView()
99101{
100102 QQuickView *window = new QQuickView(0);
101103 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(TEST_DIR));
104+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
103105
104106 return window;
105107}