on xenial help sign in
Fixed DefaultIndicatorPage test. Fixed warnings from test.
d10f95bNick Dedekind
qml/Panel/IndicatorItem.qml+6
@@ -39,6 +39,12 @@ Loader {
39 }
39 }
40 }
40 }
41
41
42+ Binding {
43+ target: item
44+ property: "identifier"
45+ value: identifier
46+ }
47+
42 Binding {
48 Binding {
43 target: item
49 target: item
44 property: "objectName"
50 property: "objectName"
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−1
@@ -130,7 +130,7 @@ IndicatorBase {
130 visible: status == Loader.Ready
130 visible: status == Loader.Ready
131
131
132 property int modelIndex: index
132 property int modelIndex: index
133− sourceComponent: factory.load(model, identifier)
133+ sourceComponent: factory.load(model, main.identifier)
134
134
135 onLoaded: {
135 onLoaded: {
136 if (item.hasOwnProperty("selected")) {
136 if (item.hasOwnProperty("selected")) {
qml/Panel/Indicators/IndicatorBase.qml+1
@@ -26,6 +26,7 @@ Item {
26 enabled: menuObjectPath != ""
26 enabled: menuObjectPath != ""
27
27
28 //const
28 //const
29+ property string identifier
29 property string busName
30 property string busName
30 property string actionsObjectPath
31 property string actionsObjectPath
31 property string menuObjectPath
32 property string menuObjectPath
qml/Panel/Indicators/MenuItemFactory.qml+1−1
@@ -823,7 +823,7 @@ Item {
823 }
823 }
824
824
825 function load(modelData, context) {
825 function load(modelData, context) {
826− if (modelData.type !== undefined) {
826+ if (modelData.type !== undefined && modelData.type !== "") {
827 var component = undefined;
827 var component = undefined;
828
828
829 var contextComponents = _map[context];
829 var contextComponents = _map[context];
qml/Panel/Indicators/VisibleIndicators.qml+1
@@ -55,6 +55,7 @@ Item {
55 delegate: IndicatorDelegate {
55 delegate: IndicatorDelegate {
56 id: item
56 id: item
57 objectName: model.identifier + "-delegate"
57 objectName: model.identifier + "-delegate"
58+ identifier: model.identifier
58 Component.onCompleted: {
59 Component.onCompleted: {
59 for(var pName in indicatorProperties) {
60 for(var pName in indicatorProperties) {
60 if (item.hasOwnProperty(pName)) {
61 if (item.hasOwnProperty(pName)) {
qml/Panel/MenuContent.qml+6
@@ -123,6 +123,12 @@ Rectangle {
123 }
123 }
124 }
124 }
125
125
126+ Binding {
127+ target: loader.item
128+ property: "identifier"
129+ value: identifier
130+ }
131+
126 Binding {
132 Binding {
127 target: loader.item
133 target: loader.item
128 property: "objectName"
134 property: "objectName"
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml+3−23
@@ -29,14 +29,14 @@ Item {
29 id: page
29 id: page
30
30
31 anchors.fill: parent
31 anchors.fill: parent
32− contentActive: true
33
32
34 menuModel: UnityMenuModel {}
33 menuModel: UnityMenuModel {}
35 busName: "test"
34 busName: "test"
36 actionsObjectPath: "test"
35 actionsObjectPath: "test"
37 menuObjectPath: "test"
36 menuObjectPath: "test"
38
37
38+ identifier: "test-indicator"
39− rootMenuType: ""
39+ rootMenuType: "com.canonical.indicator.root"
40 }
40 }
41
41
42 property var fullMenuData: [{
42 property var fullMenuData: [{
@@ -117,13 +117,8 @@ Item {
117 name: "DefaultIndicatorPage"
117 name: "DefaultIndicatorPage"
118
118
119 function init() {
119 function init() {
120− page.stop();
121 var mainMenu = findChild(page, "mainMenu");
120 var mainMenu = findChild(page, "mainMenu");
122− verify(mainMenu.model === undefined);
121+ page.menuModel.modelData = [];
123−
124− page.rootMenuType = "com.canonical.indicator.root";
125− page.start();
126−
127 verify(mainMenu.model !== null);
122 verify(mainMenu.model !== null);
128 }
123 }
129
124
@@ -157,20 +152,5 @@ Item {
157 var mainMenu = findChild(page, "mainMenu");
152 var mainMenu = findChild(page, "mainMenu");
158 tryCompare(mainMenu, "count", data.expectedCount);
153 tryCompare(mainMenu, "count", data.expectedCount);
159 }
154 }
160−
161− function test_empty_data() {
162− return [
163− { tag: "EmptyNoData", modelData: [], visible: true},
164− { tag: "EmptySubmenu", modelData: emptySubMenuData, visible: true},
165− { tag: "NotEmpty", modelData: fullMenuData, visible: false},
166− ]
167− }
168−
169− function test_empty(data) {
170− page.menuModel.modelData = data.modelData;
171−
172− var emptyLabel = findChild(page, "emptyLabel");
173− tryCompare(emptyLabel, "visible", data.visible);
174− }
175 }
155 }
176}
156}