diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 17:37:40 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 17:37:40 (GMT) |
commit | 209c674c8b5012b6b6b42be90e5bd2bfe5fa38f8 (patch) | |
tree | ccf18da6b99486c38d5182c25f5da80e6974b144 /tests | |
parent | c72928c26118a3aa6491dba523da0594de8b48ba (diff) | |
parent | c17150344510fc5fe239e39e6659bd16579586e8 (diff) | |
download | Qt-209c674c8b5012b6b6b42be90e5bd2bfe5fa38f8.zip Qt-209c674c8b5012b6b6b42be90e5bd2bfe5fa38f8.tar.gz Qt-209c674c8b5012b6b6b42be90e5bd2bfe5fa38f8.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
ListView has wrong keyPressEvent behaviour when vertical
Ensure view is positioned correctly when orientation changes.
Fix regression in wigglytext.qml
Diffstat (limited to 'tests')
4 files changed, 97 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml new file mode 100644 index 0000000..aa384c3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml @@ -0,0 +1,25 @@ +import QtQuick 1.0 + +Rectangle { + id: container + + width: 400; height: 400; + property Item myItem + + function doCreate() { + myItem = myComponent.createObject(container) + myItem.x = 100 + } + + Component { + id: myComponent + Rectangle { + width: 100 + height: 100 + color: "green" + Behavior on x { NumberAnimation { duration: 500 } } + } + } + + Component.onCompleted: doCreate() +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 80ba907..4536d9e 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -81,6 +81,7 @@ private slots: void groupedPropertyCrash(); void runningTrue(); void sameValue(); + void delayedRegistration(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -412,6 +413,23 @@ void tst_qdeclarativebehaviors::sameValue() QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100)); } +//QTBUG-18362 +void tst_qdeclarativebehaviors::delayedRegistration() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *innerRect = rect->property("myItem").value<QDeclarativeItem*>(); + QVERIFY(innerRect != 0); + + QCOMPARE(innerRect->property("x").toInt(), int(0)); + + QTRY_COMPARE(innerRect->property("x").toInt(), int(100)); +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" diff --git a/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml new file mode 100644 index 0000000..c7aa0cd --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/orientchange.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +ListView { + width: 240; height: 320 + delegate: Rectangle { objectName: "wrapper"; width: 80; height: 80 } + model: 100 +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 2267a89..ec60e8a 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -119,6 +119,7 @@ private slots: void testQtQuick11Attributes_data(); void rightToLeft(); void test_mirroring(); + void orientationChange(); private: template <class T> void items(); @@ -2583,6 +2584,52 @@ void tst_QDeclarativeListView::test_mirroring() delete canvasB; } +void tst_QDeclarativeListView::orientationChange() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/orientchange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + listview->positionViewAtIndex(50, QDeclarativeListView::Beginning); + + // Confirm items positioned correctly + for (int i = 50; i < 54; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), i*80.0); + } + + listview->setOrientation(QDeclarativeListView::Horizontal); + QCOMPARE(listview->contentY(), 0.); + + // Confirm items positioned correctly + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->x(), i*80.0); + } + + listview->positionViewAtIndex(50, QDeclarativeListView::Beginning); + listview->setOrientation(QDeclarativeListView::Vertical); + QCOMPARE(listview->contentX(), 0.); + // + // Confirm items positioned correctly + for (int i = 0; i < 4; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), i*80.0); + } + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); |