on xenial help sign in
Add DEP-8 test for all our UI and unit tests

Some refactoring was needed: - added a basic Ubuntu.Web mock - made plugin path an environment, not a compiled-in bit - moved Unity.Application resources into .qrc

commit56ed3649c31699223636d23c4b9013aaccc571d5 authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 22 Sep 2015, 12:57 (11 years ago) parent9bedfd687da2e4
50 files changed+136−73
CMakeLists.txt+2−1 cmake/modules/QmlTest.cmake+1 debian/tests/control+5 debian/tests/qmluitests.sh+19 include/paths.h.in+16−10 plugins/ScreenGrabber/screengrabber.cpp+4−2 plugins/Wizard/System.cpp+11−3 plugins/Wizard/System.h+3 src/Dash/main.cpp+1−1 src/Panel/Indicators/client/indicatorsclient.cpp+1−1 src/main.cpp+1−1 tests/CMakeLists.txt+9−3 tests/mocks/AccountsService/AccountsService.cpp+1−1 tests/mocks/Ubuntu/CMakeLists.txt+1 tests/mocks/Ubuntu/Web/CMakeLists.txt+1 tests/mocks/Ubuntu/Web/WebView.qml+25 tests/mocks/Ubuntu/Web/qmldir+4 tests/mocks/Unity/Application/CMakeLists.txt+1 tests/mocks/Unity/Application/MirSurface.cpp+2−2 tests/mocks/Unity/Application/MirSurface.h+3−3 tests/mocks/Unity/Application/MirSurfaceItem.cpp+3−4 tests/mocks/Unity/Application/VirtualKeyboard.cpp+2−4 tests/mocks/Unity/Application/MirSurfaceItem.qml → tests/mocks/Unity/Application/resources/MirSurfaceItem.qml tests/mocks/Unity/Application/VirtualKeyboard.qml → tests/mocks/Unity/Application/resources/VirtualKeyboard.qml tests/mocks/Unity/Application/resources/surfaces.qrc+7 tests/mocks/Unity/Application/resources/vkb_portrait.png tests/mocks/Unity/Launcher/MockLauncherItem.cpp+1−1 tests/mocks/Unity/fake_resultsmodel.cpp+1−1 tests/mocks/Unity/fake_scope.cpp+2−2 tests/mocks/Unity/fake_scopesoverview.cpp+1−1 tests/plugins/Dash/CMakeLists.txt−1 tests/plugins/Dash/cardcreatortest.cpp−1 tests/plugins/Dash/horizontaljournaltest.cpp−1 tests/plugins/Dash/horizontaljournaltry.cpp−1 tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp−1 tests/plugins/Dash/listviewwithpageheadersectiontest.cpp−1 tests/plugins/Dash/listviewwithpageheadertest.cpp−1 tests/plugins/Dash/organicgridtest.cpp−1 tests/plugins/Dash/organicgridtry.cpp−1 tests/plugins/Dash/verticaljournaltest.cpp−1 tests/plugins/Dash/verticaljournaltry.cpp−1 tests/plugins/IntegratedLightDM/CMakeLists.txt+1−1 tests/plugins/Ubuntu/Gestures/CMakeLists.txt+3−7 tests/plugins/Ubuntu/Gestures/GestureTest.cpp−2 tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp−1 tests/qmltests/CMakeLists.txt+2−2 tests/qmltests/Components/CMakeLists.txt+1−4 tests/qmltests/Components/tst_DragHandle.cpp−2 tests/qmltests/Components/tst_EdgeDragEvaluator.cpp−1 tools/scopetool.cpp+1−1
CMakeLists.txt+2−1
@@ -13,8 +13,9 @@ endif()
1313
1414set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
1515
16−# Instruct CMake to run moc automatically when needed.
16+# Instruct CMake to run moc and rcc automatically when needed.
1717set(CMAKE_AUTOMOC ON)
18+set(CMAKE_AUTORCC ON)
1819
1920# enable QML debugging
2021string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
cmake/modules/QmlTest.cmake+1
@@ -127,6 +127,7 @@ function(add_executable_test COMPONENT_NAME TARGET)
127127 file(MAKE_DIRECTORY ${ARTIFACTS_DIR}/${path})
128128 set(file_logger -o ${ARTIFACTS_DIR}/${path}/test${COMPONENT_NAME}.xml,xunitxml)
129129 else()
130+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
130131 set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
131132 endif()
132133
debian/tests/controlnew file+5
@@ -0,0 +1,5 @@
1+Tests: qmluitests.sh
2+Restrictions: allow-stderr
3+Depends: @,
4+ @builddeps@,
5+ xvfb,
debian/tests/qmluitests.shnew file+19
@@ -0,0 +1,19 @@
1+#!/bin/sh
2+
3+SHELL_QML_PATH=$(pkg-config --variable=plugindir unity-shell-api)
4+UNITY_SOURCE_DIR=$(readlink -f $(dirname $(readlink -f $0))/../..)
5+
6+dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var" \
7+ -DARTIFACTS_DIR=${ADT_ARTIFACTS} \
8+ -DUNITY_PLUGINPATH=${SHELL_QML_PATH} \
9+ -DUNITY_MOCKPATH=${SHELL_QML_PATH}/mocks
10+dh_auto_build --parallel -- -C tests/mocks
11+dh_auto_build --parallel -- -C tests/plugins
12+dh_auto_build --parallel -- -C tests/qmltests
13+dh_auto_build --parallel -- -C tests/uqmlscene
14+dh_auto_build --parallel -- -C tests/utils
15+
16+export UNITY_SOURCE_DIR
17+
18+# FIXME: --parallel here causes some failures
19+dh_auto_build -- -k xvfballtests
include/paths.h.in+16−10
@@ -33,11 +33,21 @@ inline bool isRunningInstalled() {
3333 return installed;
3434}
3535
36+inline QString buildDirectory() {
37+ if (!qEnvironmentVariableIsEmpty("UNITY_BINARY_DIR")) return qgetenv("UNITY_BINARY_DIR");
38+ return QString("@CMAKE_BINARY_DIR@");
39+}
40+
41+inline QString sourceDirectory() {
42+ if (!qEnvironmentVariableIsEmpty("UNITY_SOURCE_DIR")) return qgetenv("UNITY_SOURCE_DIR");
43+ return QString("@CMAKE_SOURCE_DIR@");
44+}
45+
3646inline QString translationDirectory() {
3747 if (isRunningInstalled()) {
3848 return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
3949 } else {
40− return QString("@CMAKE_BINARY_DIR@/po/locale");
50+ return QString(buildDirectory() + "/po/locale");
4151 }
4252}
4353
@@ -45,14 +55,14 @@ inline QString qmlDirectory() {
4555 if (isRunningInstalled()) {
4656 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
4757 } else {
48− return QString("@CMAKE_SOURCE_DIR@/qml/");
58+ return QString(sourceDirectory() + "/qml");
4959 }
5060}
5161
5262inline QStringList overrideImportPaths() {
5363 QStringList paths;
5464 if (!isRunningInstalled()) {
55− paths << QString("@CMAKE_BINARY_DIR@/plugins");
65+ paths << QString(buildDirectory() + "/plugins");
5666 }
5767 return paths;
5868}
@@ -62,7 +72,7 @@ inline QStringList nonMirImportPaths() {
6272 if (isRunningInstalled()) {
6373 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
6474 } else {
65− paths << QString("@CMAKE_BINARY_DIR@/nonmirplugins");
75+ paths << QString(buildDirectory() + "/nonmirplugins");
6676 }
6777 return paths;
6878}
@@ -77,7 +87,7 @@ inline QStringList fallbackImportPaths() {
7787 } else {
7888 paths << QString("@USS_PRIVATE_PLUGINDIR@");
7989 paths << QString("@SHELL_PLUGINDIR@");
80− paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
90+ paths << QString(buildDirectory() + "/tests/mocks");
8191 }
8292 return paths;
8393}
@@ -86,7 +96,7 @@ inline QString mockPluginsDir() {
8696 if (isRunningInstalled()) {
8797 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
8898 } else {
89− return QString("@CMAKE_BINARY_DIR@/tests/mocks");
99+ return QString(buildDirectory() + "/tests/mocks");
90100 }
91101}
92102
@@ -99,10 +109,6 @@ inline QStringList shellDataDirs() {
99109 return dirs;
100110}
101111
102−inline QString sourceDirectory() {
103− return QString("@CMAKE_SOURCE_DIR@/");
104−}
105−
106112inline void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
107113{
108114 QStringList importPathList = engine->importPathList();
plugins/ScreenGrabber/screengrabber.cpp+4−2
@@ -19,6 +19,7 @@
1919#include <QDir>
2020#include <QDateTime>
2121#include <QStandardPaths>
22+#include <QTemporaryDir>
2223#include <QtGui/QImage>
2324#include <QtGui/QGuiApplication>
2425#include <QtQuick/QQuickWindow>
@@ -42,8 +43,9 @@ ScreenGrabber::ScreenGrabber(QObject *parent)
4243 QDir screenshotsDir;
4344 if (qEnvironmentVariableIsSet("UNITY_TESTING")) {
4445 qDebug() << "Using test environment";
45− QStandardPaths::setTestModeEnabled(true);
46− screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
46+ QTemporaryDir tDir;
47+ tDir.setAutoRemove(false);
48+ screenshotsDir = tDir.path();
4749 } else {
4850 qDebug() << "Using real environment";
4951 screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
plugins/Wizard/System.cpp+11−3
@@ -33,8 +33,10 @@ System::System()
3333 // Register the argument needed for UpdateActivationEnvironment below
3434 qDBusRegisterMetaType<QMap<QString,QString>>();
3535
36− m_fsWatcher.addPath(wizardEnabledPath());
37− connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::wizardEnabledChanged);
36+ if(!wizardEnabled()) {
37+ m_fsWatcher.addPath(wizardEnabledPath());
38+ }
39+ connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::watcherFileChanged);
3840}
3941
4042QString System::wizardEnabledPath()
@@ -59,10 +61,16 @@ void System::setWizardEnabled(bool enabled)
5961 QDir(wizardEnabledPath()).mkpath("..");
6062 QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
6163 m_fsWatcher.addPath(wizardEnabledPath());
62− wizardEnabledChanged();
64+ Q_EMIT wizardEnabledChanged();
6365 }
6466}
6567
68+void System::watcherFileChanged()
69+{
70+ Q_EMIT wizardEnabledChanged();
71+ m_fsWatcher.removePath(wizardEnabledPath());
72+}
73+
6674void System::setSessionVariable(const QString &variable, const QString &value)
6775{
6876 // We need to update both upstart's and DBus's environment
plugins/Wizard/System.h+3
@@ -38,6 +38,9 @@ public Q_SLOTS:
3838Q_SIGNALS:
3939 void wizardEnabledChanged();
4040
41+private Q_SLOTS:
42+ void watcherFileChanged();
43+
4144private:
4245 Q_DISABLE_COPY(System)
4346
src/Dash/main.cpp+1−1
@@ -101,7 +101,7 @@ int main(int argc, const char *argv[])
101101 mouseTouchAdaptor = MouseTouchAdaptor::instance();
102102 }
103103
104− QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
104+ QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
105105 prependImportPaths(view->engine(), ::overrideImportPaths());
106106 appendImportPaths(view->engine(), ::fallbackImportPaths());
107107
src/Panel/Indicators/client/indicatorsclient.cpp+1−1
@@ -36,7 +36,7 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
3636 QStringList args = m_application->arguments();
3737
3838 m_view = new QQuickView;
39− m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()+"Panel/Indicators/client/"));
39+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory() + "/Panel/Indicators/client/"));
4040 prependImportPaths(m_view->engine(), ::overrideImportPaths());
4141 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
4242
src/main.cpp+1−1
@@ -105,7 +105,7 @@ int main(int argc, const char *argv[])
105105 mouseTouchAdaptor = MouseTouchAdaptor::instance();
106106 }
107107
108− QUrl source(::qmlDirectory()+"OrientedShell.qml");
108+ QUrl source(::qmlDirectory() + "/OrientedShell.qml");
109109 prependImportPaths(view->engine(), ::overrideImportPaths());
110110 if (!isMirServer) {
111111 prependImportPaths(view->engine(), ::nonMirImportPaths());
tests/CMakeLists.txt+9−3
@@ -22,11 +22,17 @@ add_subdirectory(uqmlscene)
2222add_executable(qmlscene ALIAS uqmlscene)
2323import_executables(dbus-test-runner)
2424
25+set(UNITY_PLUGINPATH "${CMAKE_BINARY_DIR}/plugins" CACHE PATH "Path to pre-built unity8 plugin dir.")
26+set(UNITY_MOCKPATH "${CMAKE_BINARY_DIR}/tests/mocks" CACHE PATH "Path to pre-built unity8 mock dir.")
27+
28+# Pre-built mocks have preference, pre-built plugins replace local build
2529set(UNITY_IMPORT_PATHS
30+ ${UNITY_MOCKPATH}
2631 ${CMAKE_BINARY_DIR}/tests/mocks
2732 ${CMAKE_BINARY_DIR}/tests/utils/modules
28− ${CMAKE_BINARY_DIR}/plugins
33+ ${UNITY_PLUGINPATH}
2934)
35+list(REMOVE_DUPLICATES UNITY_IMPORT_PATHS)
3036set(UNITY_IMPORT_PATHS ${UNITY_IMPORT_PATHS} CACHE INTERNAL "")
3137
3238macro(unity8_parse_arguments)
@@ -40,8 +46,8 @@ macro(unity8_parse_arguments)
4046 set(ld_paths)
4147 if(U8TEST_LIGHTDM)
4248 list(APPEND ld_paths
43− ${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics
44− ${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
49+ ${UNITY_MOCKPATH}/libusermetrics
50+ ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
4551 )
4652 endif()
4753
tests/mocks/AccountsService/AccountsService.cpp+1−1
@@ -24,7 +24,7 @@ AccountsService::AccountsService(QObject* parent)
2424 : QObject(parent),
2525 m_enableLauncherWhileLocked(true),
2626 m_enableIndicatorsWhileLocked(true),
27− m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
27+ m_backgroundFile(qmlDirectory() + "/graphics/phone_background.jpg"),
2828 m_statsWelcomeScreen(true),
2929 m_failedLogins(0),
3030 m_demoEdges(false),
tests/mocks/Ubuntu/CMakeLists.txt+1
@@ -5,3 +5,4 @@ add_subdirectory(SystemImage)
55add_subdirectory(SystemSettings)
66add_subdirectory(Telephony)
77add_subdirectory(Thumbnailer)
8+add_subdirectory(Web)
tests/mocks/Ubuntu/Web/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_unity8_mock(Ubuntu.Web 0.2 Ubuntu/Web)
tests/mocks/Ubuntu/Web/WebView.qmlnew file+25
@@ -0,0 +1,25 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ */
17+
18+import QtQuick 2.0
19+
20+Item {
21+ property url url
22+ property int loadProgress: 0
23+
24+ onUrlChanged: loadProgress = 100
25+}
tests/mocks/Ubuntu/Web/qmldirnew file+4
@@ -0,0 +1,4 @@
1+module Ubuntu.Web
2+typeinfo Web.qmltypes
3+
4+WebView 0.2 WebView.qml
tests/mocks/Unity/Application/CMakeLists.txt+1
@@ -18,6 +18,7 @@ set(FakeUnityApplicationQml_SOURCES
1818 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
1919 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
2020 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceItemInterface.h
21+ resources/surfaces.qrc
2122)
2223
2324add_library(FakeUnityApplicationQml MODULE ${FakeUnityApplicationQml_SOURCES})
tests/mocks/Unity/Application/MirSurface.cpp+2−2
@@ -22,7 +22,7 @@ MirSurface::MirSurface(const QString& name,
2222 Mir::Type type,
2323 Mir::State state,
2424 const QUrl& screenshot,
25− const QString &qmlFilePath)
25+ const QUrl &qmlFilePath)
2626 : unity::shell::application::MirSurfaceInterface(nullptr)
2727 , m_name(name)
2828 , m_type(type)
@@ -87,7 +87,7 @@ void MirSurface::setLive(bool live)
8787 }
8888}
8989
90−QString MirSurface::qmlFilePath() const
90+QUrl MirSurface::qmlFilePath() const
9191{
9292 return m_qmlFilePath;
9393}
tests/mocks/Unity/Application/MirSurface.h+3−3
@@ -38,7 +38,7 @@ public:
3838 Mir::Type type,
3939 Mir::State state,
4040 const QUrl& screenshot,
41− const QString &qmlFilePath = QString());
41+ const QUrl &qmlFilePath = QUrl());
4242 virtual ~MirSurface();
4343
4444 ////
@@ -76,7 +76,7 @@ public:
7676 /////
7777 // internal mock stuff
7878
79− QString qmlFilePath() const;
79+ QUrl qmlFilePath() const;
8080
8181 QUrl screenshotUrl() const;
8282 void setScreenshotUrl(QUrl);
@@ -102,7 +102,7 @@ private:
102102 Mir::State m_state;
103103 Mir::OrientationAngle m_orientationAngle;
104104 QUrl m_screenshotUrl;
105− QString m_qmlFilePath;
105+ QUrl m_qmlFilePath;
106106 bool m_live;
107107 int m_viewCount;
108108 bool m_activeFocus;
tests/mocks/Unity/Application/MirSurfaceItem.cpp+3−4
@@ -215,12 +215,11 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
215215 QQuickView *quickView =
216216 qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
217217
218− QString qmlComponentFilePath;
218+ QUrl qmlComponentFilePath;
219219 if (!m_qmlSurface->qmlFilePath().isEmpty()) {
220− qmlComponentFilePath.append(m_qmlSurface->qmlFilePath());
220+ qmlComponentFilePath = m_qmlSurface->qmlFilePath();
221221 } else {
222− qmlComponentFilePath = QString("%1/Unity/Application/MirSurfaceItem.qml")
223− .arg(mockPluginsDir());
222+ qmlComponentFilePath = QUrl("qrc:///Unity/Application/MirSurfaceItem.qml");
224223 }
225224
226225 m_qmlContentComponent = new QQmlComponent(quickView->engine(), qmlComponentFilePath);
tests/mocks/Unity/Application/VirtualKeyboard.cpp+2−4
@@ -26,10 +26,8 @@ VirtualKeyboard::VirtualKeyboard()
2626 : MirSurface("input-method",
2727 Mir::InputMethodType,
2828 Mir::MinimizedState,
29− QString("file://%1/Dash/graphics/phone/screenshots/vkb_portrait.png")
30− .arg(qmlDirectory()),
31− QString("%1/Unity/Application/VirtualKeyboard.qml")
32− .arg(mockPluginsDir()))
29+ QUrl("qrc:///Unity/Application/vkb_portrait.png"),
30+ QUrl("qrc:///Unity/Application/VirtualKeyboard.qml"))
3331{
3432}
3533
tests/mocks/Unity/Application/MirSurfaceItem.qml → tests/mocks/Unity/Application/resources/MirSurfaceItem.qmlrenamed

The content is the same.

tests/mocks/Unity/Application/VirtualKeyboard.qml → tests/mocks/Unity/Application/resources/VirtualKeyboard.qmlrenamed

The content is the same.

tests/mocks/Unity/Application/resources/surfaces.qrcnew file+7
@@ -0,0 +1,7 @@
1+<RCC>
2+ <qresource prefix="/Unity/Application">
3+ <file>VirtualKeyboard.qml</file>
4+ <file>MirSurfaceItem.qml</file>
5+ <file>vkb_portrait.png</file>
6+ </qresource>
7+</RCC>
tests/mocks/Unity/Application/resources/vkb_portrait.pngnew file

Binary file not shown.

tests/mocks/Unity/Launcher/MockLauncherItem.cpp+1−1
@@ -29,7 +29,7 @@ MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopF
2929 m_appId(appId),
3030 m_desktopFile(desktopFile),
3131 m_name(name),
32− m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(qmlDirectory() + "/graphics/applicationIcons/" + icon + ".png"),
3333 m_pinned(false),
3434 m_running(false),
3535 m_recent(false),
tests/mocks/Unity/fake_resultsmodel.cpp+1−1
@@ -78,7 +78,7 @@ ResultsModel::data(const QModelIndex& index, int role) const
7878 case RoleTitle:
7979 return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());
8080 case RoleArt:
81− return qmlDirectory() + "graphics/applicationIcons/dash.png";
81+ return qmlDirectory() + "/graphics/applicationIcons/dash.png";
8282 case RoleSubtitle:
8383 return QString("Subtitle.%1.%2").arg(m_categoryId).arg(index.row());
8484 case RoleMascot:
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -253,11 +253,11 @@ QVariantMap Scope::customizations() const
253253 m["foreground-color"] = "blue";
254254 m["page-header"] = h;
255255 } else if (m_id == "MockScope4") {
256− h["navigation-background"] = QUrl(sourceDirectory() + "tests/qmltests/Dash/artwork/background.png");
256+ h["navigation-background"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/artwork/background.png");
257257 m["page-header"] = h;
258258 } else if (m_id == "MockScope5") {
259259 h["background"] = "gradient:///lightgrey/grey";
260− h["logo"] = QUrl(sourceDirectory() + "tests/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
260+ h["logo"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
261261 h["divider-color"] = "red";
262262 h["navigation-background"] = "color:///black";
263263 m["page-header"] = h;
tests/mocks/Unity/fake_scopesoverview.cpp+1−1
@@ -308,7 +308,7 @@ QVariant ScopesOverviewResultsModel::data(const QModelIndex& index, int role) co
308308 case RoleSubtitle:
309309 return scope && scope->name() == "Videos this is long ab cd ef gh ij kl" ? "tube, movies, cinema, pictures, art, moving images, magic in a box" : QString();
310310 case RoleArt:
311− return qmlDirectory() + "graphics/applicationIcons/dash.png";
311+ return qmlDirectory() + "/graphics/applicationIcons/dash.png";
312312 case RoleMascot:
313313 case RoleEmblem:
314314 case RoleSummary:
tests/plugins/Dash/CMakeLists.txt−1
@@ -23,7 +23,6 @@ include_directories(
2323remove_definitions(-DQT_NO_KEYWORDS)
2424
2525add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
26−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
2726
2827macro(add_lvwph_test FILENAME TESTNAME)
2928 add_executable(${TESTNAME}TestExec
tests/plugins/Dash/cardcreatortest.cpp−1
@@ -35,7 +35,6 @@ private Q_SLOTS:
3535 void init()
3636 {
3737 view = new QQuickView();
38− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
3938 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
4039 view->show();
4140 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/horizontaljournaltest.cpp−1
@@ -123,7 +123,6 @@ private Q_SLOTS:
123123 {
124124 view = new QQuickView();
125125 view->setResizeMode(QQuickView::SizeRootObjectToView);
126− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
127126
128127 model = new WidthModel();
129128 QStringList widthList;
tests/plugins/Dash/horizontaljournaltry.cpp−1
@@ -63,7 +63,6 @@ int main(int argc, char *argv[])
6363
6464 QQuickView *view = new QQuickView();
6565 view->setResizeMode(QQuickView::SizeRootObjectToView);
66− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
6766
6867 QWidthModela model;
6968 QStringList heightList;
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp−1
@@ -168,7 +168,6 @@ private Q_SLOTS:
168168 void init()
169169 {
170170 view = new QQuickView();
171− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
172171 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
173172 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
174173 QVERIFY(lvwph);
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp−1
@@ -133,7 +133,6 @@ private Q_SLOTS:
133133 void init()
134134 {
135135 view = new QQuickView();
136− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
137136 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
138137 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
139138 model = view->rootObject()->findChild<QQmlListModel*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp−1
@@ -119,7 +119,6 @@ private Q_SLOTS:
119119 void init()
120120 {
121121 view = new QQuickView();
122− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
123122 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
124123 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
125124 model = view->rootObject()->findChild<QQmlListModel*>();
tests/plugins/Dash/organicgridtest.cpp−1
@@ -126,7 +126,6 @@ private Q_SLOTS:
126126 {
127127 view = new QQuickView();
128128 view->setResizeMode(QQuickView::SizeRootObjectToView);
129− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
130129
131130 model = new DummyModel();
132131 model->setCount(21);
tests/plugins/Dash/organicgridtry.cpp−1
@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
7373
7474 QQuickView *view = new QQuickView();
7575 view->setResizeMode(QQuickView::SizeRootObjectToView);
76− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
7776
7877 DummyModel model;
7978 model.setCount(3);
tests/plugins/Dash/verticaljournaltest.cpp−1
@@ -125,7 +125,6 @@ private Q_SLOTS:
125125 {
126126 view = new QQuickView();
127127 view->setResizeMode(QQuickView::SizeRootObjectToView);
128− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
129128
130129 model = new HeightModel();
131130 QStringList heightList;
tests/plugins/Dash/verticaljournaltry.cpp−1
@@ -63,7 +63,6 @@ int main(int argc, char *argv[])
6363
6464 QQuickView *view = new QQuickView();
6565 view->setResizeMode(QQuickView::SizeRootObjectToView);
66− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
6766
6867 QHeightModel model;
6968 QStringList heightList;
tests/plugins/IntegratedLightDM/CMakeLists.txt+1−1
@@ -25,7 +25,7 @@ add_unity8_uitest(GreeterDBus dbus-test-runner
2525 ARG_PREFIX "--parameter"
2626 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
2727 DEPENDS MockLightDM
28− IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks
28+ IMPORT_PATHS ${UNITY_MOCKPATH}
2929 LIGHTDM
3030 )
3131
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+3−7
@@ -14,9 +14,6 @@ include_directories(
1414
1515export_qmlfiles(UbuntuGesturesTest .)
1616
17−add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins")
18−add_definitions(-DTESTS_UTILS_MODULES_DIR="${CMAKE_BINARY_DIR}/tests/utils/modules")
19−
2017macro(build_gesture_test CLASSNAME)
2118 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
2219 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
@@ -26,7 +23,7 @@ endmacro()
2623macro(add_gesture_unit_test CLASSNAME)
2724 build_gesture_test(${CLASSNAME})
2825 add_unity8_unittest(${CLASSNAME} ${CLASSNAME}TestExec
29− ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
26+ ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
3027 DEPENDS UbuntuGesturesTest-qmlfiles
3128 ${ARGN}
3229 )
@@ -35,12 +32,11 @@ endmacro()
3532macro(add_gesture_ui_test CLASSNAME)
3633 build_gesture_test(${CLASSNAME})
3734 add_unity8_uitest(${CLASSNAME} ${CLASSNAME}TestExec
38− ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
35+ ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
3936 DEPENDS UbuntuGesturesTest-qmlfiles
4037 ${ARGN}
4138 )
42− add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins
43− ${CMAKE_BINARY_DIR}/tests/utils/modules)
39+ add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${UNITY_PLUGINPATH})
4440endmacro()
4541
4642add_gesture_ui_test(DirectionalDragArea)
tests/plugins/Ubuntu/Gestures/GestureTest.cpp−2
@@ -44,8 +44,6 @@ void GestureTest::init()
4444{
4545 m_view = new QQuickView;
4646 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
47− m_view->engine()->addImportPath(QStringLiteral(UBUNTU_GESTURES_PLUGIN_DIR));
48− m_view->engine()->addImportPath(QStringLiteral(TESTS_UTILS_MODULES_DIR));
4947 m_view->setSource(QUrl::fromLocalFile(m_qmlFilename));
5048 m_view->show();
5149 QVERIFY(QTest::qWaitForWindowExposed(m_view));
tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp−1
@@ -119,7 +119,6 @@ QQuickView *tst_TouchGate::createView()
119119 QQuickView *window = new QQuickView(0);
120120 window->setResizeMode(QQuickView::SizeRootObjectToView);
121121 window->resize(720, 720);
122− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
123122
124123 return window;
125124}
tests/qmltests/CMakeLists.txt+2−2
@@ -1,7 +1,7 @@
11
22add_subdirectory(Components)
33
4−add_unity8_qmltest(. OrientedShell)
4+add_unity8_qmltest(. OrientedShell LIGHTDM)
55add_unity8_qmltest(. Shell LIGHTDM)
66add_unity8_qmltest(. ShellWithPin LIGHTDM)
77add_unity8_qmltest(Components Background)
@@ -18,7 +18,7 @@ add_unity8_qmltest(Components Showable)
1818add_unity8_qmltest(Components ZoomableImage)
1919add_unity8_qmltest(Dash Dash)
2020add_unity8_qmltest(Dash DashContent)
21−add_unity8_qmltest(Dash DashShell)
21+add_unity8_qmltest(Dash DashShell LIGHTDM)
2222add_unity8_qmltest(Dash Card)
2323add_unity8_qmltest(Dash CardCarousel)
2424add_unity8_qmlbenchmark(Dash CardBenchmark 1000)
tests/qmltests/Components/CMakeLists.txt+1−4
@@ -1,6 +1,4 @@
1−add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins")
21add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")
3−add_definitions(-DTESTS_UTILS_MODULES_DIR="${CMAKE_BINARY_DIR}/tests/utils/modules")
42
53########## tst_DragHandle
64
@@ -17,8 +15,7 @@ qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
1715target_link_libraries(DragHandleTestExec UbuntuGesturesQml UbuntuGestures)
1816
1917add_unity8_uitest(DragHandle DragHandleTestExec ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
20−add_manual_qml_test(. DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_BINARY_DIR}/tests/utils/modules)
21−
18+add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_PLUGINPATH})
2219
2320########## tst_EdgeDragEvaluator
2421add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
tests/qmltests/Components/tst_DragHandle.cpp−2
@@ -113,9 +113,7 @@ QQuickView *tst_DragHandle::createView()
113113{
114114 QQuickView *window = new QQuickView(0);
115115 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
117116 window->engine()->addImportPath(QLatin1String(TEST_DIR));
118− window->engine()->addImportPath(QStringLiteral(TESTS_UTILS_MODULES_DIR));
119117
120118 return window;
121119}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp−1
@@ -99,7 +99,6 @@ QQuickView *tst_EdgeDragEvaluator::createView()
9999{
100100 QQuickView *window = new QQuickView(0);
101101 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
103102 window->engine()->addImportPath(QLatin1String(TEST_DIR));
104103
105104 return window;
tools/scopetool.cpp+1−1
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
8989 view->setTitle(QGuiApplication::applicationName());
9090 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
9191
92− QUrl source(::qmlDirectory() + "ScopeTool.qml");
92+ QUrl source(::qmlDirectory() + "/ScopeTool.qml");
9393 prependImportPaths(view->engine(), ::overrideImportPaths());
9494 prependImportPaths(view->engine(), ::nonMirImportPaths());
9595 appendImportPaths(view->engine(), ::fallbackImportPaths());