on xenial help sign in
fixup failing tests
commit9f83b28b0ff277afc57d9ae2af3f0b6af5c94252 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 13 Jul 2016, 23:16 (10 years ago) parent6ea7fad
3 files changed+16−6
qml/Panel/IndicatorItemRow.qml−1 tests/mocks/Unity/Indicators/IndicatorsModel.qml+13 tests/qmltests/Panel/tst_IndicatorItemRow.qml+3−5
qml/Panel/IndicatorItemRow.qml−1
@@ -199,7 +199,6 @@ Item {
199199 // HACK for indicator-keyboard
200200 readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || keyboardsModel.count == 0)
201201
202−
203202 height: row.height
204203 expanded: root.expanded
205204 selected: currentItem === this
tests/mocks/Unity/Indicators/IndicatorsModel.qml+13
@@ -16,6 +16,8 @@
1616
1717import QtQuick 2.4
1818import Unity.Indicators 0.1 as Indicators
19+import Unity.InputInfo 0.1
20+import AccountsService 0.1
1921
2022Indicators.FakeIndicatorsModel {
2123 id: root
@@ -95,6 +97,17 @@ Indicators.FakeIndicatorsModel {
9597 }
9698 ]
9799
100+ Component.onCompleted: {
101+ // init data for the fake indicator-keyboard
102+ MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
103+ AccountsService.keymaps = ["us", "cs"];
104+ }
105+
106+ Component.onDestruction: {
107+ MockInputDeviceBackend.removeDevice("/kbd0");
108+ AccountsService.keymaps = ["us"];
109+ }
110+
98111 function load(profile) {
99112 unload();
100113 root.modelData = originalModelData;
tests/qmltests/Panel/tst_IndicatorItemRow.qml+3−5
@@ -131,11 +131,6 @@ IndicatorTest {
131131 wait(1); // row seems to take a bit of time for item x values to update.
132132 }
133133
134− function cleanup() {
135− AccountsService.keymaps = [];
136− MockInputDeviceBackend.removeDevice("/kbd0");
137− }
138−
139134 function wait_for_expansion_to_settle() {
140135 tryCompare(heightAnimation, "running", false);
141136 wait(200); // put a little extra wait in for things to settle
@@ -309,7 +304,10 @@ IndicatorTest {
309304 AccountsService.keymaps = data.keymaps;
310305 if (data.keyboard) {
311306 MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
307+ } else {
308+ MockInputDeviceBackend.removeDevice("/kbd0");
312309 }
310+
313311 compare(item.hidden, data.hidden);
314312 }
315313 }