on xenial help sign in
Merge lp:~aacid/unity8/lvwph_maximizeVisibleArea
commit4c48c20dc7b9d0022e53195bae25e08d677d9ead authorAlbert Astals <albert.astals@canonical.com> dateThu 8 Aug 2013, 10:03 (13 years ago) parent773559a0690015
23 files changed+316−368
CODING+2−11 Components/CrossFadeImage.qml+1−3 Greeter/GreeterContent.qml+1 Shell.qml+8−16 build−1 debian/changelog+27 debian/control+1−3 plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+34−5 plugins/ListViewWithPageHeader/listviewwithpageheader.h+4−2 run_on_device+2−2 tests/data/unity/backgrounds/blue.png tests/data/unity/backgrounds/red.png tests/mocks/CMakeLists.txt−1 tests/mocks/GSettings/CMakeLists.txt−31 tests/mocks/GSettings/fake_gsettings.cpp−102 tests/mocks/GSettings/fake_gsettings.h−90 tests/mocks/GSettings/plugin.cpp−33 tests/mocks/GSettings/plugin.h−31 tests/mocks/GSettings/qmldir−2 tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+68−10 tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+167−10 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/tst_Shell.qml−14
CODING+2−11
@@ -23,16 +23,10 @@ $ cd ~/unity8/trunk
2323$ ./build --setup
2424
2525 this will:
26− - add ppa:ubuntu-unity/next
2726 - install the required dependencies to build, as well as run on the desktop
2827 - it should also install unity-scope-home and unity-lens-application which
2928 are technically "recommends", not strict dependencies
3029
31−Note, once the PPA is added, the script runs apt-get update, if you have
32−any failures associated with it, the build script will bail out of the setup
33−and fail to install all the required dependencies.
34−
35−
3630build Unity 8
3731-------------
3832
@@ -75,14 +69,11 @@ Notes
7569Running Unity 8 on devices
7670==========================
7771- Ubuntu Touch builds are currently only available in 13.10 flavour
78−- supported hardware should match one those listed here
72+- supported hardware should match one of those listed here
7973 https://wiki.ubuntu.com/Touch/Devices#Running_fine
8074- follow the Ubuntu Touch install instructions for your chosen device
8175 https://wiki.ubuntu.com/Touch/Install
82−- make sure your device is connected to a WiFi network
83−- If you haven’t already or if you’ve just freshly flashed your device
84− make sure you run phablet-network-setup which will allow package updates to
85− the device
76+- make sure your device is connected to a network
8677- also make sure you have your SSH key in ~/.ssh/id_rsa.pub (or install one
8778 on the device yourself)
8879
Components/CrossFadeImage.qml+1−3
@@ -85,7 +85,7 @@ Item {
8585 Connections {
8686 target: __nextImage
8787 onStatusChanged: {
88− if (__nextImage.status == Image.Ready || __nextImage.status == Image.Error) {
88+ if (__nextImage.status == Image.Ready) {
8989 swapImages();
9090 }
9191 }
@@ -96,7 +96,6 @@ Item {
9696 anchors.fill: parent
9797 cache: false
9898 asynchronous: true
99− fillMode: Image.PreserveAspectCrop
10099 z: 1
101100 }
102101
@@ -105,7 +104,6 @@ Item {
105104 anchors.fill: parent
106105 cache: false
107106 asynchronous: true
108− fillMode: Image.PreserveAspectCrop
109107 z: 0
110108 }
111109
Greeter/GreeterContent.qml+1
@@ -37,6 +37,7 @@ MouseArea {
3737
3838 source: shell.background
3939 anchors.fill: parent
40+ crossFade: false
4041 fadeInFirst: false
4142 }
4243
Shell.qml+8−16
@@ -15,7 +15,6 @@
1515 */
1616
1717import QtQuick 2.0
18−import GSettings 1.0
1918import Ubuntu.Application 0.1
2019import Ubuntu.Components 0.1
2120import Ubuntu.Gestures 0.1
@@ -42,8 +41,8 @@ FocusScope {
4241 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
4342
4443 property real edgeSize: units.gu(2)
45− property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
46− property url background: backgroundSettings.pictureUri
44+ property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45+ property url background: default_background
4746 readonly property real panelHeight: panel.panelHeight
4847
4948 property bool dashShown: dash.shown
@@ -116,11 +115,6 @@ FocusScope {
116115 }
117116 }
118117
119− GSettings {
120− id: backgroundSettings
121− schema.id: "org.gnome.desktop.background"
122− }
123−
124118 VolumeControl {
125119 id: volumeControl
126120 }
@@ -145,16 +139,12 @@ FocusScope {
145139 // through the translucent parts of the shell surface.
146140 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
147141
148− CrossFadeImage {
142+ Image {
149143 id: backgroundImage
150− objectName: "backgroundImage"
151144 source: shell.background
145+ sourceSize.width: parent.width
146+ sourceSize.height: parent.height
152147 anchors.fill: parent
153− onStatusChanged: {
154− if (status == Image.Error) {
155− backgroundSettings.pictureUri = shell.defaultBackground
156− }
157− }
158148 }
159149
160150 Rectangle {
@@ -199,6 +189,7 @@ FocusScope {
199189 }
200190 }
201191
192+
202193 Item {
203194 id: stagesOuterContainer
204195
@@ -263,6 +254,7 @@ FocusScope {
263254 ignoreUnknownSignals: true
264255 }
265256
257+
266258 Stage {
267259 id: mainStage
268260
@@ -438,7 +430,7 @@ FocusScope {
438430 onUnlocked: greeter.hide()
439431 onSelected: {
440432 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
441− shell.background = bgPath ? bgPath : defaultBackground
433+ shell.background = bgPath ? bgPath : default_background
442434 }
443435
444436 onLeftTeaserPressedChanged: {
build−1
@@ -36,7 +36,6 @@ BUILD_TYPE="debug"
3636[ $# -eq 1 ] && BUILD_TYPE="$1"
3737
3838install_dependencies() {
39− [ -f /etc/apt/sources.list.d/ubuntu-unity-next-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-unity/next || exit 1
4039 sudo apt-get update || exit 4
4140 echo "Installing Unity 8 dependencies.."
4241 sudo apt-get install devscripts \
debian/changelog+27
@@ -1,3 +1,30 @@
1+unity8 (7.81.3+13.10.20130807-0ubuntu1) saucy; urgency=low
2+
3+ [ Michał Sawicz ]
4+ * Drop ppa:ubuntu-unity/next.
5+ * Revert revision 161 that causes issues with invalid background.
6+
7+ [ Albert Astals ]
8+ * Fix off by one in the culling condition If you are on 0 and your
9+ height is 1 and viewport starts at 1 you have to be culled since you
10+ are not visible.
11+
12+ [ Ubuntu daily release ]
13+ * Automatic snapshot from revision 168
14+
15+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 07 Aug 2013 02:32:00 +0000
16+
17+unity8 (7.81.3+13.10.20130806-0ubuntu1) saucy; urgency=low
18+
19+ [ Michael Terry ]
20+ * Show the greeter when powerd tells us to, not just whenever we press
21+ the power key. (LP: #1186256)
22+
23+ [ Ubuntu daily release ]
24+ * Automatic snapshot from revision 164
25+
26+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 06 Aug 2013 03:43:01 +0000
27+
128unity8 (7.81.3+13.10.20130805-0ubuntu1) saucy; urgency=low
229
330 [ Michael Terry ]
debian/control+1−3
@@ -56,10 +56,8 @@ Description: Indicators client test application
5656
5757Package: unity8
5858Architecture: any
59−Depends: gsettings-desktop-schemas,
60− qmenumodel-qml,
59+Depends: qmenumodel-qml,
6160 qtdeclarative5-dee-plugin,
62− qtdeclarative5-gsettings1.0,
6361 qtdeclarative5-ubuntu-ui-toolkit-plugin,
6462 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
6563 qtdeclarative5-xmllistmodel-plugin,
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+34−5
@@ -389,7 +389,7 @@ QQuickItem *ListViewWithPageHeader::item(int modelIndex) const
389389 return nullptr;
390390}
391391
392−void ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
392+bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
393393{
394394 ListItem *listItem = itemAtIndex(modelIndex);
395395 if (listItem)
@@ -402,14 +402,28 @@ void ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
402402 m_contentYAnimation->setTo(to);
403403 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
404404 m_contentYAnimation->start();
405− } else if (listItemY < contentY() && listItemY + listItem->height() < contentY() + height()) {
405+ } else if ((listItemY < contentY() && listItemY + listItem->height() < contentY() + height()) ||
406+ (m_topSectionItem && !listItem->m_sectionItem && listItemY - m_topSectionItem->height() < contentY() && listItemY + listItem->height() < contentY() + height()))
407+ {
406408 // we can scroll the list down to show more stuff
407− const auto to = qMax(listItemY, listItemY + listItem->height() - height());
409+ auto realVisibleListItemY = listItemY;
410+ if (m_topSectionItem) {
411+ // If we are showing the top section sticky item and this item doesn't have a section
412+ // item we have to make sure to scroll it a bit more so that it is not underlapping
413+ // the top section sticky item
414+ bool topSectionShown = !QQuickItemPrivate::get(m_topSectionItem)->culled;
415+ if (topSectionShown && !listItem->m_sectionItem) {
416+ realVisibleListItemY -= m_topSectionItem->height();
417+ }
418+ }
419+ const auto to = qMax(realVisibleListItemY, listItemY + listItem->height() - height());
408420 m_contentYAnimation->setTo(to);
409421 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
410422 m_contentYAnimation->start();
411423 }
424+ return true;
412425 }
426+ return false;
413427}
414428
415429qreal ListViewWithPageHeader::minYExtent() const
@@ -454,7 +468,10 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
454468 m_headerItemShownHeight = 0;
455469 m_headerItem->setY(contentY());
456470 } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0)) {
457− m_headerItemShownHeight += diff;
471+ if (maximizeVisibleAreaRunning && diff > 0) // If we are maximizing and the header was shown, make sure we hide it
472+ m_headerItemShownHeight -= diff;
473+ else
474+ m_headerItemShownHeight += diff;
458475 if (contentY() == -m_minYExtent) {
459476 m_headerItemShownHeight = 0;
460477 } else {
@@ -1091,7 +1108,19 @@ void ListViewWithPageHeader::layout()
10911108 // Then after the loop we'll make sure that if there's another section just below it
10921109 // pushed the sticky section up to make it disappear
10931110 const qreal topSectionStickPos = m_headerItemShownHeight + contentY() - m_clipItem->y();
1094− if (topSectionStickPos <= pos) {
1111+ bool showStickySectionItem;
1112+ // We need to show the "top section sticky item" when the position at the "top" of the
1113+ // viewport is bigger than the start of the position of the first visible item
1114+ // i.e. the first visible item starts before the viewport, or when the first
1115+ // visible item starts just at the viewport start and it does not have its own section item
1116+ if (topSectionStickPos > pos) {
1117+ showStickySectionItem = true;
1118+ } else if (topSectionStickPos == pos) {
1119+ showStickySectionItem = !item->m_sectionItem;
1120+ } else {
1121+ showStickySectionItem = false;
1122+ }
1123+ if (!showStickySectionItem) {
10951124 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
10961125 if (item->m_sectionItem) {
10971126 // This seems it should happen since why would we cull the top section
plugins/ListViewWithPageHeader/listviewwithpageheader.h+4−2
@@ -90,8 +90,10 @@ public:
9090 Q_INVOKABLE void showHeader();
9191 Q_INVOKABLE QQuickItem *item(int modelIndex) const;
9292
93− // The index has to be visible for this to try to do something
94− Q_INVOKABLE void maximizeVisibleArea(int modelIndex);
93+ // The index has to be created for this to try to do something
94+ // Created items are those visible and the precached ones
95+ // Returns if the item existed or not
96+ Q_INVOKABLE bool maximizeVisibleArea(int modelIndex);
9597
9698Q_SIGNALS:
9799 void modelChanged();
run_on_device+2−2
@@ -27,8 +27,8 @@ usage() {
2727 echo " -k, --keylock Enable a Keyboard lock screen when running"
2828 echo ""
2929 echo "IMPORTANT:"
30− echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)."
31− echo " * Execute that script from a directory containing a branch the shell code."
30+ echo " * Make sure to have networking setup on the device beforehand."
31+ echo " * Execute that script from a directory containing unity8 code."
3232 exit 1
3333}
3434
tests/data/unity/backgrounds/blue.pngdeleted

Binary file not shown.

tests/data/unity/backgrounds/red.pngdeleted

Binary file not shown.

tests/mocks/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−add_subdirectory(GSettings)
21add_subdirectory(libusermetrics)
32add_subdirectory(LightDM)
43add_subdirectory(QMenuModel)
tests/mocks/GSettings/CMakeLists.txtdeleted−31
@@ -1,31 +0,0 @@
1−set(CMAKE_AUTOMOC ON)
2−
3−include(FindPkgConfig)
4−find_package(Qt5Core REQUIRED)
5−find_package(Qt5Quick REQUIRED)
6−
7−include_directories(
8− ${CMAKE_CURRENT_BINARY_DIR}
9− ${Qt5Core_INCLUDE_DIRS}
10− ${Qt5Quick_INCLUDE_DIRS}
11−)
12−
13−add_definitions(-DQT_NO_KEYWORDS)
14−
15−set(GSettingsQML_SOURCES
16− fake_gsettings.cpp
17− plugin.cpp
18−)
19−
20−add_library(FakeGSettingsQml MODULE ${GSettingsQML_SOURCES})
21−target_link_libraries(FakeGSettingsQml
22− ${Qt5Core_LIBRARIES}
23− ${Qt5Quick_LIBRARIES}
24−)
25−
26−qt5_use_modules(FakeGSettingsQml Qml)
27−
28−# copy qmldir file into build directory for shadow builds
29−file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
30− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
31− )
tests/mocks/GSettings/fake_gsettings.cppdeleted−102
@@ -1,102 +0,0 @@
1−/*
2− * Copyright 2013 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−
17−#include "fake_gsettings.h"
18−
19−#include <QList>
20−
21−GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
22−
23−GSettingsControllerQml::GSettingsControllerQml() {
24−}
25−
26−GSettingsControllerQml::~GSettingsControllerQml() {
27− s_controllerInstance = 0;
28−}
29−
30−GSettingsControllerQml* GSettingsControllerQml::instance() {
31− if(!s_controllerInstance) {
32− s_controllerInstance = new GSettingsControllerQml();
33− }
34− return s_controllerInstance;
35−}
36−
37−void GSettingsControllerQml::registerSettingsObject(GSettingsQml *obj) {
38− m_registeredGSettings.append(obj);
39−}
40−
41−void GSettingsControllerQml::unRegisterSettingsObject(GSettingsQml *obj) {
42− m_registeredGSettings.removeOne(obj);
43−}
44−
45−void GSettingsControllerQml::setPictureUri(const QString &str) {
46− Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
47− obj->setPictureUri(str);
48− }
49−}
50−
51−GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
52−}
53−
54−QByteArray GSettingsSchemaQml::id() const {
55− return m_id;
56−}
57−
58−void GSettingsSchemaQml::setId(const QByteArray &id) {
59− if (m_id.isEmpty()) {
60− qWarning("GSettings.schema.id may only be set on construction");
61− return;
62− }
63−
64− m_id = id;
65−}
66−
67−QByteArray GSettingsSchemaQml::path() const {
68− return m_path;
69−}
70−
71−void GSettingsSchemaQml::setPath(const QByteArray &path) {
72− if (m_path.isEmpty()) {
73− qWarning("GSettings.schema.path may only be set on construction");
74− return;
75− }
76−
77− m_path = path;
78−}
79−
80−GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
81− m_schema = new GSettingsSchemaQml(this);
82− GSettingsControllerQml::instance()->registerSettingsObject(this);
83−}
84−
85−GSettingsQml::~GSettingsQml() {
86− GSettingsControllerQml::instance()->unRegisterSettingsObject(this);
87−}
88−
89−GSettingsSchemaQml * GSettingsQml::schema() const {
90− return m_schema;
91−}
92−
93−QString GSettingsQml::pictureUri() const {
94− return m_pictureUri;
95−}
96−
97−void GSettingsQml::setPictureUri(const QString &str) {
98− if (str != m_pictureUri) {
99− m_pictureUri = str;
100− Q_EMIT pictureUriChanged(m_pictureUri);
101− }
102−}
tests/mocks/GSettings/fake_gsettings.hdeleted−90
@@ -1,90 +0,0 @@
1−/*
2− * Copyright 2013 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−
17−#ifndef FAKE_GSETTINGS_H
18−#define FAKE_GSETTINGS_H
19−
20−#include <QList>
21−#include <QtQml>
22−
23−class GSettingsSchemaQml: public QObject
24−{
25− Q_OBJECT
26−
27− Q_PROPERTY(QByteArray id READ id WRITE setId)
28−
29−public:
30− GSettingsSchemaQml(QObject *parent = NULL);
31−
32− QByteArray id() const;
33− void setId(const QByteArray &id);
34−
35− QByteArray path() const;
36− void setPath(const QByteArray &path);
37−
38−private:
39− QByteArray m_id;
40− QByteArray m_path;
41−};
42−
43−class GSettingsQml: public QObject
44−{
45− Q_OBJECT
46−
47− Q_PROPERTY(GSettingsSchemaQml* schema READ schema NOTIFY schemaChanged)
48− Q_PROPERTY(QString pictureUri READ pictureUri WRITE setPictureUri NOTIFY pictureUriChanged)
49−
50−public:
51− GSettingsQml(QObject *parent = NULL);
52− ~GSettingsQml();
53−
54− GSettingsSchemaQml * schema() const;
55− QString pictureUri() const;
56−
57− void setPictureUri(const QString &str);
58−
59−Q_SIGNALS:
60− void schemaChanged();
61− void pictureUriChanged(const QString&);
62−
63−private:
64− GSettingsSchemaQml* m_schema;
65−
66− QString m_pictureUri;
67−
68− friend class GSettingsSchemaQml;
69−};
70−
71−class GSettingsControllerQml: public QObject
72−{
73− Q_OBJECT
74−
75−public:
76− static GSettingsControllerQml* instance();
77− ~GSettingsControllerQml();
78−
79− void registerSettingsObject(GSettingsQml *obj);
80− void unRegisterSettingsObject(GSettingsQml *obj);
81− Q_INVOKABLE void setPictureUri(const QString &str);
82−
83−private:
84− GSettingsControllerQml();
85−
86− static GSettingsControllerQml* s_controllerInstance;
87− QList<GSettingsQml *> m_registeredGSettings;
88−};
89−
90−#endif // FAKE_GSETTINGS_H
tests/mocks/GSettings/plugin.cppdeleted−33
@@ -1,33 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−#include "plugin.h"
18−#include "fake_gsettings.h"
19−
20−#include <QtQml>
21−
22−static QObject* controllerProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
23−{
24− return GSettingsControllerQml::instance();
25−}
26−
27−void FakeGSettingsQmlPlugin::registerTypes(const char *uri)
28−{
29− qmlRegisterSingletonType<GSettingsControllerQml>(uri, 1, 0, "GSettingsController", controllerProvider);
30− qmlRegisterType<GSettingsQml>(uri, 1, 0, "GSettings");
31− qmlRegisterUncreatableType<GSettingsSchemaQml>(uri, 1, 0, "GSettingsSchema",
32− "GSettingsSchema can only be used inside of a GSettings component");
33−}
tests/mocks/GSettings/plugin.hdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−#ifndef PLUGIN_H
18−#define PLUGIN_H
19−
20−#include <QtQml/QQmlExtensionPlugin>
21−
22−class FakeGSettingsQmlPlugin : public QQmlExtensionPlugin
23−{
24− Q_OBJECT
25− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26−
27−public:
28− void registerTypes(const char *uri);
29−};
30−
31−#endif // PLUGIN_H
tests/mocks/GSettings/qmldirdeleted−2
@@ -1,2 +0,0 @@
1−module GSettings
2−plugin FakeGSettingsQml
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+68−10
@@ -1411,7 +1411,8 @@ private Q_SLOTS:
14111411
14121412 void testMaximizeVisibleArea()
14131413 {
1414− lvwph->maximizeVisibleArea(2);
1414+ bool res = lvwph->maximizeVisibleArea(2);
1415+ QVERIFY(res);
14151416 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14161417
14171418 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1431,12 +1432,14 @@ private Q_SLOTS:
14311432
14321433 void testMaximizeVisibleAreaVisibleItems()
14331434 {
1434− lvwph->maximizeVisibleArea(0);
1435+ bool res = lvwph->maximizeVisibleArea(0);
1436+ QVERIFY(res);
14351437 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14361438
14371439 verifyInitialTopPosition();
14381440
1439− lvwph->maximizeVisibleArea(1);
1441+ res = lvwph->maximizeVisibleArea(1);
1442+ QVERIFY(res);
14401443 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14411444
14421445 verifyInitialTopPosition();
@@ -1444,17 +1447,20 @@ private Q_SLOTS:
14441447
14451448 void testMaximizeVisibleAreaInvalidIndexes()
14461449 {
1447− lvwph->maximizeVisibleArea(-1);
1450+ bool res = lvwph->maximizeVisibleArea(-1);
1451+ QVERIFY(!res);
14481452 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14491453
14501454 verifyInitialTopPosition();
14511455
1452− lvwph->maximizeVisibleArea(1000);
1456+ res = lvwph->maximizeVisibleArea(1000);
1457+ QVERIFY(!res);
14531458 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14541459
14551460 verifyInitialTopPosition();
14561461
1457− lvwph->maximizeVisibleArea(4);
1462+ res = lvwph->maximizeVisibleArea(4);
1463+ QVERIFY(!res);
14581464 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14591465
14601466 verifyInitialTopPosition();
@@ -1463,7 +1469,8 @@ private Q_SLOTS:
14631469 void testMaximizeVisibleAreaBigElement()
14641470 {
14651471 model->setProperty(2, "size", 4000);
1466− lvwph->maximizeVisibleArea(2);
1472+ bool res = lvwph->maximizeVisibleArea(2);
1473+ QVERIFY(res);
14671474 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14681475
14691476 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
@@ -1483,7 +1490,8 @@ private Q_SLOTS:
14831490 void testMaximizeVisibleAreaScrollDown()
14841491 {
14851492 changeContentY(250);
1486− lvwph->maximizeVisibleArea(1);
1493+ bool res = lvwph->maximizeVisibleArea(1);
1494+ QVERIFY(res);
14871495 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14881496
14891497 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1505,7 +1513,8 @@ private Q_SLOTS:
15051513 {
15061514 model->setProperty(1, "size", 1000);
15071515 changeContentY(1150);
1508− lvwph->maximizeVisibleArea(1);
1516+ bool res = lvwph->maximizeVisibleArea(1);
1517+ QVERIFY(res);
15091518 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
15101519
15111520 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1538,7 +1547,8 @@ private Q_SLOTS:
15381547 QCOMPARE(lvwph->contentY(), 650.);
15391548 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
15401549
1541− lvwph->maximizeVisibleArea(1);
1550+ bool res = lvwph->maximizeVisibleArea(1);
1551+ QVERIFY(res);
15421552 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
15431553
15441554 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1554,6 +1564,54 @@ private Q_SLOTS:
15541564 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
15551565 }
15561566
1567+ void testMaximizeVisibleAreaTopWithHalfPageHeader()
1568+ {
1569+ changeContentY(430);
1570+ changeContentY(-30);
1571+
1572+ bool res = lvwph->maximizeVisibleArea(1);
1573+ QVERIFY(res);
1574+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1575+
1576+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1577+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1578+ verifyItem(0, -150., 150., true);
1579+ verifyItem(1, 0., 200., false);
1580+ verifyItem(2, 200, 350., false);
1581+ verifyItem(3, 550, 350., true);
1582+ QCOMPARE(lvwph->m_minYExtent, 0.);
1583+ QCOMPARE(lvwph->m_clipItem->y(), 200.);
1584+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1585+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1586+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1587+ QCOMPARE(lvwph->contentY(), 200.);
1588+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1589+ }
1590+
1591+ void testMaximizeVisibleAreaBottomWithHalfPageHeader()
1592+ {
1593+ changeContentY(430);
1594+ changeContentY(-30);
1595+
1596+ bool res = lvwph->maximizeVisibleArea(3);
1597+ QVERIFY(res);
1598+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1599+
1600+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1601+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1602+ verifyItem(0, -358., 200., true);
1603+ verifyItem(1, -158., 350., false);
1604+ verifyItem(2, 192, 350., false);
1605+ verifyItem(3, 542, 350., true);
1606+ QCOMPARE(lvwph->m_minYExtent, 162.5);
1607+ QCOMPARE(lvwph->m_clipItem->y(), 558.);
1608+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1609+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1610+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1611+ QCOMPARE(lvwph->contentY(), 558.);
1612+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1613+ }
1614+
15571615private:
15581616 QQuickView *view;
15591617 ListViewWithPageHeader *lvwph;
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+167−10
@@ -1711,9 +1711,54 @@ private Q_SLOTS:
17111711 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
17121712 }
17131713
1714+ void testSectionItemCullOnFirstSectionItemTopEdge()
1715+ {
1716+ changeContentY(50);
1717+
1718+ verifyItem(0, 0., 190., false, "Agressive", false);
1719+ verifyItem(1, 190., 240., false, "Regular", false);
1720+ verifyItem(2, 430., 390., false, "Mild", false);
1721+ QCOMPARE(lvwph->m_minYExtent, 0.);
1722+ QCOMPARE(lvwph->m_clipItem->y(), 50.);
1723+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1724+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1725+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1726+ QCOMPARE(lvwph->contentY(), 50.);
1727+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1728+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1729+ }
1730+
1731+ void testSectionItemCullOnSecondSectionItemTopEdge()
1732+ {
1733+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive"));
1734+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive"));
1735+
1736+ changeContentY(140);
1737+
1738+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 5);
1739+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1740+ verifyItem(0, -90., 90., true, "Agressive", true);
1741+ verifyItem(1, 0., 50., false, QString(), false);
1742+ verifyItem(2, 50., 150., false, QString(), false);
1743+ verifyItem(3, 200., 240., false, "Regular", false);
1744+ verifyItem(4, 440., 390., false, "Mild", false);
1745+ QCOMPARE(lvwph->m_minYExtent, 0.);
1746+ QCOMPARE(lvwph->m_clipItem->y(), 140.);
1747+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1748+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1749+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1750+ QCOMPARE(lvwph->contentY(), 140.);
1751+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1752+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1753+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1754+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
1755+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1756+ }
1757+
17141758 void testMaximizeVisibleArea()
17151759 {
1716− lvwph->maximizeVisibleArea(2);
1760+ bool res = lvwph->maximizeVisibleArea(2);
1761+ QVERIFY(res);
17171762 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17181763
17191764 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1737,12 +1782,14 @@ private Q_SLOTS:
17371782
17381783 void testMaximizeVisibleAreaVisibleItems()
17391784 {
1740− lvwph->maximizeVisibleArea(0);
1785+ bool res = lvwph->maximizeVisibleArea(0);
1786+ QVERIFY(res);
17411787 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17421788
17431789 verifyInitialTopPosition();
17441790
1745− lvwph->maximizeVisibleArea(1);
1791+ res = lvwph->maximizeVisibleArea(1);
1792+ QVERIFY(res);
17461793 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17471794
17481795 verifyInitialTopPosition();
@@ -1750,17 +1797,20 @@ private Q_SLOTS:
17501797
17511798 void testMaximizeVisibleAreaInvalidIndexes()
17521799 {
1753− lvwph->maximizeVisibleArea(-1);
1800+ bool res = lvwph->maximizeVisibleArea(-1);
1801+ QVERIFY(!res);
17541802 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17551803
17561804 verifyInitialTopPosition();
17571805
1758− lvwph->maximizeVisibleArea(1000);
1806+ res = lvwph->maximizeVisibleArea(1000);
1807+ QVERIFY(!res);
17591808 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17601809
17611810 verifyInitialTopPosition();
17621811
1763− lvwph->maximizeVisibleArea(3);
1812+ res = lvwph->maximizeVisibleArea(3);
1813+ QVERIFY(!res);
17641814 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17651815
17661816 verifyInitialTopPosition();
@@ -1771,7 +1821,8 @@ private Q_SLOTS:
17711821 model->setProperty(2, "size", 4000);
17721822 verifyItem(2, 480, 4040., false, "Mild", false);
17731823
1774− lvwph->maximizeVisibleArea(2);
1824+ bool res = lvwph->maximizeVisibleArea(2);
1825+ QVERIFY(res);
17751826 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17761827
17771828 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
@@ -1792,7 +1843,8 @@ private Q_SLOTS:
17921843 void testMaximizeVisibleAreaScrollDown()
17931844 {
17941845 changeContentY(350);
1795− lvwph->maximizeVisibleArea(1);
1846+ bool res = lvwph->maximizeVisibleArea(1);
1847+ QVERIFY(res);
17961848 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
17971849
17981850 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1815,7 +1867,8 @@ private Q_SLOTS:
18151867 {
18161868 model->setProperty(1, "size", 1000);
18171869 changeContentY(1150);
1818− lvwph->maximizeVisibleArea(1);
1870+ bool res = lvwph->maximizeVisibleArea(1);
1871+ QVERIFY(res);
18191872 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
18201873
18211874 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1856,7 +1909,8 @@ private Q_SLOTS:
18561909 QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
18571910 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
18581911
1859− lvwph->maximizeVisibleArea(1);
1912+ bool res = lvwph->maximizeVisibleArea(1);
1913+ QVERIFY(res);
18601914 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
18611915
18621916 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1876,6 +1930,109 @@ private Q_SLOTS:
18761930 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
18771931 }
18781932
1933+ void testMaximizeVisibleAreaTopWithHalfPageHeader()
1934+ {
1935+ changeContentY(430);
1936+ changeContentY(-30);
1937+
1938+ bool res = lvwph->maximizeVisibleArea(1);
1939+ QVERIFY(res);
1940+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1941+
1942+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1943+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1944+ verifyItem(0, -190., 190., true, "Agressive", true);
1945+ verifyItem(1, 0., 240., false, "Regular", false);
1946+ verifyItem(2, 240, 390., false, "Mild", false);
1947+ verifyItem(3, 630, 390., true, "Bold", true);
1948+ QCOMPARE(lvwph->m_minYExtent, 0.);
1949+ QCOMPARE(lvwph->m_clipItem->y(), 240.);
1950+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1951+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1952+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1953+ QCOMPARE(lvwph->contentY(), 240.);
1954+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1955+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1956+ }
1957+
1958+ void testMaximizeVisibleAreaBottomWithHalfPageHeader()
1959+ {
1960+ changeContentY(430);
1961+ changeContentY(-30);
1962+
1963+ bool res = lvwph->maximizeVisibleArea(3);
1964+ QVERIFY(res);
1965+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1966+
1967+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1968+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1969+ verifyItem(0, -478., 240., true, "Regular", true);
1970+ verifyItem(1, -238., 390., false, "Mild", true);
1971+ verifyItem(2, 152, 390., false, "Bold", false);
1972+ verifyItem(3, 542, 350., true, QString(), true);
1973+ QCOMPARE(lvwph->m_minYExtent, 152.5);
1974+ QCOMPARE(lvwph->m_clipItem->y(), 718.);
1975+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1976+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1977+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1978+ QCOMPARE(lvwph->contentY(), 718.);
1979+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1980+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1981+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1982+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1983+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1984+ }
1985+
1986+ void testMaximizeVisibleAreaTopSecondSectionItemStickySection()
1987+ {
1988+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
1989+ changeContentY(250);
1990+ bool res = lvwph->maximizeVisibleArea(1);
1991+ QVERIFY(res);
1992+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1993+
1994+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1995+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1996+ verifyItem(0, -100., 140., false, "Agressive", true);
1997+ verifyItem(1, 40., 150., false, QString(), true);
1998+ verifyItem(2, 190, 240., false, "Regular", false);
1999+ verifyItem(3, 430, 390., false, "Mild", false);
2000+ QCOMPARE(lvwph->m_minYExtent, 0.);
2001+ QCOMPARE(lvwph->m_clipItem->y(), 150.);
2002+ QCOMPARE(lvwph->m_clipItem->clip(), false);
2003+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
2004+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
2005+ QCOMPARE(lvwph->contentY(), 150.);
2006+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2007+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2008+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2009+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2010+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2011+
2012+ changeContentY(20);
2013+ res = lvwph->maximizeVisibleArea(1);
2014+ QVERIFY(res);
2015+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
2016+
2017+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
2018+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
2019+ verifyItem(0, -100., 140., false, "Agressive", true);
2020+ verifyItem(1, 40., 150., false, QString(), true);
2021+ verifyItem(2, 190, 240., false, "Regular", false);
2022+ verifyItem(3, 430, 390., false, "Mild", false);
2023+ QCOMPARE(lvwph->m_minYExtent, 0.);
2024+ QCOMPARE(lvwph->m_clipItem->y(), 150.);
2025+ QCOMPARE(lvwph->m_clipItem->clip(), false);
2026+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
2027+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
2028+ QCOMPARE(lvwph->contentY(), 150.);
2029+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2030+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2031+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2032+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2033+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2034+ }
2035+
18792036private:
18802037 QQuickView *view;
18812038 ListViewWithPageHeader *lvwph;
tests/qmltests/CMakeLists.txt+1−1
@@ -26,7 +26,7 @@ set(qmltest_DEFAULT_TARGETS qmluitests)
2626set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
2727set(qmltest_DEFAULT_PROPERTIES "")
2828
29−add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
29+add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}
3030 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
3131add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
3232add_qml_test(Components DraggingArea)
tests/qmltests/tst_Shell.qml−14
@@ -19,7 +19,6 @@
1919
2020import QtQuick 2.0
2121import QtTest 1.0
22−import GSettings 1.0
2322import Ubuntu.Application 0.1
2423import Unity.Test 0.1 as UT
2524
@@ -278,18 +277,5 @@ Item {
278277 }
279278 } while (!isStill);
280279 }
281−
282− function test_wallpaper_data() {
283− return [
284− {tag: "red", url: "tests/data/unity/backgrounds/red.png"},
285− {tag: "blue", url: "tests/data/unity/backgrounds/blue.png"}
286− ]
287− }
288−
289− function test_wallpaper(data) {
290− var backgroundImage = findChild(shell, "backgroundImage")
291− GSettingsController.setPictureUri(data.url)
292− tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
293− }
294280 }
295281}