on xenial help sign in
Merge lp:~aacid/unity8/lvwph_maximizeVisibleArea
4c48c20Albert Astals
CODING+2−11
@@ -23,16 +23,10 @@ $ cd ~/unity8/trunk
23$ ./build --setup
23$ ./build --setup
24
24
25 this will:
25 this will:
26− - add ppa:ubuntu-unity/next
27 - install the required dependencies to build, as well as run on the desktop
26 - install the required dependencies to build, as well as run on the desktop
28 - it should also install unity-scope-home and unity-lens-application which
27 - it should also install unity-scope-home and unity-lens-application which
29 are technically "recommends", not strict dependencies
28 are technically "recommends", not strict dependencies
30
29
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−
36build Unity 8
30build Unity 8
37-------------
31-------------
38
32
@@ -75,14 +69,11 @@ Notes
75Running Unity 8 on devices
69Running Unity 8 on devices
76==========================
70==========================
77- Ubuntu Touch builds are currently only available in 13.10 flavour
71- 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
79 https://wiki.ubuntu.com/Touch/Devices#Running_fine
73 https://wiki.ubuntu.com/Touch/Devices#Running_fine
80- follow the Ubuntu Touch install instructions for your chosen device
74- follow the Ubuntu Touch install instructions for your chosen device
81 https://wiki.ubuntu.com/Touch/Install
75 https://wiki.ubuntu.com/Touch/Install
82−- make sure your device is connected to a WiFi network
76+- make sure your device is connected to a 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
86- also make sure you have your SSH key in ~/.ssh/id_rsa.pub (or install one
77- also make sure you have your SSH key in ~/.ssh/id_rsa.pub (or install one
87 on the device yourself)
78 on the device yourself)
88
79
Components/CrossFadeImage.qml+1−3
@@ -85,7 +85,7 @@ Item {
85 Connections {
85 Connections {
86 target: __nextImage
86 target: __nextImage
87 onStatusChanged: {
87 onStatusChanged: {
88− if (__nextImage.status == Image.Ready || __nextImage.status == Image.Error) {
88+ if (__nextImage.status == Image.Ready) {
89 swapImages();
89 swapImages();
90 }
90 }
91 }
91 }
@@ -96,7 +96,6 @@ Item {
96 anchors.fill: parent
96 anchors.fill: parent
97 cache: false
97 cache: false
98 asynchronous: true
98 asynchronous: true
99− fillMode: Image.PreserveAspectCrop
100 z: 1
99 z: 1
101 }
100 }
102
101
@@ -105,7 +104,6 @@ Item {
105 anchors.fill: parent
104 anchors.fill: parent
106 cache: false
105 cache: false
107 asynchronous: true
106 asynchronous: true
108− fillMode: Image.PreserveAspectCrop
109 z: 0
107 z: 0
110 }
108 }
111
109
Greeter/GreeterContent.qml+1
@@ -37,6 +37,7 @@ MouseArea {
37
37
38 source: shell.background
38 source: shell.background
39 anchors.fill: parent
39 anchors.fill: parent
40+ crossFade: false
40 fadeInFirst: false
41 fadeInFirst: false
41 }
42 }
42
43
Shell.qml+8−16
@@ -15,7 +15,6 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import GSettings 1.0
19import Ubuntu.Application 0.1
18import Ubuntu.Application 0.1
20import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
21import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
@@ -42,8 +41,8 @@ FocusScope {
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
41 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
43
42
44 property real edgeSize: units.gu(2)
43 property real edgeSize: units.gu(2)
45− property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
44+ property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
46− property url background: backgroundSettings.pictureUri
45+ property url background: default_background
47 readonly property real panelHeight: panel.panelHeight
46 readonly property real panelHeight: panel.panelHeight
48
47
49 property bool dashShown: dash.shown
48 property bool dashShown: dash.shown
@@ -116,11 +115,6 @@ FocusScope {
116 }
115 }
117 }
116 }
118
117
119− GSettings {
120− id: backgroundSettings
121− schema.id: "org.gnome.desktop.background"
122− }
123−
124 VolumeControl {
118 VolumeControl {
125 id: volumeControl
119 id: volumeControl
126 }
120 }
@@ -145,16 +139,12 @@ FocusScope {
145 // through the translucent parts of the shell surface.
139 // through the translucent parts of the shell surface.
146 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
140 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
147
141
148− CrossFadeImage {
142+ Image {
149 id: backgroundImage
143 id: backgroundImage
150− objectName: "backgroundImage"
151 source: shell.background
144 source: shell.background
145+ sourceSize.width: parent.width
146+ sourceSize.height: parent.height
152 anchors.fill: parent
147 anchors.fill: parent
153− onStatusChanged: {
154− if (status == Image.Error) {
155− backgroundSettings.pictureUri = shell.defaultBackground
156− }
157− }
158 }
148 }
159
149
160 Rectangle {
150 Rectangle {
@@ -199,6 +189,7 @@ FocusScope {
199 }
189 }
200 }
190 }
201
191
192+
202 Item {
193 Item {
203 id: stagesOuterContainer
194 id: stagesOuterContainer
204
195
@@ -263,6 +254,7 @@ FocusScope {
263 ignoreUnknownSignals: true
254 ignoreUnknownSignals: true
264 }
255 }
265
256
257+
266 Stage {
258 Stage {
267 id: mainStage
259 id: mainStage
268
260
@@ -438,7 +430,7 @@ FocusScope {
438 onUnlocked: greeter.hide()
430 onUnlocked: greeter.hide()
439 onSelected: {
431 onSelected: {
440 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
432 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
441− shell.background = bgPath ? bgPath : defaultBackground
433+ shell.background = bgPath ? bgPath : default_background
442 }
434 }
443
435
444 onLeftTeaserPressedChanged: {
436 onLeftTeaserPressedChanged: {
build−1
@@ -36,7 +36,6 @@ BUILD_TYPE="debug"
36[ $# -eq 1 ] && BUILD_TYPE="$1"
36[ $# -eq 1 ] && BUILD_TYPE="$1"
37
37
38install_dependencies() {
38install_dependencies() {
39− [ -f /etc/apt/sources.list.d/ubuntu-unity-next-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-unity/next || exit 1
40 sudo apt-get update || exit 4
39 sudo apt-get update || exit 4
41 echo "Installing Unity 8 dependencies.."
40 echo "Installing Unity 8 dependencies.."
42 sudo apt-get install devscripts \
41 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+
1unity8 (7.81.3+13.10.20130805-0ubuntu1) saucy; urgency=low
28unity8 (7.81.3+13.10.20130805-0ubuntu1) saucy; urgency=low
2
29
3 [ Michael Terry ]
30 [ Michael Terry ]
debian/control+1−3
@@ -56,10 +56,8 @@ Description: Indicators client test application
56
56
57Package: unity8
57Package: unity8
58Architecture: any
58Architecture: any
59−Depends: gsettings-desktop-schemas,
60− qmenumodel-qml,
59+Depends: qmenumodel-qml,
61 qtdeclarative5-dee-plugin,
60 qtdeclarative5-dee-plugin,
62− qtdeclarative5-gsettings1.0,
63 qtdeclarative5-ubuntu-ui-toolkit-plugin,
61 qtdeclarative5-ubuntu-ui-toolkit-plugin,
64 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
62 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
65 qtdeclarative5-xmllistmodel-plugin,
63 qtdeclarative5-xmllistmodel-plugin,
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+34−5
@@ -389,7 +389,7 @@ QQuickItem *ListViewWithPageHeader::item(int modelIndex) const
389 return nullptr;
389 return nullptr;
390}
390}
391
391
392−void ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
392+bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
393{
393{
394 ListItem *listItem = itemAtIndex(modelIndex);
394 ListItem *listItem = itemAtIndex(modelIndex);
395 if (listItem)
395 if (listItem)
@@ -402,14 +402,28 @@ void ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
402 m_contentYAnimation->setTo(to);
402 m_contentYAnimation->setTo(to);
403 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
403 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
404 m_contentYAnimation->start();
404 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+ {
406 // we can scroll the list down to show more stuff
408 // we can scroll the list down to show more stuff
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+ }
407− const auto to = qMax(listItemY, listItemY + listItem->height() - height());
419+ const auto to = qMax(realVisibleListItemY, listItemY + listItem->height() - height());
408 m_contentYAnimation->setTo(to);
420 m_contentYAnimation->setTo(to);
409 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
421 contentYAnimationType = ContentYAnimationMaximizeVisibleArea;
410 m_contentYAnimation->start();
422 m_contentYAnimation->start();
411 }
423 }
424+ return true;
412 }
425 }
426+ return false;
413}
427}
414
428
415qreal ListViewWithPageHeader::minYExtent() const
429qreal ListViewWithPageHeader::minYExtent() const
@@ -454,7 +468,10 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
454 m_headerItemShownHeight = 0;
468 m_headerItemShownHeight = 0;
455 m_headerItem->setY(contentY());
469 m_headerItem->setY(contentY());
456 } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0)) {
470 } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0)) {
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
457− m_headerItemShownHeight += diff;
474+ m_headerItemShownHeight += diff;
458 if (contentY() == -m_minYExtent) {
475 if (contentY() == -m_minYExtent) {
459 m_headerItemShownHeight = 0;
476 m_headerItemShownHeight = 0;
460 } else {
477 } else {
@@ -1091,7 +1108,19 @@ void ListViewWithPageHeader::layout()
1091 // Then after the loop we'll make sure that if there's another section just below it
1108 // Then after the loop we'll make sure that if there's another section just below it
1092 // pushed the sticky section up to make it disappear
1109 // pushed the sticky section up to make it disappear
1093 const qreal topSectionStickPos = m_headerItemShownHeight + contentY() - m_clipItem->y();
1110 const qreal topSectionStickPos = m_headerItemShownHeight + contentY() - m_clipItem->y();
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
1094− if (topSectionStickPos <= pos) {
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) {
1095 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
1124 QQuickItemPrivate::get(m_topSectionItem)->setCulled(true);
1096 if (item->m_sectionItem) {
1125 if (item->m_sectionItem) {
1097 // This seems it should happen since why would we cull the top section
1126 // This seems it should happen since why would we cull the top section
plugins/ListViewWithPageHeader/listviewwithpageheader.h+4−2
@@ -90,8 +90,10 @@ public:
90 Q_INVOKABLE void showHeader();
90 Q_INVOKABLE void showHeader();
91 Q_INVOKABLE QQuickItem *item(int modelIndex) const;
91 Q_INVOKABLE QQuickItem *item(int modelIndex) const;
92
92
93− // The index has to be visible for this to try to do something
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
94− Q_INVOKABLE void maximizeVisibleArea(int modelIndex);
96+ Q_INVOKABLE bool maximizeVisibleArea(int modelIndex);
95
97
96Q_SIGNALS:
98Q_SIGNALS:
97 void modelChanged();
99 void modelChanged();
run_on_device+2−2
@@ -27,8 +27,8 @@ usage() {
27 echo " -k, --keylock Enable a Keyboard lock screen when running"
27 echo " -k, --keylock Enable a Keyboard lock screen when running"
28 echo ""
28 echo ""
29 echo "IMPORTANT:"
29 echo "IMPORTANT:"
30− echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)."
30+ echo " * Make sure to have networking setup on the device beforehand."
31− echo " * Execute that script from a directory containing a branch the shell code."
31+ echo " * Execute that script from a directory containing unity8 code."
32 exit 1
32 exit 1
33}
33}
34
34
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)
2add_subdirectory(libusermetrics)
1add_subdirectory(libusermetrics)
3add_subdirectory(LightDM)
2add_subdirectory(LightDM)
4add_subdirectory(QMenuModel)
3add_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:
1411
1411
1412 void testMaximizeVisibleArea()
1412 void testMaximizeVisibleArea()
1413 {
1413 {
1414− lvwph->maximizeVisibleArea(2);
1414+ bool res = lvwph->maximizeVisibleArea(2);
1415+ QVERIFY(res);
1415 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1416 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1416
1417
1417 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1418 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1431,12 +1432,14 @@ private Q_SLOTS:
1431
1432
1432 void testMaximizeVisibleAreaVisibleItems()
1433 void testMaximizeVisibleAreaVisibleItems()
1433 {
1434 {
1434− lvwph->maximizeVisibleArea(0);
1435+ bool res = lvwph->maximizeVisibleArea(0);
1436+ QVERIFY(res);
1435 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1437 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1436
1438
1437 verifyInitialTopPosition();
1439 verifyInitialTopPosition();
1438
1440
1439− lvwph->maximizeVisibleArea(1);
1441+ res = lvwph->maximizeVisibleArea(1);
1442+ QVERIFY(res);
1440 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1443 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1441
1444
1442 verifyInitialTopPosition();
1445 verifyInitialTopPosition();
@@ -1444,17 +1447,20 @@ private Q_SLOTS:
1444
1447
1445 void testMaximizeVisibleAreaInvalidIndexes()
1448 void testMaximizeVisibleAreaInvalidIndexes()
1446 {
1449 {
1447− lvwph->maximizeVisibleArea(-1);
1450+ bool res = lvwph->maximizeVisibleArea(-1);
1451+ QVERIFY(!res);
1448 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1452 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1449
1453
1450 verifyInitialTopPosition();
1454 verifyInitialTopPosition();
1451
1455
1452− lvwph->maximizeVisibleArea(1000);
1456+ res = lvwph->maximizeVisibleArea(1000);
1457+ QVERIFY(!res);
1453 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1458 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1454
1459
1455 verifyInitialTopPosition();
1460 verifyInitialTopPosition();
1456
1461
1457− lvwph->maximizeVisibleArea(4);
1462+ res = lvwph->maximizeVisibleArea(4);
1463+ QVERIFY(!res);
1458 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1464 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1459
1465
1460 verifyInitialTopPosition();
1466 verifyInitialTopPosition();
@@ -1463,7 +1469,8 @@ private Q_SLOTS:
1463 void testMaximizeVisibleAreaBigElement()
1469 void testMaximizeVisibleAreaBigElement()
1464 {
1470 {
1465 model->setProperty(2, "size", 4000);
1471 model->setProperty(2, "size", 4000);
1466− lvwph->maximizeVisibleArea(2);
1472+ bool res = lvwph->maximizeVisibleArea(2);
1473+ QVERIFY(res);
1467 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1474 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1468
1475
1469 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
1476 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
@@ -1483,7 +1490,8 @@ private Q_SLOTS:
1483 void testMaximizeVisibleAreaScrollDown()
1490 void testMaximizeVisibleAreaScrollDown()
1484 {
1491 {
1485 changeContentY(250);
1492 changeContentY(250);
1486− lvwph->maximizeVisibleArea(1);
1493+ bool res = lvwph->maximizeVisibleArea(1);
1494+ QVERIFY(res);
1487 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1495 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1488
1496
1489 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1497 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1505,7 +1513,8 @@ private Q_SLOTS:
1505 {
1513 {
1506 model->setProperty(1, "size", 1000);
1514 model->setProperty(1, "size", 1000);
1507 changeContentY(1150);
1515 changeContentY(1150);
1508− lvwph->maximizeVisibleArea(1);
1516+ bool res = lvwph->maximizeVisibleArea(1);
1517+ QVERIFY(res);
1509 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1518 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1510
1519
1511 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1520 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1538,7 +1547,8 @@ private Q_SLOTS:
1538 QCOMPARE(lvwph->contentY(), 650.);
1547 QCOMPARE(lvwph->contentY(), 650.);
1539 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1548 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1540
1549
1541− lvwph->maximizeVisibleArea(1);
1550+ bool res = lvwph->maximizeVisibleArea(1);
1551+ QVERIFY(res);
1542 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1552 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1543
1553
1544 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1554 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1554,6 +1564,54 @@ private Q_SLOTS:
1554 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1564 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1555 }
1565 }
1556
1566
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+
1557private:
1615private:
1558 QQuickView *view;
1616 QQuickView *view;
1559 ListViewWithPageHeader *lvwph;
1617 ListViewWithPageHeader *lvwph;
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+167−10
@@ -1711,9 +1711,54 @@ private Q_SLOTS:
1711 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1711 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1712 }
1712 }
1713
1713
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+
1714 void testMaximizeVisibleArea()
1758 void testMaximizeVisibleArea()
1715 {
1759 {
1716− lvwph->maximizeVisibleArea(2);
1760+ bool res = lvwph->maximizeVisibleArea(2);
1761+ QVERIFY(res);
1717 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1762 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1718
1763
1719 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1764 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1737,12 +1782,14 @@ private Q_SLOTS:
1737
1782
1738 void testMaximizeVisibleAreaVisibleItems()
1783 void testMaximizeVisibleAreaVisibleItems()
1739 {
1784 {
1740− lvwph->maximizeVisibleArea(0);
1785+ bool res = lvwph->maximizeVisibleArea(0);
1786+ QVERIFY(res);
1741 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1787 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1742
1788
1743 verifyInitialTopPosition();
1789 verifyInitialTopPosition();
1744
1790
1745− lvwph->maximizeVisibleArea(1);
1791+ res = lvwph->maximizeVisibleArea(1);
1792+ QVERIFY(res);
1746 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1793 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1747
1794
1748 verifyInitialTopPosition();
1795 verifyInitialTopPosition();
@@ -1750,17 +1797,20 @@ private Q_SLOTS:
1750
1797
1751 void testMaximizeVisibleAreaInvalidIndexes()
1798 void testMaximizeVisibleAreaInvalidIndexes()
1752 {
1799 {
1753− lvwph->maximizeVisibleArea(-1);
1800+ bool res = lvwph->maximizeVisibleArea(-1);
1801+ QVERIFY(!res);
1754 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1802 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1755
1803
1756 verifyInitialTopPosition();
1804 verifyInitialTopPosition();
1757
1805
1758− lvwph->maximizeVisibleArea(1000);
1806+ res = lvwph->maximizeVisibleArea(1000);
1807+ QVERIFY(!res);
1759 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1808 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1760
1809
1761 verifyInitialTopPosition();
1810 verifyInitialTopPosition();
1762
1811
1763− lvwph->maximizeVisibleArea(3);
1812+ res = lvwph->maximizeVisibleArea(3);
1813+ QVERIFY(!res);
1764 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1814 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1765
1815
1766 verifyInitialTopPosition();
1816 verifyInitialTopPosition();
@@ -1771,7 +1821,8 @@ private Q_SLOTS:
1771 model->setProperty(2, "size", 4000);
1821 model->setProperty(2, "size", 4000);
1772 verifyItem(2, 480, 4040., false, "Mild", false);
1822 verifyItem(2, 480, 4040., false, "Mild", false);
1773
1823
1774− lvwph->maximizeVisibleArea(2);
1824+ bool res = lvwph->maximizeVisibleArea(2);
1825+ QVERIFY(res);
1775 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1826 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1776
1827
1777 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
1828 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
@@ -1792,7 +1843,8 @@ private Q_SLOTS:
1792 void testMaximizeVisibleAreaScrollDown()
1843 void testMaximizeVisibleAreaScrollDown()
1793 {
1844 {
1794 changeContentY(350);
1845 changeContentY(350);
1795− lvwph->maximizeVisibleArea(1);
1846+ bool res = lvwph->maximizeVisibleArea(1);
1847+ QVERIFY(res);
1796 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1848 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1797
1849
1798 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1850 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1815,7 +1867,8 @@ private Q_SLOTS:
1815 {
1867 {
1816 model->setProperty(1, "size", 1000);
1868 model->setProperty(1, "size", 1000);
1817 changeContentY(1150);
1869 changeContentY(1150);
1818− lvwph->maximizeVisibleArea(1);
1870+ bool res = lvwph->maximizeVisibleArea(1);
1871+ QVERIFY(res);
1819 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1872 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1820
1873
1821 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1874 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1856,7 +1909,8 @@ private Q_SLOTS:
1856 QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1909 QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1857 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1910 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1858
1911
1859− lvwph->maximizeVisibleArea(1);
1912+ bool res = lvwph->maximizeVisibleArea(1);
1913+ QVERIFY(res);
1860 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1914 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1861
1915
1862 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1916 QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
@@ -1876,6 +1930,109 @@ private Q_SLOTS:
1876 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1930 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1877 }
1931 }
1878
1932
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+
1879private:
2036private:
1880 QQuickView *view;
2037 QQuickView *view;
1881 ListViewWithPageHeader *lvwph;
2038 ListViewWithPageHeader *lvwph;
tests/qmltests/CMakeLists.txt+1−1
@@ -26,7 +26,7 @@ set(qmltest_DEFAULT_TARGETS qmluitests)
26set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
26set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
27set(qmltest_DEFAULT_PROPERTIES "")
27set(qmltest_DEFAULT_PROPERTIES "")
28
28
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}
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
31add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
31add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
32add_qml_test(Components DraggingArea)
32add_qml_test(Components DraggingArea)
tests/qmltests/tst_Shell.qml−14
@@ -19,7 +19,6 @@
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21import QtTest 1.0
21import QtTest 1.0
22−import GSettings 1.0
23import Ubuntu.Application 0.1
22import Ubuntu.Application 0.1
24import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
25
24
@@ -278,18 +277,5 @@ Item {
278 }
277 }
279 } while (!isStill);
278 } while (!isStill);
280 }
279 }
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− }
294 }
280 }
295}
281}