diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 0a66245..4a57def 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -44,7 +44,8 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeview.h> -#include <QtDeclarative/qdeclarativeitem.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativeitem_p.h> #include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN @@ -73,6 +74,7 @@ private slots: void transforms_data(); void childrenRect(); void childrenRectBug(); + void childrenRectBug2(); void childrenProperty(); void resourcesProperty(); @@ -753,6 +755,29 @@ void tst_QDeclarativeItem::childrenRectBug() delete canvas; } +// QTBUG-11465 +void tst_QDeclarativeItem::childrenRectBug2() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml")); + canvas->show(); + + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(canvas->rootObject()); + QVERIFY(rect); + QDeclarativeItem *item = rect->findChild<QDeclarativeItem*>("theItem"); + QCOMPARE(item->width(), qreal(100)); + QCOMPARE(item->height(), qreal(110)); + QCOMPARE(item->x(), qreal(130)); + + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + rectPrivate->setState("row"); + QCOMPARE(item->width(), qreal(210)); + QCOMPARE(item->height(), qreal(50)); + QCOMPARE(item->x(), qreal(75)); + + delete canvas; +} + template<typename T> T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) { |