on xenial help sign in
DefaultIndicatorPage -> IndicatorPage
b0e0a81Nick Dedekind
qml/Panel/Indicators/DefaultIndicatorPage.qml → qml/Panel/IndicatorPage.qmlrenamed+1
@@ -21,6 +21,7 @@
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1 as Components
22import Ubuntu.Components 0.1 as Components
23import Unity.Indicators 0.1 as Indicators
23import Unity.Indicators 0.1 as Indicators
24+import "Indicators"
24
25
25IndicatorBase {
26IndicatorBase {
26 id: main
27 id: main
qml/Panel/MenuContent.qml+12−25
@@ -20,7 +20,6 @@ import Ubuntu.Components 1.1
20import Unity.Indicators 0.1 as Indicators
20import Unity.Indicators 0.1 as Indicators
21import Utils 0.1
21import Utils 0.1
22import "../Components"
22import "../Components"
23−import "Indicators"
24
23
25Rectangle {
24Rectangle {
26 id: content
25 id: content
@@ -54,38 +53,26 @@ Rectangle {
54
53
55 delegate: Loader {
54 delegate: Loader {
56 id: loader
55 id: loader
56+
57 width: ListView.view.width
57 width: ListView.view.width
58 height: ListView.view.height
58 height: ListView.view.height
59 objectName: identifier
59 objectName: identifier
60−
61− source: pageSource !== undefined && pageSource !== "" ? pageSource : Qt.resolvedUrl("Indicators/DefaultIndicatorPage.qml")
62 asynchronous: true
60 asynchronous: true
63
61
64− onVisibleChanged: {
62+ sourceComponent: IndicatorPage {
65− // Reset the indicator states
63+ objectName: identifier + "-page"
66− if (!visible && item && item["reset"]) {
67− item.reset()
68− }
69− }
70−
71− onLoaded: {
72− for(var pName in indicatorProperties) {
73− if (item.hasOwnProperty(pName)) {
74− item[pName] = indicatorProperties[pName]
75− }
76− }
77− }
78
64
79− Binding {
65+ identifier: model.identifier
80− target: loader.item
66+ busName: indicatorProperties.busName
81− property: "identifier"
67+ actionsObjectPath: indicatorProperties.actionsObjectPath
82− value: identifier
68+ menuObjectPath: indicatorProperties.menuObjectPath
83 }
69 }
84
70
85− Binding {
71+ onVisibleChanged: {
86− target: loader.item
72+ // Reset the indicator states
87− property: "objectName"
73+ if (!visible && status == Loader.Ready) {
88− value: identifier + "-page"
74+ item.reset();
75+ }
89 }
76 }
90 }
77 }
91 }
78 }
tests/qmltests/CMakeLists.txt+2−1
@@ -71,10 +71,11 @@ add_qml_test(Notifications Notifications)
71add_qml_test(Notifications VisualSnapDecisionsQueue)
71add_qml_test(Notifications VisualSnapDecisionsQueue)
72add_qml_test(Panel IndicatorItem)
72add_qml_test(Panel IndicatorItem)
73add_qml_test(Panel IndicatorItemRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
73add_qml_test(Panel IndicatorItemRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
74+add_qml_test(Panel IndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
74add_qml_test(Panel IndicatorsBar ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
75add_qml_test(Panel IndicatorsBar ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
75add_qml_test(Panel IndicatorsMenu ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
76add_qml_test(Panel IndicatorsMenu ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
77+add_qml_test(Panel MenuContent ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
76add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
78add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
77−add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
78# These MenuItemFactory tests need the test/mocks/ to come before plugins/
79# These MenuItemFactory tests need the test/mocks/ to come before plugins/
79add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
80add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
80add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
81add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml → tests/qmltests/Panel/tst_IndicatorPage.qmlrenamed+3−3
@@ -18,14 +18,14 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import Unity.Indicators 0.1 as Indicators
20import Unity.Indicators 0.1 as Indicators
21−import "../../../../qml/Panel/Indicators"
21+import "../../../qml/Panel"
22
22
23Item {
23Item {
24 id: testView
24 id: testView
25 width: units.gu(40)
25 width: units.gu(40)
26 height: units.gu(70)
26 height: units.gu(70)
27
27
28− DefaultIndicatorPage {
28+ IndicatorPage {
29 id: page
29 id: page
30 anchors.fill: parent
30 anchors.fill: parent
31
31
@@ -117,7 +117,7 @@ Item {
117 }
117 }
118
118
119 UT.UnityTestCase {
119 UT.UnityTestCase {
120− name: "DefaultIndicatorPage"
120+ name: "IndicatorPage"
121
121
122 function init() {
122 function init() {
123 initMenuData([]);
123 initMenuData([]);
tests/qmltests/Panel/tst_IndicatorsMenu.qml+1−1
@@ -220,7 +220,7 @@ IndicatorTest {
220 firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight * 2,
220 firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight * 2,
221 nextItemMappedPosition.x, indicatorsMenu.openedHeight / 3,
221 nextItemMappedPosition.x, indicatorsMenu.openedHeight / 3,
222 false /* beginTouch */, true /* endTouch */,
222 false /* beginTouch */, true /* endTouch */,
223− units.gu(5) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
223+ units.gu(5) /* speed */, 10 /* iterations */); // more samples needed for accurate velocity
224
224
225 compare(indicatorItemRow.currentItem, firstItem, "First indicator should still be the current item");
225 compare(indicatorItemRow.currentItem, firstItem, "First indicator should still be the current item");
226 }
226 }
tests/qmltests/Panel/tst_MenuContent.qml+6−12
@@ -17,11 +17,11 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20−import "../../qml/Panel"
20+import "../../../qml/Panel"
21import Unity.Indicators 0.1 as Indicators
21import Unity.Indicators 0.1 as Indicators
22
22
23−Item {
23+IndicatorTest {
24− id: shell
24+ id: root
25 width: units.gu(40)
25 width: units.gu(40)
26 height: units.gu(70)
26 height: units.gu(70)
27
27
@@ -29,14 +29,9 @@ Item {
29 Item { id: greeter }
29 Item { id: greeter }
30 Item { id: handle }
30 Item { id: handle }
31
31
32− Indicators.IndicatorsModel {
33− id: indicatorsModel
34− Component.onCompleted: load("test1")
35− }
36−
37 MenuContent {
32 MenuContent {
38 id: menuContent
33 id: menuContent
39− indicatorsModel: indicatorsModel
34+ indicatorsModel: root.indicatorsModel
40 height: parent.height - 50
35 height: parent.height - 50
41 }
36 }
42
37
@@ -105,7 +100,7 @@ Item {
105
100
106 // Check that the correct menus are displayed for the requested item.
101 // Check that the correct menus are displayed for the requested item.
107 function test_show_menu() {
102 function test_show_menu() {
108− var menuCount = indicatorsModel.count;
103+ var menuCount = root.indicatorsModel.count;
109 verify(menuCount > 0, "Menu count should be greater than zero");
104 verify(menuCount > 0, "Menu count should be greater than zero");
110
105
111 var listView = menu_content_test.findChild(menuContent, "indicatorsContentListView")
106 var listView = menu_content_test.findChild(menuContent, "indicatorsContentListView")
@@ -124,14 +119,13 @@ Item {
124
119
125 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
120 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
126 function test_multi_activate() {
121 function test_multi_activate() {
127− var menuCount = indicatorsModel.count;
122+ var menuCount = root.indicatorsModel.count;
128 verify(menuCount > 0, "Menu count should be greater than zero");
123 verify(menuCount > 0, "Menu count should be greater than zero");
129
124
130 for (var i = 0; i < 100; i++) {
125 for (var i = 0; i < 100; i++) {
131 activate_content(i % menuCount);
126 activate_content(i % menuCount);
132 compare(menuContent.currentMenuIndex, i%menuCount);
127 compare(menuContent.currentMenuIndex, i%menuCount);
133 }
128 }
134− wait(100);
135 }
129 }
136 }
130 }
137}
131}