on xenial help sign in
stabilize tests
commitfbcdf2e7676c71253bc60e2eafe065fca18a2cdf authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 29 Jul 2016, 20:29 (10 years ago) parent690362d
4 files changed+12−13
tests/mocks/Unity/Indicators/IndicatorsModel.qml+2−2 tests/qmltests/Panel/tst_IndicatorItemRow.qml+3−3 tests/qmltests/Panel/tst_IndicatorsBar.qml+3−5 tests/qmltests/Panel/tst_IndicatorsMenu.qml+4−3
tests/mocks/Unity/Indicators/IndicatorsModel.qml+2−2
@@ -99,12 +99,12 @@ Indicators.FakeIndicatorsModel {
9999
100100 Component.onCompleted: {
101101 // init data for the fake indicator-keyboard
102− MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
102+ MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
103103 AccountsService.keymaps = ["us", "cs"];
104104 }
105105
106106 Component.onDestruction: {
107− MockInputDeviceBackend.removeDevice("/kbd0");
107+ MockInputDeviceBackend.removeDevice("/indicator_kbd0");
108108 AccountsService.keymaps = ["us"];
109109 }
110110
tests/qmltests/Panel/tst_IndicatorItemRow.qml+3−3
@@ -196,7 +196,7 @@ IndicatorTest {
196196 verify(dataItem !== null);
197197
198198 indicatorsRow.selectItemAt(dataItem.x + dataItem.width/2);
199− compare(indicatorsRow.currentItem, dataItem);
199+ tryCompare(indicatorsRow, "currentItem", dataItem);
200200 }
201201
202202 // tests item default selection (no item at position X)
@@ -303,9 +303,9 @@ IndicatorTest {
303303 var item = findChild(indicatorsRow, "indicator-keyboard-panelItem");
304304 AccountsService.keymaps = data.keymaps;
305305 if (data.keyboard) {
306− MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
306+ MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
307307 } else {
308− MockInputDeviceBackend.removeDevice("/kbd0");
308+ MockInputDeviceBackend.removeDevice("/indicator_kbd0");
309309 }
310310
311311 compare(item.hidden, data.hidden);
tests/qmltests/Panel/tst_IndicatorsBar.qml+3−5
@@ -136,8 +136,7 @@ IndicatorTest {
136136 }
137137
138138 function wait_for_expansion_to_settle() {
139− tryCompare(heightAnimation, "running", false);
140− wait(UbuntuAnimation.SnapDuration); // put a little extra wait in for things to settle
139+ waitUntilTransitionsEnd(indicatorsBar);
141140 }
142141
143142 // Rough check that expanding a selected item keeps it within the area of the original item.
@@ -151,7 +150,6 @@ IndicatorTest {
151150 indicatorsBar.expanded = true;
152151 wait_for_expansion_to_settle();
153152
154−
155153 // mappedPosition contained within mappedRect
156154 tryCompareFunction(function() {
157155 var mappedRect = indicatorsBar.mapFromItem(dataItem, 0, 0, dataItem.width, dataItem.height);
@@ -203,8 +201,8 @@ IndicatorTest {
203201
204202 function test_visibleIndicators_data() {
205203 return [
206− { visible: [true, false, true, false, true, true] },
207− { visible: [false, false, false, false, false, false] }
204+ { visible: [true, false, true, false, true, true, false, true] },
205+ { visible: [false, false, false, false, false, false, true, false] }
208206 ];
209207 }
210208
tests/qmltests/Panel/tst_IndicatorsMenu.qml+4−3
@@ -219,8 +219,8 @@ IndicatorTest {
219219 mappedPosition.x, indicatorsMenu.openedHeight / 2,
220220 true /* beginTouch */, false /* endTouch */);
221221
222− compare(indicatorItemRow.currentItem, indicatorItem,
223− "Incorrect item activated at position " + i);
222+ tryCompare(indicatorItemRow, "currentItem", indicatorItem, undefined /*timeout, default */,
223+ "Incorrect item activated at position " + i);
224224
225225 touchFlick(indicatorItemRow,
226226 mappedPosition.x, indicatorsMenu.openedHeight / 2,
@@ -265,7 +265,8 @@ IndicatorTest {
265265 false /* beginTouch */, false /* endTouch */,
266266 units.gu(50) /* speed */, 5 /* iterations */); // more samples needed for accurate velocity
267267
268− compare(indicatorItemRow.currentItem, firstItem, "First indicator should still be the current item");
268+ tryCompare(indicatorItemRow, "currentItem", firstItem, undefined /* timeout, default */,
269+ "First indicator should still be the current item");
269270 // after waiting in the same spot with touch down, it should update to the next item.
270271 tryCompare(indicatorItemRow, "currentItem", nextItem);
271272