on xenial help sign in
Add DEP-8 test for all our UI and unit tests
56ed364Albert Astals Cid
CMakeLists.txt+2−1
@@ -13,8 +13,9 @@ endif()
13
13
14set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
14set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
15
15
16−# Instruct CMake to run moc automatically when needed.
16+# Instruct CMake to run moc and rcc automatically when needed.
17set(CMAKE_AUTOMOC ON)
17set(CMAKE_AUTOMOC ON)
18+set(CMAKE_AUTORCC ON)
18
19
19# enable QML debugging
20# enable QML debugging
20string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
21string(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)
127 file(MAKE_DIRECTORY ${ARTIFACTS_DIR}/${path})
127 file(MAKE_DIRECTORY ${ARTIFACTS_DIR}/${path})
128 set(file_logger -o ${ARTIFACTS_DIR}/${path}/test${COMPONENT_NAME}.xml,xunitxml)
128 set(file_logger -o ${ARTIFACTS_DIR}/${path}/test${COMPONENT_NAME}.xml,xunitxml)
129 else()
129 else()
130+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
130 set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
131 set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
131 endif()
132 endif()
132
133
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() {
33 return installed;
33 return installed;
34}
34}
35
35
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+
36inline QString translationDirectory() {
46inline QString translationDirectory() {
37 if (isRunningInstalled()) {
47 if (isRunningInstalled()) {
38 return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
48 return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
39 } else {
49 } else {
40− return QString("@CMAKE_BINARY_DIR@/po/locale");
50+ return QString(buildDirectory() + "/po/locale");
41 }
51 }
42}
52}
43
53
@@ -45,14 +55,14 @@ inline QString qmlDirectory() {
45 if (isRunningInstalled()) {
55 if (isRunningInstalled()) {
46 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
56 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
47 } else {
57 } else {
48− return QString("@CMAKE_SOURCE_DIR@/qml/");
58+ return QString(sourceDirectory() + "/qml");
49 }
59 }
50}
60}
51
61
52inline QStringList overrideImportPaths() {
62inline QStringList overrideImportPaths() {
53 QStringList paths;
63 QStringList paths;
54 if (!isRunningInstalled()) {
64 if (!isRunningInstalled()) {
55− paths << QString("@CMAKE_BINARY_DIR@/plugins");
65+ paths << QString(buildDirectory() + "/plugins");
56 }
66 }
57 return paths;
67 return paths;
58}
68}
@@ -62,7 +72,7 @@ inline QStringList nonMirImportPaths() {
62 if (isRunningInstalled()) {
72 if (isRunningInstalled()) {
63 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
73 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
64 } else {
74 } else {
65− paths << QString("@CMAKE_BINARY_DIR@/nonmirplugins");
75+ paths << QString(buildDirectory() + "/nonmirplugins");
66 }
76 }
67 return paths;
77 return paths;
68}
78}
@@ -77,7 +87,7 @@ inline QStringList fallbackImportPaths() {
77 } else {
87 } else {
78 paths << QString("@USS_PRIVATE_PLUGINDIR@");
88 paths << QString("@USS_PRIVATE_PLUGINDIR@");
79 paths << QString("@SHELL_PLUGINDIR@");
89 paths << QString("@SHELL_PLUGINDIR@");
80− paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
90+ paths << QString(buildDirectory() + "/tests/mocks");
81 }
91 }
82 return paths;
92 return paths;
83}
93}
@@ -86,7 +96,7 @@ inline QString mockPluginsDir() {
86 if (isRunningInstalled()) {
96 if (isRunningInstalled()) {
87 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
97 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
88 } else {
98 } else {
89− return QString("@CMAKE_BINARY_DIR@/tests/mocks");
99+ return QString(buildDirectory() + "/tests/mocks");
90 }
100 }
91}
101}
92
102
@@ -99,10 +109,6 @@ inline QStringList shellDataDirs() {
99 return dirs;
109 return dirs;
100}
110}
101
111
102−inline QString sourceDirectory() {
103− return QString("@CMAKE_SOURCE_DIR@/");
104−}
105−
106inline void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
112inline void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
107{
113{
108 QStringList importPathList = engine->importPathList();
114 QStringList importPathList = engine->importPathList();
plugins/ScreenGrabber/screengrabber.cpp+4−2
@@ -19,6 +19,7 @@
19#include <QDir>
19#include <QDir>
20#include <QDateTime>
20#include <QDateTime>
21#include <QStandardPaths>
21#include <QStandardPaths>
22+#include <QTemporaryDir>
22#include <QtGui/QImage>
23#include <QtGui/QImage>
23#include <QtGui/QGuiApplication>
24#include <QtGui/QGuiApplication>
24#include <QtQuick/QQuickWindow>
25#include <QtQuick/QQuickWindow>
@@ -42,8 +43,9 @@ ScreenGrabber::ScreenGrabber(QObject *parent)
42 QDir screenshotsDir;
43 QDir screenshotsDir;
43 if (qEnvironmentVariableIsSet("UNITY_TESTING")) {
44 if (qEnvironmentVariableIsSet("UNITY_TESTING")) {
44 qDebug() << "Using test environment";
45 qDebug() << "Using test environment";
45− QStandardPaths::setTestModeEnabled(true);
46+ QTemporaryDir tDir;
46− screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
47+ tDir.setAutoRemove(false);
48+ screenshotsDir = tDir.path();
47 } else {
49 } else {
48 qDebug() << "Using real environment";
50 qDebug() << "Using real environment";
49 screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
51 screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
plugins/Wizard/System.cpp+11−3
@@ -33,8 +33,10 @@ System::System()
33 // Register the argument needed for UpdateActivationEnvironment below
33 // Register the argument needed for UpdateActivationEnvironment below
34 qDBusRegisterMetaType<QMap<QString,QString>>();
34 qDBusRegisterMetaType<QMap<QString,QString>>();
35
35
36+ if(!wizardEnabled()) {
36− m_fsWatcher.addPath(wizardEnabledPath());
37+ m_fsWatcher.addPath(wizardEnabledPath());
38+ }
37− connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::wizardEnabledChanged);
39+ connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::watcherFileChanged);
38}
40}
39
41
40QString System::wizardEnabledPath()
42QString System::wizardEnabledPath()
@@ -59,10 +61,16 @@ void System::setWizardEnabled(bool enabled)
59 QDir(wizardEnabledPath()).mkpath("..");
61 QDir(wizardEnabledPath()).mkpath("..");
60 QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
62 QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
61 m_fsWatcher.addPath(wizardEnabledPath());
63 m_fsWatcher.addPath(wizardEnabledPath());
62− wizardEnabledChanged();
64+ Q_EMIT wizardEnabledChanged();
63 }
65 }
64}
66}
65
67
68+void System::watcherFileChanged()
69+{
70+ Q_EMIT wizardEnabledChanged();
71+ m_fsWatcher.removePath(wizardEnabledPath());
72+}
73+
66void System::setSessionVariable(const QString &variable, const QString &value)
74void System::setSessionVariable(const QString &variable, const QString &value)
67{
75{
68 // We need to update both upstart's and DBus's environment
76 // We need to update both upstart's and DBus's environment
plugins/Wizard/System.h+3
@@ -38,6 +38,9 @@ public Q_SLOTS:
38Q_SIGNALS:
38Q_SIGNALS:
39 void wizardEnabledChanged();
39 void wizardEnabledChanged();
40
40
41+private Q_SLOTS:
42+ void watcherFileChanged();
43+
41private:
44private:
42 Q_DISABLE_COPY(System)
45 Q_DISABLE_COPY(System)
43
46
src/Dash/main.cpp+1−1
@@ -101,7 +101,7 @@ int main(int argc, const char *argv[])
101 mouseTouchAdaptor = MouseTouchAdaptor::instance();
101 mouseTouchAdaptor = MouseTouchAdaptor::instance();
102 }
102 }
103
103
104− QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
104+ QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
105 prependImportPaths(view->engine(), ::overrideImportPaths());
105 prependImportPaths(view->engine(), ::overrideImportPaths());
106 appendImportPaths(view->engine(), ::fallbackImportPaths());
106 appendImportPaths(view->engine(), ::fallbackImportPaths());
107
107
src/Panel/Indicators/client/indicatorsclient.cpp+1−1
@@ -36,7 +36,7 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
36 QStringList args = m_application->arguments();
36 QStringList args = m_application->arguments();
37
37
38 m_view = new QQuickView;
38 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/"));
40 prependImportPaths(m_view->engine(), ::overrideImportPaths());
40 prependImportPaths(m_view->engine(), ::overrideImportPaths());
41 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
41 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
42
42
src/main.cpp+1−1
@@ -105,7 +105,7 @@ int main(int argc, const char *argv[])
105 mouseTouchAdaptor = MouseTouchAdaptor::instance();
105 mouseTouchAdaptor = MouseTouchAdaptor::instance();
106 }
106 }
107
107
108− QUrl source(::qmlDirectory()+"OrientedShell.qml");
108+ QUrl source(::qmlDirectory() + "/OrientedShell.qml");
109 prependImportPaths(view->engine(), ::overrideImportPaths());
109 prependImportPaths(view->engine(), ::overrideImportPaths());
110 if (!isMirServer) {
110 if (!isMirServer) {
111 prependImportPaths(view->engine(), ::nonMirImportPaths());
111 prependImportPaths(view->engine(), ::nonMirImportPaths());
tests/CMakeLists.txt+9−3
@@ -22,11 +22,17 @@ add_subdirectory(uqmlscene)
22add_executable(qmlscene ALIAS uqmlscene)
22add_executable(qmlscene ALIAS uqmlscene)
23import_executables(dbus-test-runner)
23import_executables(dbus-test-runner)
24
24
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
25set(UNITY_IMPORT_PATHS
29set(UNITY_IMPORT_PATHS
30+ ${UNITY_MOCKPATH}
26 ${CMAKE_BINARY_DIR}/tests/mocks
31 ${CMAKE_BINARY_DIR}/tests/mocks
27 ${CMAKE_BINARY_DIR}/tests/utils/modules
32 ${CMAKE_BINARY_DIR}/tests/utils/modules
28− ${CMAKE_BINARY_DIR}/plugins
33+ ${UNITY_PLUGINPATH}
29)
34)
35+list(REMOVE_DUPLICATES UNITY_IMPORT_PATHS)
30set(UNITY_IMPORT_PATHS ${UNITY_IMPORT_PATHS} CACHE INTERNAL "")
36set(UNITY_IMPORT_PATHS ${UNITY_IMPORT_PATHS} CACHE INTERNAL "")
31
37
32macro(unity8_parse_arguments)
38macro(unity8_parse_arguments)
@@ -40,8 +46,8 @@ macro(unity8_parse_arguments)
40 set(ld_paths)
46 set(ld_paths)
41 if(U8TEST_LIGHTDM)
47 if(U8TEST_LIGHTDM)
42 list(APPEND ld_paths
48 list(APPEND ld_paths
43− ${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics
49+ ${UNITY_MOCKPATH}/libusermetrics
44− ${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
50+ ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
45 )
51 )
46 endif()
52 endif()
47
53
tests/mocks/AccountsService/AccountsService.cpp+1−1
@@ -24,7 +24,7 @@ AccountsService::AccountsService(QObject* parent)
24 : QObject(parent),
24 : QObject(parent),
25 m_enableLauncherWhileLocked(true),
25 m_enableLauncherWhileLocked(true),
26 m_enableIndicatorsWhileLocked(true),
26 m_enableIndicatorsWhileLocked(true),
27− m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
27+ m_backgroundFile(qmlDirectory() + "/graphics/phone_background.jpg"),
28 m_statsWelcomeScreen(true),
28 m_statsWelcomeScreen(true),
29 m_failedLogins(0),
29 m_failedLogins(0),
30 m_demoEdges(false),
30 m_demoEdges(false),
tests/mocks/Ubuntu/CMakeLists.txt+1
@@ -5,3 +5,4 @@ add_subdirectory(SystemImage)
5add_subdirectory(SystemSettings)
5add_subdirectory(SystemSettings)
6add_subdirectory(Telephony)
6add_subdirectory(Telephony)
7add_subdirectory(Thumbnailer)
7add_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
18 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
18 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
19 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
19 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
20 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceItemInterface.h
20 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceItemInterface.h
21+ resources/surfaces.qrc
21)
22)
22
23
23add_library(FakeUnityApplicationQml MODULE ${FakeUnityApplicationQml_SOURCES})
24add_library(FakeUnityApplicationQml MODULE ${FakeUnityApplicationQml_SOURCES})
tests/mocks/Unity/Application/MirSurface.cpp+2−2
@@ -22,7 +22,7 @@ MirSurface::MirSurface(const QString& name,
22 Mir::Type type,
22 Mir::Type type,
23 Mir::State state,
23 Mir::State state,
24 const QUrl& screenshot,
24 const QUrl& screenshot,
25− const QString &qmlFilePath)
25+ const QUrl &qmlFilePath)
26 : unity::shell::application::MirSurfaceInterface(nullptr)
26 : unity::shell::application::MirSurfaceInterface(nullptr)
27 , m_name(name)
27 , m_name(name)
28 , m_type(type)
28 , m_type(type)
@@ -87,7 +87,7 @@ void MirSurface::setLive(bool live)
87 }
87 }
88}
88}
89
89
90−QString MirSurface::qmlFilePath() const
90+QUrl MirSurface::qmlFilePath() const
91{
91{
92 return m_qmlFilePath;
92 return m_qmlFilePath;
93}
93}
tests/mocks/Unity/Application/MirSurface.h+3−3
@@ -38,7 +38,7 @@ public:
38 Mir::Type type,
38 Mir::Type type,
39 Mir::State state,
39 Mir::State state,
40 const QUrl& screenshot,
40 const QUrl& screenshot,
41− const QString &qmlFilePath = QString());
41+ const QUrl &qmlFilePath = QUrl());
42 virtual ~MirSurface();
42 virtual ~MirSurface();
43
43
44 ////
44 ////
@@ -76,7 +76,7 @@ public:
76 /////
76 /////
77 // internal mock stuff
77 // internal mock stuff
78
78
79− QString qmlFilePath() const;
79+ QUrl qmlFilePath() const;
80
80
81 QUrl screenshotUrl() const;
81 QUrl screenshotUrl() const;
82 void setScreenshotUrl(QUrl);
82 void setScreenshotUrl(QUrl);
@@ -102,7 +102,7 @@ private:
102 Mir::State m_state;
102 Mir::State m_state;
103 Mir::OrientationAngle m_orientationAngle;
103 Mir::OrientationAngle m_orientationAngle;
104 QUrl m_screenshotUrl;
104 QUrl m_screenshotUrl;
105− QString m_qmlFilePath;
105+ QUrl m_qmlFilePath;
106 bool m_live;
106 bool m_live;
107 int m_viewCount;
107 int m_viewCount;
108 bool m_activeFocus;
108 bool m_activeFocus;
tests/mocks/Unity/Application/MirSurfaceItem.cpp+3−4
@@ -215,12 +215,11 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
215 QQuickView *quickView =
215 QQuickView *quickView =
216 qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
216 qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
217
217
218− QString qmlComponentFilePath;
218+ QUrl qmlComponentFilePath;
219 if (!m_qmlSurface->qmlFilePath().isEmpty()) {
219 if (!m_qmlSurface->qmlFilePath().isEmpty()) {
220− qmlComponentFilePath.append(m_qmlSurface->qmlFilePath());
220+ qmlComponentFilePath = m_qmlSurface->qmlFilePath();
221 } else {
221 } else {
222− qmlComponentFilePath = QString("%1/Unity/Application/MirSurfaceItem.qml")
222+ qmlComponentFilePath = QUrl("qrc:///Unity/Application/MirSurfaceItem.qml");
223− .arg(mockPluginsDir());
224 }
223 }
225
224
226 m_qmlContentComponent = new QQmlComponent(quickView->engine(), qmlComponentFilePath);
225 m_qmlContentComponent = new QQmlComponent(quickView->engine(), qmlComponentFilePath);
tests/mocks/Unity/Application/VirtualKeyboard.cpp+2−4
@@ -26,10 +26,8 @@ VirtualKeyboard::VirtualKeyboard()
26 : MirSurface("input-method",
26 : MirSurface("input-method",
27 Mir::InputMethodType,
27 Mir::InputMethodType,
28 Mir::MinimizedState,
28 Mir::MinimizedState,
29− QString("file://%1/Dash/graphics/phone/screenshots/vkb_portrait.png")
29+ QUrl("qrc:///Unity/Application/vkb_portrait.png"),
30− .arg(qmlDirectory()),
31− QString("%1/Unity/Application/VirtualKeyboard.qml")
30+ QUrl("qrc:///Unity/Application/VirtualKeyboard.qml"))
32− .arg(mockPluginsDir()))
33{
31{
34}
32}
35
33
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
29 m_appId(appId),
29 m_appId(appId),
30 m_desktopFile(desktopFile),
30 m_desktopFile(desktopFile),
31 m_name(name),
31 m_name(name),
32− m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(qmlDirectory() + "/graphics/applicationIcons/" + icon + ".png"),
33 m_pinned(false),
33 m_pinned(false),
34 m_running(false),
34 m_running(false),
35 m_recent(false),
35 m_recent(false),
tests/mocks/Unity/fake_resultsmodel.cpp+1−1
@@ -78,7 +78,7 @@ ResultsModel::data(const QModelIndex& index, int role) const
78 case RoleTitle:
78 case RoleTitle:
79 return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());
79 return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());
80 case RoleArt:
80 case RoleArt:
81− return qmlDirectory() + "graphics/applicationIcons/dash.png";
81+ return qmlDirectory() + "/graphics/applicationIcons/dash.png";
82 case RoleSubtitle:
82 case RoleSubtitle:
83 return QString("Subtitle.%1.%2").arg(m_categoryId).arg(index.row());
83 return QString("Subtitle.%1.%2").arg(m_categoryId).arg(index.row());
84 case RoleMascot:
84 case RoleMascot:
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -253,11 +253,11 @@ QVariantMap Scope::customizations() const
253 m["foreground-color"] = "blue";
253 m["foreground-color"] = "blue";
254 m["page-header"] = h;
254 m["page-header"] = h;
255 } else if (m_id == "MockScope4") {
255 } 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");
257 m["page-header"] = h;
257 m["page-header"] = h;
258 } else if (m_id == "MockScope5") {
258 } else if (m_id == "MockScope5") {
259 h["background"] = "gradient:///lightgrey/grey";
259 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");
261 h["divider-color"] = "red";
261 h["divider-color"] = "red";
262 h["navigation-background"] = "color:///black";
262 h["navigation-background"] = "color:///black";
263 m["page-header"] = h;
263 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
308 case RoleSubtitle:
308 case RoleSubtitle:
309 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();
309 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();
310 case RoleArt:
310 case RoleArt:
311− return qmlDirectory() + "graphics/applicationIcons/dash.png";
311+ return qmlDirectory() + "/graphics/applicationIcons/dash.png";
312 case RoleMascot:
312 case RoleMascot:
313 case RoleEmblem:
313 case RoleEmblem:
314 case RoleSummary:
314 case RoleSummary:
tests/plugins/Dash/CMakeLists.txt−1
@@ -23,7 +23,6 @@ include_directories(
23remove_definitions(-DQT_NO_KEYWORDS)
23remove_definitions(-DQT_NO_KEYWORDS)
24
24
25add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
25add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
26−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
27
26
28macro(add_lvwph_test FILENAME TESTNAME)
27macro(add_lvwph_test FILENAME TESTNAME)
29 add_executable(${TESTNAME}TestExec
28 add_executable(${TESTNAME}TestExec
tests/plugins/Dash/cardcreatortest.cpp−1
@@ -35,7 +35,6 @@ private Q_SLOTS:
35 void init()
35 void init()
36 {
36 {
37 view = new QQuickView();
37 view = new QQuickView();
38− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
39 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
38 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
40 view->show();
39 view->show();
41 QTest::qWaitForWindowExposed(view);
40 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/horizontaljournaltest.cpp−1
@@ -123,7 +123,6 @@ private Q_SLOTS:
123 {
123 {
124 view = new QQuickView();
124 view = new QQuickView();
125 view->setResizeMode(QQuickView::SizeRootObjectToView);
125 view->setResizeMode(QQuickView::SizeRootObjectToView);
126− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
127
126
128 model = new WidthModel();
127 model = new WidthModel();
129 QStringList widthList;
128 QStringList widthList;
tests/plugins/Dash/horizontaljournaltry.cpp−1
@@ -63,7 +63,6 @@ int main(int argc, char *argv[])
63
63
64 QQuickView *view = new QQuickView();
64 QQuickView *view = new QQuickView();
65 view->setResizeMode(QQuickView::SizeRootObjectToView);
65 view->setResizeMode(QQuickView::SizeRootObjectToView);
66− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
67
66
68 QWidthModela model;
67 QWidthModela model;
69 QStringList heightList;
68 QStringList heightList;
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp−1
@@ -168,7 +168,6 @@ private Q_SLOTS:
168 void init()
168 void init()
169 {
169 {
170 view = new QQuickView();
170 view = new QQuickView();
171− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
172 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
171 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
173 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
172 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
174 QVERIFY(lvwph);
173 QVERIFY(lvwph);
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp−1
@@ -133,7 +133,6 @@ private Q_SLOTS:
133 void init()
133 void init()
134 {
134 {
135 view = new QQuickView();
135 view = new QQuickView();
136− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
137 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
136 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
138 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
137 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
139 model = view->rootObject()->findChild<QQmlListModel*>();
138 model = view->rootObject()->findChild<QQmlListModel*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp−1
@@ -119,7 +119,6 @@ private Q_SLOTS:
119 void init()
119 void init()
120 {
120 {
121 view = new QQuickView();
121 view = new QQuickView();
122− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
123 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
122 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
124 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
123 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
125 model = view->rootObject()->findChild<QQmlListModel*>();
124 model = view->rootObject()->findChild<QQmlListModel*>();
tests/plugins/Dash/organicgridtest.cpp−1
@@ -126,7 +126,6 @@ private Q_SLOTS:
126 {
126 {
127 view = new QQuickView();
127 view = new QQuickView();
128 view->setResizeMode(QQuickView::SizeRootObjectToView);
128 view->setResizeMode(QQuickView::SizeRootObjectToView);
129− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
130
129
131 model = new DummyModel();
130 model = new DummyModel();
132 model->setCount(21);
131 model->setCount(21);
tests/plugins/Dash/organicgridtry.cpp−1
@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
73
73
74 QQuickView *view = new QQuickView();
74 QQuickView *view = new QQuickView();
75 view->setResizeMode(QQuickView::SizeRootObjectToView);
75 view->setResizeMode(QQuickView::SizeRootObjectToView);
76− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
77
76
78 DummyModel model;
77 DummyModel model;
79 model.setCount(3);
78 model.setCount(3);
tests/plugins/Dash/verticaljournaltest.cpp−1
@@ -125,7 +125,6 @@ private Q_SLOTS:
125 {
125 {
126 view = new QQuickView();
126 view = new QQuickView();
127 view->setResizeMode(QQuickView::SizeRootObjectToView);
127 view->setResizeMode(QQuickView::SizeRootObjectToView);
128− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
129
128
130 model = new HeightModel();
129 model = new HeightModel();
131 QStringList heightList;
130 QStringList heightList;
tests/plugins/Dash/verticaljournaltry.cpp−1
@@ -63,7 +63,6 @@ int main(int argc, char *argv[])
63
63
64 QQuickView *view = new QQuickView();
64 QQuickView *view = new QQuickView();
65 view->setResizeMode(QQuickView::SizeRootObjectToView);
65 view->setResizeMode(QQuickView::SizeRootObjectToView);
66− view->engine()->addImportPath(BUILT_PLUGINS_DIR);
67
66
68 QHeightModel model;
67 QHeightModel model;
69 QStringList heightList;
68 QStringList heightList;
tests/plugins/IntegratedLightDM/CMakeLists.txt+1−1
@@ -25,7 +25,7 @@ add_unity8_uitest(GreeterDBus dbus-test-runner
25 ARG_PREFIX "--parameter"
25 ARG_PREFIX "--parameter"
26 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
26 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
27 DEPENDS MockLightDM
27 DEPENDS MockLightDM
28− IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks
28+ IMPORT_PATHS ${UNITY_MOCKPATH}
29 LIGHTDM
29 LIGHTDM
30 )
30 )
31
31
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+3−7
@@ -14,9 +14,6 @@ include_directories(
14
14
15export_qmlfiles(UbuntuGesturesTest .)
15export_qmlfiles(UbuntuGesturesTest .)
16
16
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−
20macro(build_gesture_test CLASSNAME)
17macro(build_gesture_test CLASSNAME)
21 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
18 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
22 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
19 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
@@ -26,7 +23,7 @@ endmacro()
26macro(add_gesture_unit_test CLASSNAME)
23macro(add_gesture_unit_test CLASSNAME)
27 build_gesture_test(${CLASSNAME})
24 build_gesture_test(${CLASSNAME})
28 add_unity8_unittest(${CLASSNAME} ${CLASSNAME}TestExec
25 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
30 DEPENDS UbuntuGesturesTest-qmlfiles
27 DEPENDS UbuntuGesturesTest-qmlfiles
31 ${ARGN}
28 ${ARGN}
32 )
29 )
@@ -35,12 +32,11 @@ endmacro()
35macro(add_gesture_ui_test CLASSNAME)
32macro(add_gesture_ui_test CLASSNAME)
36 build_gesture_test(${CLASSNAME})
33 build_gesture_test(${CLASSNAME})
37 add_unity8_uitest(${CLASSNAME} ${CLASSNAME}TestExec
34 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
39 DEPENDS UbuntuGesturesTest-qmlfiles
36 DEPENDS UbuntuGesturesTest-qmlfiles
40 ${ARGN}
37 ${ARGN}
41 )
38 )
42− add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins
39+ add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${UNITY_PLUGINPATH})
43− ${CMAKE_BINARY_DIR}/tests/utils/modules)
44endmacro()
40endmacro()
45
41
46add_gesture_ui_test(DirectionalDragArea)
42add_gesture_ui_test(DirectionalDragArea)
tests/plugins/Ubuntu/Gestures/GestureTest.cpp−2
@@ -44,8 +44,6 @@ void GestureTest::init()
44{
44{
45 m_view = new QQuickView;
45 m_view = new QQuickView;
46 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
46 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));
49 m_view->setSource(QUrl::fromLocalFile(m_qmlFilename));
47 m_view->setSource(QUrl::fromLocalFile(m_qmlFilename));
50 m_view->show();
48 m_view->show();
51 QVERIFY(QTest::qWaitForWindowExposed(m_view));
49 QVERIFY(QTest::qWaitForWindowExposed(m_view));
tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp−1
@@ -119,7 +119,6 @@ QQuickView *tst_TouchGate::createView()
119 QQuickView *window = new QQuickView(0);
119 QQuickView *window = new QQuickView(0);
120 window->setResizeMode(QQuickView::SizeRootObjectToView);
120 window->setResizeMode(QQuickView::SizeRootObjectToView);
121 window->resize(720, 720);
121 window->resize(720, 720);
122− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
123
122
124 return window;
123 return window;
125}
124}
tests/qmltests/CMakeLists.txt+2−2
@@ -1,7 +1,7 @@
1
1
2add_subdirectory(Components)
2add_subdirectory(Components)
3
3
4−add_unity8_qmltest(. OrientedShell)
4+add_unity8_qmltest(. OrientedShell LIGHTDM)
5add_unity8_qmltest(. Shell LIGHTDM)
5add_unity8_qmltest(. Shell LIGHTDM)
6add_unity8_qmltest(. ShellWithPin LIGHTDM)
6add_unity8_qmltest(. ShellWithPin LIGHTDM)
7add_unity8_qmltest(Components Background)
7add_unity8_qmltest(Components Background)
@@ -18,7 +18,7 @@ add_unity8_qmltest(Components Showable)
18add_unity8_qmltest(Components ZoomableImage)
18add_unity8_qmltest(Components ZoomableImage)
19add_unity8_qmltest(Dash Dash)
19add_unity8_qmltest(Dash Dash)
20add_unity8_qmltest(Dash DashContent)
20add_unity8_qmltest(Dash DashContent)
21−add_unity8_qmltest(Dash DashShell)
21+add_unity8_qmltest(Dash DashShell LIGHTDM)
22add_unity8_qmltest(Dash Card)
22add_unity8_qmltest(Dash Card)
23add_unity8_qmltest(Dash CardCarousel)
23add_unity8_qmltest(Dash CardCarousel)
24add_unity8_qmlbenchmark(Dash CardBenchmark 1000)
24add_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")
2add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")
1add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")
3−add_definitions(-DTESTS_UTILS_MODULES_DIR="${CMAKE_BINARY_DIR}/tests/utils/modules")
4
2
5########## tst_DragHandle
3########## tst_DragHandle
6
4
@@ -17,8 +15,7 @@ qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
17target_link_libraries(DragHandleTestExec UbuntuGesturesQml UbuntuGestures)
15target_link_libraries(DragHandleTestExec UbuntuGesturesQml UbuntuGestures)
18
16
19add_unity8_uitest(DragHandle DragHandleTestExec ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
17add_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)
18+add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_PLUGINPATH})
21−
22
19
23########## tst_EdgeDragEvaluator
20########## tst_EdgeDragEvaluator
24add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
21add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
tests/qmltests/Components/tst_DragHandle.cpp−2
@@ -113,9 +113,7 @@ QQuickView *tst_DragHandle::createView()
113{
113{
114 QQuickView *window = new QQuickView(0);
114 QQuickView *window = new QQuickView(0);
115 window->setResizeMode(QQuickView::SizeRootObjectToView);
115 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
117 window->engine()->addImportPath(QLatin1String(TEST_DIR));
116 window->engine()->addImportPath(QLatin1String(TEST_DIR));
118− window->engine()->addImportPath(QStringLiteral(TESTS_UTILS_MODULES_DIR));
119
117
120 return window;
118 return window;
121}
119}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp−1
@@ -99,7 +99,6 @@ QQuickView *tst_EdgeDragEvaluator::createView()
99{
99{
100 QQuickView *window = new QQuickView(0);
100 QQuickView *window = new QQuickView(0);
101 window->setResizeMode(QQuickView::SizeRootObjectToView);
101 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
103 window->engine()->addImportPath(QLatin1String(TEST_DIR));
102 window->engine()->addImportPath(QLatin1String(TEST_DIR));
104
103
105 return window;
104 return window;
tools/scopetool.cpp+1−1
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
89 view->setTitle(QGuiApplication::applicationName());
89 view->setTitle(QGuiApplication::applicationName());
90 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
90 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
91
91
92− QUrl source(::qmlDirectory() + "ScopeTool.qml");
92+ QUrl source(::qmlDirectory() + "/ScopeTool.qml");
93 prependImportPaths(view->engine(), ::overrideImportPaths());
93 prependImportPaths(view->engine(), ::overrideImportPaths());
94 prependImportPaths(view->engine(), ::nonMirImportPaths());
94 prependImportPaths(view->engine(), ::nonMirImportPaths());
95 appendImportPaths(view->engine(), ::fallbackImportPaths());
95 appendImportPaths(view->engine(), ::fallbackImportPaths());