on xenial help sign in
fixed up broken tests and warnings from polishing branch
commit0def85344194599b50e6f77e07356c821670bebb authorNick Dedekind <nick.dedekind@canonical.com> dateMon 29 Sep 2014, 11:24 (12 years ago) parent843a993
7 files changed+19−25
qml/Panel/IndicatorItem.qml+6 qml/Panel/Indicators/DefaultIndicatorPage.qml+1−1 qml/Panel/Indicators/IndicatorBase.qml+1 qml/Panel/Indicators/MenuItemFactory.qml+1−1 qml/Panel/Indicators/VisibleIndicators.qml+1 qml/Panel/MenuContent.qml+6 tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml+3−23
qml/Panel/IndicatorItem.qml+6
@@ -39,6 +39,12 @@ Loader {
3939 }
4040 }
4141
42+ Binding {
43+ target: item
44+ property: "identifier"
45+ value: identifier
46+ }
47+
4248 Binding {
4349 target: item
4450 property: "objectName"
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−1
@@ -130,7 +130,7 @@ IndicatorBase {
130130 visible: status == Loader.Ready
131131
132132 property int modelIndex: index
133− sourceComponent: factory.load(model, identifier)
133+ sourceComponent: factory.load(model, main.identifier)
134134
135135 onLoaded: {
136136 if (item.hasOwnProperty("selected")) {
qml/Panel/Indicators/IndicatorBase.qml+1
@@ -26,6 +26,7 @@ Item {
2626 enabled: menuObjectPath != ""
2727
2828 //const
29+ property string identifier
2930 property string busName
3031 property string actionsObjectPath
3132 property string menuObjectPath
qml/Panel/Indicators/MenuItemFactory.qml+1−1
@@ -823,7 +823,7 @@ Item {
823823 }
824824
825825 function load(modelData, context) {
826− if (modelData.type !== undefined) {
826+ if (modelData.type !== undefined && modelData.type !== "") {
827827 var component = undefined;
828828
829829 var contextComponents = _map[context];
qml/Panel/Indicators/VisibleIndicators.qml+1
@@ -55,6 +55,7 @@ Item {
5555 delegate: IndicatorDelegate {
5656 id: item
5757 objectName: model.identifier + "-delegate"
58+ identifier: model.identifier
5859 Component.onCompleted: {
5960 for(var pName in indicatorProperties) {
6061 if (item.hasOwnProperty(pName)) {
qml/Panel/MenuContent.qml+6
@@ -123,6 +123,12 @@ Rectangle {
123123 }
124124 }
125125
126+ Binding {
127+ target: loader.item
128+ property: "identifier"
129+ value: identifier
130+ }
131+
126132 Binding {
127133 target: loader.item
128134 property: "objectName"
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml+3−23
@@ -29,14 +29,14 @@ Item {
2929 id: page
3030
3131 anchors.fill: parent
32− contentActive: true
3332
3433 menuModel: UnityMenuModel {}
3534 busName: "test"
3635 actionsObjectPath: "test"
3736 menuObjectPath: "test"
3837
39− rootMenuType: ""
38+ identifier: "test-indicator"
39+ rootMenuType: "com.canonical.indicator.root"
4040 }
4141
4242 property var fullMenuData: [{
@@ -117,13 +117,8 @@ Item {
117117 name: "DefaultIndicatorPage"
118118
119119 function init() {
120− page.stop();
121120 var mainMenu = findChild(page, "mainMenu");
122− verify(mainMenu.model === undefined);
123−
124− page.rootMenuType = "com.canonical.indicator.root";
125− page.start();
126−
121+ page.menuModel.modelData = [];
127122 verify(mainMenu.model !== null);
128123 }
129124
@@ -157,20 +152,5 @@ Item {
157152 var mainMenu = findChild(page, "mainMenu");
158153 tryCompare(mainMenu, "count", data.expectedCount);
159154 }
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− }
175155 }
176156}