on xenial help sign in
Merge lp:~dandrader/unity8/real_header_splashscreen
commit04b04e72988383e975169493a98f92f677afabeb authorAlbert Astals <albert.astals@canonical.com> dateFri 26 Sep 2014, 10:17 (12 years ago) parent31f2d2412241c5
22 files changed+424−126
debian/control+3−3 plugins/Unity/Launcher/CMakeLists.txt+1−1 qml/Stages/ApplicationWindow.qml+16−1 qml/Stages/Dot.qml−25 qml/Stages/MainViewStyle.qml+79 qml/Stages/PageHeadStyle.qml+76 qml/Stages/PhoneStage.qml+2−2 qml/Stages/Splash.qml+107−13 qml/Stages/WaitingDots.qml−76 qml/Stages/graphics/PageHeaderBaseDividerBottom@18.png qml/Stages/graphics/PageHeaderBaseDividerLight@18.png qml/Stages/graphics/PageHeaderBaseDividerLight@18.sci+5 qml/Stages/graphics/background_paper@27.png tests/mocks/Unity/Application/ApplicationInfo.h+7 tests/mocks/Unity/Application/CMakeLists.txt+1−1 tests/plugins/Unity/Launcher/CMakeLists.txt+1−1 tests/plugins/Unity/Launcher/launchermodeltest.cpp+6−1 tests/qmltests/CMakeLists.txt+1 tests/qmltests/Components/tst_DragHandle/HorizontalShowable.qml+1−1 tests/qmltests/Components/tst_DragHandle/VerticalShowable.qml+1−1 tests/qmltests/Stages/tst_Splash.qml+117 tests/qmltests/Components/tst_DragHandle/UnityLogo.png → tests/qmltests/UnityLogo.png
debian/control+3−3
@@ -24,7 +24,7 @@ Build-Depends: cmake,
2424 libpulse-dev,
2525 libqmenumodel-dev (>= 0.2.8),
2626 libqt5xmlpatterns5-dev,
27− libunity-api-dev (>= 7.90),
27+ libunity-api-dev (>= 7.91),
2828 libusermetricsoutput1-dev,
2929 libxcb1-dev,
3030 pkg-config,
@@ -112,7 +112,7 @@ Depends: qml-module-qtquick-layouts,
112112 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
113113 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
114114 ubuntu-thumbnailer-impl-0,
115− unity-application-impl-3,
115+ unity-application-impl-4,
116116 unity-notifications-impl-3,
117117 unity-plugin-scopes | unity-scopes-impl,
118118 unity-scopes-impl-4,
@@ -159,7 +159,7 @@ Pre-Depends: ${misc:Pre-Depends},
159159Depends: ${misc:Depends},
160160 ${shlibs:Depends},
161161Provides: unity-application-impl,
162− unity-application-impl-3,
162+ unity-application-impl-4,
163163Description: Fake environment for running Unity 8 shell
164164 Provides fake implementations of some QML modules used by Unity 8 shell
165165 (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
11include(FindPkgConfig)
22pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=4)
3−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
3+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
44pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
55
66add_definitions(-DSM_BUSNAME=systemBus)
qml/Stages/ApplicationWindow.qml+16−1
@@ -37,6 +37,12 @@ Item {
3737 readonly property string name: root.application ? root.application.name : ""
3838 readonly property url icon: root.application ? root.application.icon : ""
3939 readonly property int applicationState: root.application ? root.application.state : -1
40+ readonly property string splashTitle: root.application ? root.application.splashTitle : ""
41+ readonly property url splashImage: root.application ? root.application.splashImage : ""
42+ readonly property bool splashShowHeader: root.application ? root.application.splashShowHeader : true
43+ readonly property color splashColor: root.application ? root.application.splashColor : "#00000000"
44+ readonly property color splashColorHeader: root.application ? root.application.splashColorHeader : "#00000000"
45+ readonly property color splashColorFooter: root.application ? root.application.splashColorFooter : "#00000000"
4046
4147 // Whether the Application had a surface before but lost it.
4248 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
@@ -104,7 +110,16 @@ Item {
104110 active: false
105111 anchors.fill: parent
106112 sourceComponent: Component {
107− Splash { name: d.name; image: d.icon }
113+ Splash {
114+ id: splash
115+ title: d.splashTitle ? d.splashTitle : d.name
116+ imageSource: d.splashImage
117+ icon: d.icon
118+ showHeader: d.splashShowHeader
119+ backgroundColor: d.splashColor
120+ headerColor: d.splashColorHeader
121+ footerColor: d.splashColorFooter
122+ }
108123 }
109124 }
110125
qml/Stages/Dot.qmldeleted−25
@@ -1,25 +0,0 @@
1−/*
2− * Copyright (C) 2014 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−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Rectangle {
21− radius: width
22− width: units.dp(6)
23− height: width
24− color: UbuntuColors.orange
25−}
qml/Stages/MainViewStyle.qmlnew file+79
@@ -0,0 +1,79 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+import QtQuick 2.0
17+import Ubuntu.Components 1.1
18+
19+// FIXME: copied with slight modifications from Ubuntu UI Toolkit's Ambiance's theme
20+Item {
21+ // styling properties
22+ anchors.fill: parent
23+ z: -1
24+ id: mainViewStyle
25+
26+ /*!
27+ The background texture of the main view. The image will be drawn over the background color,
28+ so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
29+ */
30+ property url backgroundSource: "graphics/background_paper.png"
31+ property var theme
32+
33+ Gradient {
34+ id: backgroundGradient
35+ GradientStop { position: 0.0; color: styledItem.headerColor }
36+ GradientStop { position: 0.83; color: styledItem.backgroundColor }
37+ GradientStop { position: 1.0; color: styledItem.footerColor }
38+ }
39+
40+ Rectangle {
41+ id: backgroundColor
42+ anchors.fill: parent
43+ color: styledItem.backgroundColor
44+ gradient: internals.isGradient ? backgroundGradient : null
45+ }
46+
47+ Image {
48+ id: backgroundTexture
49+ anchors.fill: parent
50+ source: mainViewStyle.theme.name === "Ambiance" ? mainViewStyle.backgroundSource : ""
51+ fillMode: Image.Tile
52+ asynchronous: true
53+ cache: false
54+ visible: status === Image.Ready
55+ }
56+
57+ QtObject {
58+ id: internals
59+ property bool isGradient: styledItem.backgroundColor != styledItem.headerColor ||
60+ styledItem.backgroundColor != styledItem.footerColor
61+ /*
62+ As we don't know the order the property bindings and onXXXChanged signals are evaluated
63+ we should rely only on one property when changing the theme to avoid intermediate
64+ theme changes due to properties being evaluated separately.
65+
66+ Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
67+ */
68+ property string theme: (ColorUtils.luminance(styledItem.backgroundColor) >= 0.85) ? "Ambiance" :
69+ (isGradient ? "SuruGradient" : "SuruDark")
70+ }
71+
72+ // automatically select the appropriate theme depending on the background colors
73+ Binding {
74+ target: theme
75+ property: "name"
76+ value: internals.theme
77+ when: internals.theme !== ""
78+ }
79+}
qml/Stages/PageHeadStyle.qmlnew file+76
@@ -0,0 +1,76 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+import QtQuick 2.2
17+import Ubuntu.Components 1.1
18+import Ubuntu.Components.Styles 1.1 as Style
19+
20+// FIXME: copied with large modifications from Ubuntu UI Toolkit's Ambiance's theme
21+Style.PageHeadStyle {
22+ id: headerStyle
23+
24+ contentHeight: units.gu(7)
25+ separatorSource: "graphics/PageHeaderBaseDividerLight.sci"
26+ separatorBottomSource: "graphics/PageHeaderBaseDividerBottom.png"
27+ fontWeight: Font.Light
28+ fontSize: "x-large"
29+ textColor: styledItem.config.foregroundColor
30+ textLeftMargin: units.gu(2)
31+
32+ implicitHeight: headerStyle.contentHeight
33+
34+ property var theme
35+
36+ Label {
37+ anchors {
38+ left: parent.left
39+ leftMargin: headerStyle.textLeftMargin
40+ right: parent.right
41+ verticalCenter: parent.verticalCenter
42+ }
43+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
44+ text: styledItem.title
45+ font.weight: headerStyle.fontWeight
46+ fontSize: headerStyle.fontSize
47+ color: headerStyle.textColor
48+ elide: Text.ElideRight
49+ }
50+
51+ BorderImage {
52+ id: separator
53+ anchors {
54+ top: parent.bottom
55+ topMargin: separatorBottom.height
56+ left: parent.left
57+ right: parent.right
58+ }
59+ source: headerStyle.separatorSource
60+ height: styledItem.config.sections.model !== undefined ? units.gu(3) : units.gu(2)
61+ asynchronous: true
62+ cache: true
63+ }
64+
65+ Image {
66+ id: separatorBottom
67+ anchors {
68+ top: separator.bottom
69+ left: parent.left
70+ right: parent.right
71+ }
72+ source: headerStyle.separatorBottomSource
73+ asynchronous: true
74+ cache: true
75+ }
76+}
qml/Stages/PhoneStage.qml+2−2
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.2
1818import Ubuntu.Components 0.1
1919import Ubuntu.Gestures 0.1
2020import Unity.Application 0.1
@@ -320,7 +320,7 @@ Rectangle {
320320 !snapAnimation.running &&
321321 priv.animateX
322322 UbuntuNumberAnimation {
323− duration: UbuntuAnimation.FastDuration
323+ duration: UbuntuAnimation.BriskDuration
324324 onRunningChanged: {
325325 if (!running && root.inverseProgress == 0) {
326326 spreadView.focusChanging = false;
qml/Stages/Splash.qml+107−13
@@ -14,16 +14,101 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515*/
1616
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
19+import Ubuntu.Components.Themes 0.1
1920import "../Components"
2021
21−Rectangle {
22+import Ubuntu.Components.Themes.Ambiance 1.1 as Ambiance
23+
24+Item {
2225 id: root
23− color: "black"
2426
25− property string name: ""
26− property url image: ""
27+ property color backgroundColor: d.undefinedColor
28+ property color headerColor: d.undefinedColor
29+ property color footerColor: d.undefinedColor
30+ property alias imageSource: overlaidImage.source
31+ property url icon
32+ property alias title: header.title
33+ property alias showHeader: header.visible
34+
35+ Ambiance.Palette {
36+ id: ambiancePalette
37+ }
38+
39+ QtObject {
40+ id: d
41+
42+ // As specified in qtmir, it will set the color value to this for fields left undefined
43+ // This is also the default value of a color property in QML.
44+ readonly property color undefinedColor: "#00000000"
45+
46+ readonly property color defaultBackgroundColor: header.visible ? ambiancePalette.normal.background : "black"
47+
48+ // Splash screen that shows the application icon and splashTitle
49+ readonly property bool showIcon: overlaidImage.status == Image.Null && !root.showHeader
50+ }
51+
52+ StyledItem {
53+ id: styledItem
54+ anchors.fill: parent
55+
56+ // mimic API of toolkit's MainView component required by MainViewStyle
57+ property color backgroundColor: Qt.colorEqual(root.backgroundColor, d.undefinedColor) ? d.defaultBackgroundColor
58+ : root.backgroundColor
59+ property color headerColor: Qt.colorEqual(root.headerColor, d.undefinedColor) ? styledItem.backgroundColor
60+ : root.headerColor
61+ property color footerColor: Qt.colorEqual(root.footerColor, d.undefinedColor) ? styledItem.backgroundColor
62+ : root.footerColor
63+
64+ // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
65+ property var theme: QtObject {
66+ property string name
67+ property Palette palette: Qt.createQmlObject("import QtQuick 2.2;\
68+ import Ubuntu.Components.Themes.%1 1.1;\
69+ Palette {}".arg(styledItem.theme.name),
70+ styledItem, "dynamicPalette");
71+ }
72+
73+ // FIXME: should instead use future toolkit API:
74+ // style: theme.createStyleComponent("MainViewStyle.qml", styledItem)
75+ style: Component { MainViewStyle {theme: styledItem.theme} }
76+ }
77+
78+ StyledItem {
79+ id: header
80+ anchors {
81+ left: parent.left
82+ right: parent.right
83+ }
84+ visible: false
85+
86+ // mimic API of toolkit's AppHeader component required by PageHeadStyle
87+ property Item pageStack
88+ property Item contents
89+ property string title
90+ property var tabsModel
91+ property var config: QtObject {
92+ property color foregroundColor: styledItem.theme.palette.selected.backgroundText
93+ property var sections: QtObject {}
94+ }
95+
96+ // FIXME: should instead use future toolkit API:
97+ // style: theme.createStyleComponent("PageHeadStyle.qml", header)
98+ style: Component { PageHeadStyle {theme: styledItem.theme} }
99+ }
100+
101+ Image {
102+ id: overlaidImage
103+ anchors.centerIn: parent
104+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
105+ sourceSize {
106+ width: root.width
107+ height: root.height
108+ }
109+ asynchronous: true
110+ cache: false
111+ }
27112
28113 UbuntuShape {
29114 id: iconShape
@@ -33,6 +118,8 @@ Rectangle {
33118 width: units.gu(8)
34119 height: units.gu(7.5)
35120
121+ visible: d.showIcon
122+
36123 radius: "medium"
37124 borderSource: "none"
38125
@@ -40,24 +127,31 @@ Rectangle {
40127 id: iconImage
41128 sourceSize.width: iconShape.width
42129 sourceSize.height: iconShape.height
43− source: root.image
130+ source: d.showIcon ? root.icon : ""
44131 fillMode: Image.PreserveAspectCrop
45132 }
46133 }
47134
48135 Label {
49− text: root.name
136+ text: root.title
50137 anchors.horizontalCenter: parent.horizontalCenter
51138 anchors.top: iconShape.bottom
52139 anchors.topMargin: units.gu(2)
53140 fontSize: "large"
141+
142+ color: styledItem.theme.palette.selected.backgroundText
143+ visible: d.showIcon
54144 }
55145
56− WaitingDots {
57− visible: parent.visible
58− anchors.horizontalCenter: parent.horizontalCenter
59− anchors.bottom: parent.bottom
60− anchors.bottomMargin: units.gu(12)
146+ ActivityIndicator {
147+ anchors.centerIn: header.visible ? parent : undefined
148+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
149+
150+ anchors.horizontalCenter: header.visible ? undefined : parent.horizontalCenter
151+ anchors.bottom: header.visible ? undefined : parent.bottom
152+ anchors.bottomMargin: header.visible ? 0 : units.gu(12)
153+
154+ running: true
61155 }
62156
63157 MouseArea {
qml/Stages/WaitingDots.qmldeleted−76
@@ -1,76 +0,0 @@
1−/*
2− * Copyright (C) 2014 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−import QtQuick 2.2
18−import Ubuntu.Components 0.1
19−
20−Item {
21− id: waitingDots
22−
23− // center in parent; waitingDots has no size therefore anchors.centerIn cannot be used
24− x: parent.width / 2
25− y: parent.height / 2
26−
27− property var dots: [dot1, dot2, dot3]
28− property var vertices: [[-units.gu(1), -units.gu(1)],
29− [units.gu(1), -units.gu(1)],
30− [0, units.gu(1)]]
31− property int shift: 0
32−
33− function cycle () {
34− var n = vertices.length;
35− shift = (shift + 1) % n;
36−
37− for (var i = 0; i < n; i++) {
38− dots[i].x = vertices[(i+shift) % n][0];
39− dots[i].y = vertices[(i+shift) % n][1];
40− }
41− }
42−
43− Timer {
44− interval: 800
45− running: waitingDots.visible
46− repeat: true
47− triggeredOnStart: true
48− onTriggered: waitingDots.cycle()
49− }
50−
51−
52− Dot {
53− id: dot1
54− x: vertices[0][0]
55− y: vertices[0][1]
56− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
57− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
58− }
59−
60− Dot {
61− id: dot2
62− x: vertices[1][0]
63− y: vertices[1][1]
64− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
65− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
66−
67− }
68−
69− Dot {
70− id: dot3
71− x: vertices[2][0]
72− y: vertices[2][1]
73− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
74− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
75− }
76−}
qml/Stages/graphics/PageHeaderBaseDividerBottom@18.pngnew file

Binary file not shown.

qml/Stages/graphics/PageHeaderBaseDividerLight@18.pngnew file

Binary file not shown.

qml/Stages/graphics/PageHeaderBaseDividerLight@18.scinew file+5
@@ -0,0 +1,5 @@
1+border.top: 4
2+border.bottom: 0
3+border.left: 0
4+border.right: 0
5+source: PageHeaderBaseDividerLight@18.png
qml/Stages/graphics/background_paper@27.pngnew file

Binary file not shown.

tests/mocks/Unity/Application/ApplicationInfo.h+7
@@ -68,6 +68,13 @@ public:
6868 void setFocused(bool value);
6969 bool focused() const override { return m_focused; }
7070
71+ QString splashTitle() const override { return QString(); }
72+ QUrl splashImage() const override { return QUrl(); }
73+ bool splashShowHeader() const override { return false; }
74+ QColor splashColor() const override { return QColor(0,0,0,0); }
75+ QColor splashColorHeader() const override { return QColor(0,0,0,0); }
76+ QColor splashColorFooter() const override { return QColor(0,0,0,0); }
77+
7178 QString screenshot() const { return m_screenshotFileName; }
7279
7380 void setFullscreen(bool value);
tests/mocks/Unity/Application/CMakeLists.txt+1−1
@@ -1,4 +1,4 @@
1−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
1+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
22
33set(FakeUnityApplicationQml_SOURCES
44 plugin.cpp
tests/plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
11pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
22pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=4)
3−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
3+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
44
55include_directories(
66 ${CMAKE_CURRENT_BINARY_DIR}
tests/plugins/Unity/Launcher/launchermodeltest.cpp+6−1
@@ -43,7 +43,12 @@ public:
4343 ApplicationInfoInterface::Stage stage() const { return ApplicationInfoInterface::MainStage; }
4444 ApplicationInfoInterface::State state() const { return ApplicationInfoInterface::Running; }
4545 bool focused() const { return m_focused; }
46− QUrl screenshot() const { return QUrl(); }
46+ QString splashTitle() const override { return QString(); }
47+ QUrl splashImage() const override { return QUrl(); }
48+ bool splashShowHeader() const override { return true; }
49+ QColor splashColor() const override { return QColor(0,0,0,0); }
50+ QColor splashColorHeader() const override { return QColor(0,0,0,0); }
51+ QColor splashColorFooter() const override { return QColor(0,0,0,0); }
4752
4853 // Methods used for mocking (not in the interface)
4954 void setFocused(bool focused) { m_focused = focused; Q_EMIT focusedChanged(focused); }
tests/qmltests/CMakeLists.txt+1
@@ -87,3 +87,4 @@ add_qml_test(Stages PhoneStage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/
8787add_qml_test(Stages SpreadDelegate ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
8888add_qml_test(Stages SurfaceContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
8989add_qml_test(Stages SessionContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
90+add_qml_test(Stages Splash)
tests/qmltests/Components/tst_DragHandle/HorizontalShowable.qml+1−1
@@ -49,7 +49,7 @@ Showable {
4949 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
5050 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
5151
52− Image { source: "UnityLogo.png"; anchors.fill: parent }
52+ Image { source: "../../UnityLogo.png"; anchors.fill: parent }
5353
5454 DragHandle {
5555 objectName: "leftwardsDragHandle"
tests/qmltests/Components/tst_DragHandle/VerticalShowable.qml+1−1
@@ -49,7 +49,7 @@ Showable {
4949 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
5050 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
5151
52− Image { source: "UnityLogo.png"; anchors.fill: parent }
52+ Image { source: "../../UnityLogo.png"; anchors.fill: parent }
5353
5454 DragHandle {
5555 objectName: "upwardsDragHandle"
tests/qmltests/Stages/tst_Splash.qmlnew file+117
@@ -0,0 +1,117 @@
1+/*
2+ * Copyright 2014 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+import QtQuick 2.0
18+import QtTest 1.0
19+import Unity.Test 0.1 as UT
20+import ".."
21+import "../../../qml/Stages"
22+import Ubuntu.Components 0.1
23+import Unity.Application 0.1
24+
25+Rectangle {
26+ color: "black"
27+ id: root
28+ width: units.gu(70)
29+ height: units.gu(70)
30+
31+ Component.onCompleted: {
32+ root.fakeApplication = ApplicationManager.add("gallery-app");
33+ root.fakeApplication.manualSurfaceCreation = true;
34+ root.fakeApplication.setState(ApplicationInfoInterface.Starting);
35+ }
36+ property QtObject fakeApplication
37+
38+ Component {
39+ id: splashComponent
40+ Splash {
41+ anchors.fill: parent
42+ title: "Splash Title"
43+ showHeader: showHeaderCheckbox.checked
44+ icon: fakeApplication ? fakeApplication.icon : ""
45+ imageSource: imageSourceCheckbox.checked ? "../UnityLogo.png" : ""
46+ backgroundColor: backgroundColorCheckbox.checked ? "darkorange" : "#00000000"
47+ headerColor: headerColorCheckbox.checked ? "mediumseagreen" : "#00000000"
48+ footerColor: footerColorCheckbox.checked ? "teal" : "#00000000"
49+ }
50+ }
51+ Loader {
52+ id: splashLoader
53+ anchors {
54+ top: parent.top
55+ bottom: parent.bottom
56+ left: parent.left
57+ }
58+ width: units.gu(40)
59+ sourceComponent: splashComponent
60+ }
61+
62+ Rectangle {
63+ color: "white"
64+ anchors {
65+ top: parent.top
66+ bottom: parent.bottom
67+ left: splashLoader.right
68+ right: parent.right
69+ }
70+
71+ Column {
72+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
73+ spacing: units.gu(1)
74+
75+ Row {
76+ anchors { left: parent.left; right: parent.right }
77+ CheckBox {id: showHeaderCheckbox; checked: false; }
78+ Label { text: "showHeader"; anchors.verticalCenter: parent.verticalCenter }
79+ }
80+ Row {
81+ anchors { left: parent.left; right: parent.right }
82+ CheckBox {id: imageSourceCheckbox; checked: false; }
83+ Label { text: "imageSource"; anchors.verticalCenter: parent.verticalCenter }
84+ }
85+ Row {
86+ anchors { left: parent.left; right: parent.right }
87+ CheckBox {id: backgroundColorCheckbox; checked: false; }
88+ Label { text: "custom backgroundColor"; anchors.verticalCenter: parent.verticalCenter }
89+ }
90+ Row {
91+ anchors { left: parent.left; right: parent.right }
92+ CheckBox {id: headerColorCheckbox; checked: false; }
93+ Label { text: "custom headerColor"; anchors.verticalCenter: parent.verticalCenter }
94+ }
95+ Row {
96+ anchors { left: parent.left; right: parent.right }
97+ CheckBox {id: footerColorCheckbox; checked: false; }
98+ Label { text: "custom footerColor"; anchors.verticalCenter: parent.verticalCenter }
99+ }
100+ }
101+ }
102+
103+ UT.UnityTestCase {
104+ id: testCase
105+ name: "Splash"
106+ when: windowShown
107+
108+ function cleanup() {
109+ // reload our test subject to get it in a fresh state once again
110+ splashLoader.active = false;
111+ surfaceCheckbox.checked = false;
112+ splashLoader.active = true;
113+ }
114+
115+ // No automated tests so far. Used only for manual testing at the moment.
116+ }
117+}
tests/qmltests/Components/tst_DragHandle/UnityLogo.png → tests/qmltests/UnityLogo.pngrenamed

Binary file not shown.