@@ -299,6 +299,20 @@ Rectangle {
299 compare (repeater.itemAt(3).expanded, false);
299 compare (repeater.itemAt(3).expanded, false);
302+ function waitForLazyImage(obj)
304+ if (UT.Util.isInstanceOf(obj, "LazyImage")) {
305+ tryCompareFunction(function() { return obj.state != "default" && obj.state != "loading"; }, true);
306+ for (var i in obj.transitions) {
307+ tryCompare(obj.transitions[i], "running", false);
311+ for (var i in obj.data) {
312+ waitForLazyImage(obj.data[i]);
302 function test_all_widgets_height() {
316 function test_all_widgets_height() {
303 previewExpandable.widgetData = allWidgetsData;
317 previewExpandable.widgetData = allWidgetsData;
@@ -319,14 +333,19 @@ Rectangle {
319 previewWidgetFactory.widgetType = allWidgetsModel.get(i).type;
333 previewWidgetFactory.widgetType = allWidgetsModel.get(i).type;
320 previewWidgetFactory.active = true;
334 previewWidgetFactory.active = true;
322− // Wait for the height ot settle by waiting four times the time of the
336+ waitForRendering(repeater.itemAt(i));
323− // longest of the height behaviour animations
337+ waitForRendering(previewWidgetFactory);
324− wait(UbuntuAnimation.SnapDuration * 4);
338+
339+ waitForLazyImage(previewWidgetFactory);
340+ waitForLazyImage(repeater.itemAt(i));
342+ UT.Util.waitForBehaviors(previewWidgetFactory);
343+ UT.Util.waitForBehaviors(repeater.itemAt(i));
326 // Check the item inside the expandable has the same height
345 // Check the item inside the expandable has the same height
327 // as the one straight from the factory
346 // as the one straight from the factory
328 verify(repeater.itemAt(i).height > 0);
347 verify(repeater.itemAt(i).height > 0);
329− tryCompare(repeater.itemAt(i), "height", previewWidgetFactory.height);
348+ compare(repeater.itemAt(i).height, previewWidgetFactory.height);
332 mouseClick(expandButton);
351 mouseClick(expandButton);