summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-09 08:48:13 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-09 08:48:13 (GMT)
commit782700705a1a2625509b73910b667ee91f23a74a (patch)
tree026df74a339b9766e0e6724301a59150029e1366 /tests/auto/declarative
parentf4bb7d6a17a9106af681fba8be4c734e374ff167 (diff)
downloadQt-782700705a1a2625509b73910b667ee91f23a74a.zip
Qt-782700705a1a2625509b73910b667ee91f23a74a.tar.gz
Qt-782700705a1a2625509b73910b667ee91f23a74a.tar.bz2
Fix layouts test
Turns out I misinterpreted QGraphicsLinearLayout's behaviour. Task-number: QT-2472
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/layouts/data/layouts.qml3
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp20
2 files changed, 13 insertions, 10 deletions
diff --git a/tests/auto/declarative/layouts/data/layouts.qml b/tests/auto/declarative/layouts/data/layouts.qml
index ccc8cfe..b0ee63b 100644
--- a/tests/auto/declarative/layouts/data/layouts.qml
+++ b/tests/auto/declarative/layouts/data/layouts.qml
@@ -7,10 +7,9 @@ Item {
GraphicsObjectContainer {
anchors.fill:parent
+ synchronizedResizing: true
QGraphicsWidget {
- size.width:parent.width
- size.height:parent.height
layout: QGraphicsLinearLayout {
spacing: 0
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index f619b57..1c2330d 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -68,10 +68,10 @@ void tst_QmlGraphicsLayouts::test_qml()
canvas->execute();
qApp->processEvents();
- QmlGraphicsLayoutItem *left = qobject_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("left"));
+ QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("left"));
QVERIFY(left != 0);
- QmlGraphicsLayoutItem *right = qobject_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("right"));
+ QmlGraphicsLayoutItem *right = static_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("right"));
QVERIFY(right != 0);
qreal gvMargin = 9.0;
@@ -101,17 +101,21 @@ void tst_QmlGraphicsLayouts::test_qml()
QCOMPARE(right->width(), 100.0);
QCOMPARE(right->height(), 100.0);
- //Maximum Size
- canvas->root()->setWidth(1000 + 2*gvMargin);
- canvas->root()->setHeight(1000 + 2*gvMargin);
+ //Between preferred and Maximum Size
+ /*Note that if set to maximum size (or above) GraphicsLinearLayout behavior
+ is to shrink them down to preferred size. So the exact maximum size can't
+ be used*/
+ canvas->root()->setWidth(670 + 2*gvMargin);
+ canvas->root()->setHeight(300 + 2*gvMargin);
QCOMPARE(left->x(), gvMargin);
- QCOMPARE(left->width(), 300.0);
+ QCOMPARE(left->width(), 270.0);
QCOMPARE(left->height(), 300.0);
- QCOMPARE(right->x(), 300.0 + gvMargin);
+ QCOMPARE(right->x(), 270.0 + gvMargin);
QCOMPARE(right->width(), 400.0);
- QCOMPARE(right->height(), 400.0);
+ QCOMPARE(right->height(), 300.0);
+
}
void tst_QmlGraphicsLayouts::test_cpp()