on xenial help sign in
Fix tst_Preview.qml

commit7a7a179092af883b864e6d6a69dca3f377d5652d authorAlbert Astals <albert.astals@canonical.com> dateWed 12 Feb 2014, 15:14 (13 years ago) parent711c693c92143a
2 files changed+15−6
qml/Dash/Previews/Preview.qml+1 tests/qmltests/Dash/Previews/tst_Preview.qml+14−6
qml/Dash/Previews/Preview.qml+1
@@ -71,6 +71,7 @@ Item {
7171 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
7272
7373 model: previewModel
74+ cacheBuffer: units.gu(40)
7475
7576 Behavior on contentY { UbuntuNumberAnimation { } }
7677
tests/qmltests/Dash/Previews/tst_Preview.qml+14−6
@@ -87,21 +87,29 @@ Rectangle {
8787
8888 function test_containOnFocus() {
8989 waitForRendering(preview);
90− var widget = findChild(preview, "widget-13");
91−
92− widget.forceActiveFocus();
90+ tryCompareFunction(function () { return findChild(preview, "widget-9") != null }, true);
91+ var widget = findChild(preview, "widget-9");
9392
9493 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
94+ verify(bottomLeft.y > preview.height);
9595
96− tryCompareFunction(function () { return bottomLeft.y <= preview.height }, true);
96+ widget.forceActiveFocus();
97+
98+ tryCompareFunction(function () {
99+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
100+ return bottomLeft.y <= preview.height
101+ }, true);
97102 }
98103
99104 function test_containOnGrow() {
100105 waitForRendering(preview);
106+ tryCompareFunction(function () { return findChild(preview, "widget-13") != null }, true);
101107 var widget = findChild(preview, "widget-13");
102108
103− widget.forceActiveFocus();
104− widget.height += 200;
109+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
110+ verify(bottomLeft.y > preview.height);
111+
112+ root.height += units.gu(50);
105113
106114 tryCompareFunction(function () {
107115 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);