@@ -299,6 +299,20 @@ Rectangle {
299299 compare (repeater.itemAt(3).expanded, false);
300300 }
301301
302+ function waitForLazyImage(obj)
303+ {
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);
308+ }
309+ }
310+
311+ for (var i in obj.data) {
312+ waitForLazyImage(obj.data[i]);
313+ }
314+ }
315+
302316 function test_all_widgets_height() {
303317 previewExpandable.widgetData = allWidgetsData;
304318
@@ -319,14 +333,19 @@ Rectangle {
319333 previewWidgetFactory.widgetType = allWidgetsModel.get(i).type;
320334 previewWidgetFactory.active = true;
321335
322− // Wait for the height ot settle by waiting four times the time of the
323− // longest of the height behaviour animations
324− wait(UbuntuAnimation.SnapDuration * 4);
336+ waitForRendering(repeater.itemAt(i));
337+ waitForRendering(previewWidgetFactory);
338+
339+ waitForLazyImage(previewWidgetFactory);
340+ waitForLazyImage(repeater.itemAt(i));
341+
342+ UT.Util.waitForBehaviors(previewWidgetFactory);
343+ UT.Util.waitForBehaviors(repeater.itemAt(i));
325344
326345 // Check the item inside the expandable has the same height
327346 // as the one straight from the factory
328347 verify(repeater.itemAt(i).height > 0);
329− tryCompare(repeater.itemAt(i), "height", previewWidgetFactory.height);
348+ compare(repeater.itemAt(i).height, previewWidgetFactory.height);
330349 }
331350
332351 mouseClick(expandButton);