on xenial help sign in
More test fixes
c1acb7dMichael Terry
include/paths.h.in+4−1
@@ -28,9 +28,12 @@
28#include <QStandardPaths>
28#include <QStandardPaths>
29
29
30inline bool isRunningInstalled() {
30inline 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.
31 static bool installed = (QCoreApplication::applicationDirPath() ==
33 static bool installed = (QCoreApplication::applicationDirPath() ==
32 QDir(QStringLiteral("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
34 QDir(QStringLiteral("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
35+ static bool installed_test_env = !qgetenv("UNITY_TESTING_DATADIR").isEmpty();
33− return installed;
36+ return installed || installed_test_env;
34}
37}
35
38
36inline QString buildDirectory() {
39inline QString buildDirectory() {
plugins/Wizard/PageList.cpp+3−1
@@ -45,7 +45,9 @@ PageList::PageList(QObject *parent)
45 QSet<QString> disabledPages;
45 QSet<QString> disabledPages;
46 QStringList dataDirs;
46 QStringList dataDirs;
47
47
48− if (!isRunningInstalled() && getenv("WIZARD_TESTING") == nullptr) {
48+ if (getenv("WIZARD_TESTING") != nullptr) {
49+ dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
50+ } else if (!isRunningInstalled()) {
49 dataDirs << qmlDirectory();
51 dataDirs << qmlDirectory();
50 } else {
52 } else {
51 dataDirs = shellDataDirs();
53 dataDirs = shellDataDirs();
tests/plugins/Dash/CMakeLists.txt+6−1
@@ -22,7 +22,7 @@ include_directories(
22
22
23remove_definitions(-DQT_NO_KEYWORDS)
23remove_definitions(-DQT_NO_KEYWORDS)
24
24
25−add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
25+add_definitions(-DTEST_DIR="plugins/Dash")
26
26
27macro(add_lvwph_test FILENAME TESTNAME)
27macro(add_lvwph_test FILENAME TESTNAME)
28 add_executable(${TESTNAME}TestExec
28 add_executable(${TESTNAME}TestExec
@@ -72,6 +72,10 @@ add_dashview_try_test(verticaljournal VerticalJournal)
72add_dashview_try_test(horizontaljournal HorizontalJournal)
72add_dashview_try_test(horizontaljournal HorizontalJournal)
73add_dashview_try_test(organicgrid OrganicGrid)
73add_dashview_try_test(organicgrid OrganicGrid)
74
74
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+
75# CardCreator test
79# CardCreator test
76add_executable(CardCreatorTestExec cardcreatortest.cpp)
80add_executable(CardCreatorTestExec cardcreatortest.cpp)
77qt5_use_modules(CardCreatorTestExec Test Core Qml)
81qt5_use_modules(CardCreatorTestExec Test Core Qml)
@@ -80,6 +84,7 @@ install(TARGETS CardCreatorTestExec
80 DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
84 DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
81)
85)
82add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
86add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
87+install(DIRECTORY cardcreator DESTINATION "${SHELL_APP_DIR}/tests/plugins/Dash")
83
88
84# plain qml test
89# plain qml test
85foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
90foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
tests/plugins/Dash/cardcreatortest.cpp+4−2
@@ -22,6 +22,8 @@
22#include <QDebug>
22#include <QDebug>
23#include <QTemporaryFile>
23#include <QTemporaryFile>
24
24
25+#include <paths.h>
26+
25class CardCreatorTest : public QObject
27class CardCreatorTest : public QObject
26{
28{
27 Q_OBJECT
29 Q_OBJECT
@@ -35,7 +37,7 @@ private Q_SLOTS:
35 void init()
37 void init()
36 {
38 {
37 view = new QQuickView();
39 view = new QQuickView();
38− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
40+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/cardcreatortest.qml"));
39 view->show();
41 view->show();
40 QTest::qWaitForWindowExposed(view);
42 QTest::qWaitForWindowExposed(view);
41 }
43 }
@@ -75,7 +77,7 @@ private Q_SLOTS:
75 const QString componentsString("components: ");
77 const QString componentsString("components: ");
76 const QString resultString("result: ");
78 const QString resultString("result: ");
77
79
78− const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
80+ const QString testDirPath = testDataDir() + "/" TEST_DIR "/cardcreator/";
79 QDir d(testDirPath);
81 QDir d(testDirPath);
80 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
82 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
81 foreach(const QString &testFileName, testFiles) {
83 foreach(const QString &testFileName, testFiles) {
tests/plugins/Dash/horizontaljournaltest.cpp+3−1
@@ -30,6 +30,8 @@
30
30
31#include "horizontaljournal.h"
31#include "horizontaljournal.h"
32
32
33+#include <paths.h>
34+
33class WidthModel : public QAbstractListModel {
35class WidthModel : public QAbstractListModel {
34public:
36public:
35 QHash<int, QByteArray> roleNames() const override
37 QHash<int, QByteArray> roleNames() const override
@@ -129,7 +131,7 @@ private Q_SLOTS:
129 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
131 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
130 model->setStringList(widthList);
132 model->setStringList(widthList);
131
133
132− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltest.qml"));
134+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltest.qml"));
133
135
134 view->show();
136 view->show();
135 view->resize(470, 400);
137 view->resize(470, 400);
tests/plugins/Dash/horizontaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "horizontaljournal.h"
27#include "horizontaljournal.h"
28
28
29+#include <paths.h>
30+
29class QWidthModela : public QStringListModel {
31class QWidthModela : public QStringListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
75 view->rootContext()->setContextProperty("listModel", &listModel);
77 view->rootContext()->setContextProperty("listModel", &listModel);
76 view->rootContext()->setContextProperty("vjModel", &model);
78 view->rootContext()->setContextProperty("vjModel", &model);
77
79
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltry.qml"));
79
81
80 view->show();
82 view->show();
81 view->resize(530, 400);
83 view->resize(530, 400);
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1
@@ -29,6 +29,8 @@
29#include <private/qquickitem_p.h>
29#include <private/qquickitem_p.h>
30#pragma GCC diagnostic pop
30#pragma GCC diagnostic pop
31
31
32+#include <paths.h>
33+
32class StringListModel : public QAbstractListModel
34class StringListModel : public QAbstractListModel
33{
35{
34public:
36public:
@@ -168,7 +170,7 @@ private Q_SLOTS:
168 void init()
170 void init()
169 {
171 {
170 view = new QQuickView();
172 view = new QQuickView();
171− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
173+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsectionexternalmodel.qml"));
172 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
174 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
173 QVERIFY(lvwph);
175 QVERIFY(lvwph);
174 view->show();
176 view->show();
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1
@@ -28,6 +28,8 @@
28#include <private/qquickitem_p.h>
28#include <private/qquickitem_p.h>
29#pragma GCC diagnostic pop
29#pragma GCC diagnostic pop
30
30
31+#include <paths.h>
32+
31class ListViewWithPageHeaderTestSection : public QObject
33class ListViewWithPageHeaderTestSection : public QObject
32{
34{
33 Q_OBJECT
35 Q_OBJECT
@@ -133,7 +135,7 @@ private Q_SLOTS:
133 void init()
135 void init()
134 {
136 {
135 view = new QQuickView();
137 view = new QQuickView();
136− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
138+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsection.qml"));
137 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
139 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
138 model = view->rootObject()->findChild<QQmlListModel*>();
140 model = view->rootObject()->findChild<QQmlListModel*>();
139 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
141 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1
@@ -30,6 +30,8 @@
30
30
31#include <limits>
31#include <limits>
32
32
33+#include <paths.h>
34+
33// TODO Think on how doing a test for lost items
35// TODO Think on how doing a test for lost items
34// particullary making sure that lost items are culled
36// particullary making sure that lost items are culled
35// and then removed in the next updatePolish cycle
37// and then removed in the next updatePolish cycle
@@ -119,7 +121,7 @@ private Q_SLOTS:
119 void init()
121 void init()
120 {
122 {
121 view = new QQuickView();
123 view = new QQuickView();
122− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
124+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertest.qml"));
123 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
125 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
124 model = view->rootObject()->findChild<QQmlListModel*>();
126 model = view->rootObject()->findChild<QQmlListModel*>();
125 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
127 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/organicgridtest.cpp+3−1
@@ -30,6 +30,8 @@
30
30
31#include "organicgrid.h"
31#include "organicgrid.h"
32
32
33+#include <paths.h>
34+
33class DummyModel : public QAbstractListModel {
35class DummyModel : public QAbstractListModel {
34public:
36public:
35 DummyModel() : m_count(0) {}
37 DummyModel() : m_count(0) {}
@@ -130,7 +132,7 @@ private Q_SLOTS:
130 model = new DummyModel();
132 model = new DummyModel();
131 model->setCount(21);
133 model->setCount(21);
132
134
133− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
135+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtest.qml"));
134
136
135 view->show();
137 view->show();
136 QTest::qWaitForWindowExposed(view);
138 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/organicgridtry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "verticaljournal.h"
27#include "verticaljournal.h"
28
28
29+#include <paths.h>
30+
29class DummyModel : public QAbstractListModel {
31class DummyModel : public QAbstractListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -83,7 +85,7 @@ int main(int argc, char *argv[])
83 view->rootContext()->setContextProperty("listModel", &listModel);
85 view->rootContext()->setContextProperty("listModel", &listModel);
84 view->rootContext()->setContextProperty("gridModel", &model);
86 view->rootContext()->setContextProperty("gridModel", &model);
85
87
86− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtry.qml"));
88+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtry.qml"));
87
89
88 view->show();
90 view->show();
89 view->resize(530, 400);
91 view->resize(530, 400);
tests/plugins/Dash/verticaljournaltest.cpp+3−1
@@ -30,6 +30,8 @@
30
30
31#include "verticaljournal.h"
31#include "verticaljournal.h"
32
32
33+#include <paths.h>
34+
33class HeightModel : public QAbstractListModel {
35class HeightModel : public QAbstractListModel {
34public:
36public:
35 QHash<int, QByteArray> roleNames() const override
37 QHash<int, QByteArray> roleNames() const override
@@ -131,7 +133,7 @@ private Q_SLOTS:
131 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
133 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
132 model->setStringList(heightList);
134 model->setStringList(heightList);
133
135
134− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
136+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltest.qml"));
135
137
136 view->show();
138 view->show();
137 QTest::qWaitForWindowExposed(view);
139 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/verticaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "verticaljournal.h"
27#include "verticaljournal.h"
28
28
29+#include <paths.h>
30+
29class QHeightModel : public QStringListModel {
31class QHeightModel : public QStringListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
75 view->rootContext()->setContextProperty("listModel", &listModel);
77 view->rootContext()->setContextProperty("listModel", &listModel);
76 view->rootContext()->setContextProperty("vjModel", &model);
78 view->rootContext()->setContextProperty("vjModel", &model);
77
79
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltry.qml"));
79
81
80 view->show();
82 view->show();
81 view->resize(530, 400);
83 view->resize(530, 400);
tests/plugins/GlobalShortcut/CMakeLists.txt+1−4
@@ -3,10 +3,7 @@ include_directories(
3 ${CMAKE_CURRENT_BINARY_DIR}
3 ${CMAKE_CURRENT_BINARY_DIR}
4 )
4 )
5
5
6−add_definitions(
6+add_definitions(-DTEST_DIR="plugins/GlobalShortcut")
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
10
7
11add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
8add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
12qt5_use_modules(GlobalShortcutTestExec Test Quick)
9qt5_use_modules(GlobalShortcutTestExec Test Quick)
tests/plugins/GlobalShortcut/GlobalShortcutTest.cpp+3−2
@@ -21,6 +21,8 @@
21#include <QtQuick/QQuickItem>
21#include <QtQuick/QQuickItem>
22#include <QQmlEngine>
22#include <QQmlEngine>
23
23
24+#include <paths.h>
25+
24class GlobalShortcutTest: public QObject
26class GlobalShortcutTest: public QObject
25{
27{
26 Q_OBJECT
28 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
30 void initTestCase()
32 void initTestCase()
31 {
33 {
32 m_view = new QQuickView();
34 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"));
35 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
36 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
36 QVERIFY(m_shortcut);
37 QVERIFY(m_shortcut);
37 m_inactiveShortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("inactiveShortcut").value<QObject*>());
38 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(
9 )
9 )
10
10
11add_definitions(-DSM_BUSNAME=sessionBus)
11add_definitions(-DSM_BUSNAME=sessionBus)
12−add_definitions(-DTESTDIR="plugins/Greeter/Unity/Launcher")
12+add_definitions(-DTEST_DIR="plugins/Greeter/Unity/Launcher")
13add_definitions(-DLAUNCHER_TESTING)
13add_definitions(-DLAUNCHER_TESTING)
14
14
15### LauncherModelASTest
15### LauncherModelASTest
tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp+1−1
@@ -47,7 +47,7 @@ private Q_SLOTS:
47
47
48 void init() {
48 void init() {
49 // Launcher will look in current dir in testing mode for data
49 // Launcher will look in current dir in testing mode for data
50− QDir::setCurrent(testLibDir() + "/" + TESTDIR);
50+ QDir::setCurrent(testLibDir() + "/" + TEST_DIR);
51
51
52 // Prepare some fake list
52 // Prepare some fake list
53 QList<QVariantMap> list;
53 QList<QVariantMap> list;
tests/plugins/ScreenGrabber/CMakeLists.txt+1−4
@@ -3,10 +3,7 @@ include_directories(
3 ${CMAKE_CURRENT_BINARY_DIR}
3 ${CMAKE_CURRENT_BINARY_DIR}
4 )
4 )
5
5
6−add_definitions(
6+add_definitions(-DTEST_DIR="plugins/ScreenGrabber")
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
10
7
11add_executable(ScreenGrabberTestExec ScreenGrabberTest.cpp ${CMAKE_SOURCE_DIR}/plugins/ScreenGrabber/screengrabber.cpp)
8add_executable(ScreenGrabberTestExec ScreenGrabberTest.cpp ${CMAKE_SOURCE_DIR}/plugins/ScreenGrabber/screengrabber.cpp)
12qt5_use_modules(ScreenGrabberTestExec Test Quick Concurrent)
9qt5_use_modules(ScreenGrabberTestExec Test Quick Concurrent)
tests/plugins/ScreenGrabber/ScreenGrabberTest.cpp+3−2
@@ -21,6 +21,8 @@
21#include <QtQuick/QQuickItem>
21#include <QtQuick/QQuickItem>
22#include <QQmlEngine>
22#include <QQmlEngine>
23
23
24+#include <paths.h>
25+
24class ScreenGrabberTest: public QObject
26class ScreenGrabberTest: public QObject
25{
27{
26 Q_OBJECT
28 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
30 void initTestCase()
32 void initTestCase()
31 {
33 {
32 m_view = new QQuickView();
34 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"));
35 m_grabber = dynamic_cast<ScreenGrabber*>(m_view->rootObject()->property("grabber").value<QObject*>());
36 m_grabber = dynamic_cast<ScreenGrabber*>(m_view->rootObject()->property("grabber").value<QObject*>());
36 QVERIFY(m_grabber);
37 QVERIFY(m_grabber);
37 m_view->show();
38 m_view->show();
tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1
@@ -31,7 +31,7 @@ private Q_SLOTS:
31
31
32 void initTestCase()
32 void initTestCase()
33 {
33 {
34− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
34+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
35 }
35 }
36
36
37 void cleanupTestCase()
37 void cleanupTestCase()
tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1
@@ -32,7 +32,7 @@ private Q_SLOTS:
32
32
33 void initTestCase()
33 void initTestCase()
34 {
34 {
35− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
36 }
36 }
37
37
38 void cleanupTestCase()
38 void cleanupTestCase()
tests/plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -11,7 +11,7 @@ include_directories(
11 )
11 )
12
12
13add_definitions(-DSM_BUSNAME=sessionBus)
13add_definitions(-DSM_BUSNAME=sessionBus)
14−add_definitions(-DTESTDIR="plugins/Unity/Launcher")
14+add_definitions(-DTEST_DIR="plugins/Unity/Launcher")
15add_definitions(-DLAUNCHER_TESTING)
15add_definitions(-DLAUNCHER_TESTING)
16
16
17### LauncherModelTest
17### LauncherModelTest
tests/plugins/Unity/Launcher/launchermodeltest.cpp+1−1
@@ -166,7 +166,7 @@ private Q_SLOTS:
166 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
166 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
167 void init() {
167 void init() {
168 // Launcher will look in current dir in testing mode for data
168 // Launcher will look in current dir in testing mode for data
169− QDir::setCurrent(testLibDir() + "/" + TESTDIR);
169+ QDir::setCurrent(testLibDir() + "/" + TEST_DIR);
170
170
171 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
171 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
172 QStringLiteral("/org/freedesktop/Accounts"),
172 QStringLiteral("/org/freedesktop/Accounts"),
tests/qmltests/CMakeLists.txt+2
@@ -108,6 +108,8 @@ add_unity8_qmltest_data(Stages SurfaceManagerControls)
108add_unity8_qmltest_data(Stages SurfaceManagerField)
108add_unity8_qmltest_data(Stages SurfaceManagerField)
109add_unity8_qmltest(Tutorial Tutorial LIGHTDM)
109add_unity8_qmltest(Tutorial Tutorial LIGHTDM)
110add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
110add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
111+add_unity8_qmltest_data(Wizard licenses)
112+add_unity8_qmltest_data(Wizard nolicenses)
111add_unity8_qmltest(utils/Unity/Test UnityTest)
113add_unity8_qmltest(utils/Unity/Test UnityTest)
112add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTest)
114add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTest)
113add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTestChild)
115add_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")
2
2
3########## tst_DragHandle
3########## tst_DragHandle
4
4
@@ -22,10 +22,8 @@ set_target_properties(DragHandleTestExec PROPERTIES
22
22
23add_unity8_uitest(DragHandle DragHandleTestExec)
23add_unity8_uitest(DragHandle DragHandleTestExec)
24add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
24add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
25−add_unity8_qmltest_data(tst_DragHandle BidirectionalShowable)
25+add_unity8_qmltest_data(. tst_DragHandle.qml)
26−add_unity8_qmltest_data(tst_DragHandle HorizontalShowable)
27−add_unity8_qmltest_data(tst_DragHandle SimpleButton)
26+add_unity8_qmltest_data(. tst_DragHandle)
28−add_unity8_qmltest_data(tst_DragHandle VerticalShowable)
29
27
30########## tst_EdgeDragEvaluator
28########## tst_EdgeDragEvaluator
31add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
29add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
@@ -39,3 +37,4 @@ set_target_properties(EdgeDragEvaluatorTestExec PROPERTIES
39 )
37 )
40
38
41add_unity8_uitest(EdgeDragEvaluator EdgeDragEvaluatorTestExec)
39add_unity8_uitest(EdgeDragEvaluator EdgeDragEvaluatorTestExec)
40+add_unity8_qmltest_data(. tst_EdgeDragEvaluator.qml)
tests/qmltests/Components/tst_DragHandle.cpp+4−2
@@ -27,6 +27,8 @@
27#include <DirectionalDragArea_p.h>
27#include <DirectionalDragArea_p.h>
28#include <Timer.h>
28#include <Timer.h>
29
29
30+#include <paths.h>
31+
30using namespace UbuntuGestures;
32using namespace UbuntuGestures;
31
33
32class tst_DragHandle: public QObject
34class tst_DragHandle: public QObject
@@ -84,7 +86,7 @@ void tst_DragHandle::cleanupTestCase()
84void tst_DragHandle::init()
86void tst_DragHandle::init()
85{
87{
86 m_view = createView();
88 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"));
88 m_view->show();
90 m_view->show();
89 QVERIFY(QTest::qWaitForWindowExposed(m_view));
91 QVERIFY(QTest::qWaitForWindowExposed(m_view));
90 QVERIFY(m_view->rootObject() != 0);
92 QVERIFY(m_view->rootObject() != 0);
@@ -113,7 +115,7 @@ QQuickView *tst_DragHandle::createView()
113{
115{
114 QQuickView *window = new QQuickView(0);
116 QQuickView *window = new QQuickView(0);
115 window->setResizeMode(QQuickView::SizeRootObjectToView);
117 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(TEST_DIR));
118+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
117
119
118 return window;
120 return window;
119}
121}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2
@@ -26,6 +26,8 @@
26#include <Direction.h>
26#include <Direction.h>
27#include <Timer.h>
27#include <Timer.h>
28
28
29+#include <paths.h>
30+
29using namespace UbuntuGestures;
31using namespace UbuntuGestures;
30
32
31class tst_EdgeDragEvaluator: public QObject
33class tst_EdgeDragEvaluator: public QObject
@@ -67,7 +69,7 @@ void tst_EdgeDragEvaluator::init()
67{
69{
68
70
69 m_view = createView();
71 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"));
71 m_view->show();
73 m_view->show();
72 QVERIFY(QTest::qWaitForWindowExposed(m_view));
74 QVERIFY(QTest::qWaitForWindowExposed(m_view));
73 QVERIFY(m_view->rootObject() != 0);
75 QVERIFY(m_view->rootObject() != 0);
@@ -99,7 +101,7 @@ QQuickView *tst_EdgeDragEvaluator::createView()
99{
101{
100 QQuickView *window = new QQuickView(0);
102 QQuickView *window = new QQuickView(0);
101 window->setResizeMode(QQuickView::SizeRootObjectToView);
103 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(TEST_DIR));
104+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
103
105
104 return window;
106 return window;
105}
107}