diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-16 05:17:27 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-16 05:17:27 (GMT) |
commit | 7fcc1daf1762d345ca39f9599a8de2567bb8e788 (patch) | |
tree | 7d1fee938d2466c2f0776eb6ab7ecb160d64d7d7 /tests | |
parent | 8ae7f9508a94e37ceddd4c2b1b94dc43ff039cf3 (diff) | |
download | Qt-7fcc1daf1762d345ca39f9599a8de2567bb8e788.zip Qt-7fcc1daf1762d345ca39f9599a8de2567bb8e788.tar.gz Qt-7fcc1daf1762d345ca39f9599a8de2567bb8e788.tar.bz2 |
More positioners with QGraphicsWidgets fixes.
Task-number: QTBUG-12416
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 0663991..887be50 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -46,6 +46,7 @@ #include <private/qdeclarativepositioners_p.h> #include <private/qdeclarativetransition_p.h> #include <qdeclarativeexpression.h> +#include <QtGui/qgraphicswidget.h> #include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN @@ -77,6 +78,7 @@ private slots: void test_flow_resize(); void test_flow_implicit_resize(); void test_conflictinganchors(); + void test_vertical_qgraphicswidget(); private: QDeclarativeView *createView(const QString &filename); }; @@ -771,6 +773,48 @@ void tst_QDeclarativePositioners::test_conflictinganchors() QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); } +void tst_QDeclarativePositioners::test_vertical_qgraphicswidget() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/verticalqgraphicswidget.qml"); + + QGraphicsWidget *one = canvas->rootObject()->findChild<QGraphicsWidget*>("one"); + QVERIFY(one != 0); + + QGraphicsWidget *two = canvas->rootObject()->findChild<QGraphicsWidget*>("two"); + QVERIFY(two != 0); + + QGraphicsWidget *three = canvas->rootObject()->findChild<QGraphicsWidget*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 60.0); + + QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); + QVERIFY(column); + QCOMPARE(column->height(), 80.0); + QCOMPARE(column->width(), 50.0); + + two->resize(QSizeF(two->size().width(), 20.0)); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 70.0); + + two->setOpacity(0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 50.0); + + one->setVisible(false); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 0.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) { QDeclarativeView *canvas = new QDeclarativeView(0); |