@@ -54,6 +54,11 @@ Rectangle {
5454 name: "Preview"
5555 when: windowShown
5656
57+ function init() {
58+ var widget = findChild(preview, "previewListRow0");
59+ widget.positionViewAtBeginning();
60+ }
61+
5762 function test_triggered() {
5863 waitForRendering(preview);
5964 var widget = findChild(preview, "widget-3");
@@ -102,5 +107,31 @@ Rectangle {
102107 return bottomLeft.y <= preview.height
103108 }, true);
104109 }
110+
111+ function test_comboEnsureVisible() {
112+ waitForRendering(preview);
113+
114+ // Scroll down
115+ var previewListRow0 = findChild(preview, "previewListRow0");
116+ touchFlick(preview, preview.width / 2, units.gu(20), preview.width / 2, units.gu(1));
117+ tryCompare(previewListRow0, "atYEnd", true);
118+ tryCompare(previewListRow0, "moving", false);
119+
120+ // Click on the combo
121+ var widget = findChild(preview, "widget-21");
122+ var initialWidgetHeight = widget.height;
123+ var moreLessButton = findChild(widget, "moreLessButton");
124+ mouseClick(moreLessButton);
125+
126+ // Make sure the combo is growing
127+ tryCompareFunction(function () { return widget.height > 2 * initialWidgetHeight; }, true);
128+
129+ // Wait for the combo to stop growing
130+ tryCompareFunction(function () { var currentWidgetHeight = widget.height; wait(200); return currentWidgetHeight === widget.height;}, true);
131+
132+ // Make sure the combo bottom is on the viewport
133+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
134+ verify(bottomLeft.y <= preview.height);
135+ }
105136 }
106137}