@@ -202,5 +202,32 @@ Rectangle {
202202 tryCompareFunction(function() { return sessionContainer.childSessions.count(); }, 0);
203203 tryCompare(sessionSpy, "count", data.depth);
204204 }
205+
206+ function test_childrenAdjustForParentSize() {
207+ sessionCheckbox.checked = true;
208+ var sessionContainer = sessionContainerLoader.item;
209+
210+ wait(2000);
211+
212+ var session = SessionManager.createSession(sessionContainer.session.name + "-Child0",
213+ Qt.resolvedUrl("../Dash/artwork/music-player-design.png"));
214+ session.createSurface();
215+ sessionContainer.session.addChildSession(session);
216+
217+ var delegate = findChild(sessionContainer, "childDelegate0");
218+ var childContainer = findChild(delegate, "sessionContainer");
219+
220+ tryCompareFunction(function() { return childContainer.height === sessionContainer.height; }, true);
221+ tryCompareFunction(function() { return childContainer.width === sessionContainer.width; }, true);
222+ tryCompareFunction(function() { return childContainer.x === 0; }, true);
223+ tryCompareFunction(function() { return childContainer.y === 0; }, true);
224+
225+ sessionContainer.anchors.margins = units.gu(2);
226+
227+ tryCompareFunction(function() { return childContainer.height === sessionContainer.height; }, true);
228+ tryCompareFunction(function() { return childContainer.width === sessionContainer.width; }, true);
229+ tryCompareFunction(function() { return childContainer.x === 0; }, true);
230+ tryCompareFunction(function() { return childContainer.y === 0; }, true);
231+ }
205232 }
206233}