diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-09-09 05:01:35 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-09-09 05:01:35 (GMT) |
commit | d2f5a32ff6c06e6a1cad9772f89d4b042eb0c9ef (patch) | |
tree | f6bb54d58d5a97f62f2462a185974a75b1d4e36e /tests/auto/declarative/layouts | |
parent | a9f368a5e61d1e2a73010353e66810a9b3bf7157 (diff) | |
download | Qt-d2f5a32ff6c06e6a1cad9772f89d4b042eb0c9ef.zip Qt-d2f5a32ff6c06e6a1cad9772f89d4b042eb0c9ef.tar.gz Qt-d2f5a32ff6c06e6a1cad9772f89d4b042eb0c9ef.tar.bz2 |
Fix up some of the tests
Update to work with the latest changes, like 'import Qt 4.6'.
Tests affected:
DateTimeFormatter
Layouts (Positioners)
ListView (Still not passing)
Diffstat (limited to 'tests/auto/declarative/layouts')
-rw-r--r-- | tests/auto/declarative/layouts/data/grid-spacing.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/grid.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/horizontal-spacing.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/horizontal.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/vertical-spacing.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/vertical.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/tst_layouts.cpp | 76 |
7 files changed, 66 insertions, 98 deletions
diff --git a/tests/auto/declarative/layouts/data/grid-spacing.qml b/tests/auto/declarative/layouts/data/grid-spacing.qml index f9ae204..5b4a30d 100644 --- a/tests/auto/declarative/layouts/data/grid-spacing.qml +++ b/tests/auto/declarative/layouts/data/grid-spacing.qml @@ -6,32 +6,32 @@ Item { Grid { columns: 3 spacing: 4 - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "green" width: 20 height: 50 } - Rect { - id: three + Rectangle { + objectName: "three" color: "blue" width: 50 height: 20 } - Rect { - id: four + Rectangle { + objectName: "four" color: "cyan" width: 50 height: 50 } - Rect { - id: five + Rectangle { + objectName: "five" color: "magenta" width: 10 height: 10 diff --git a/tests/auto/declarative/layouts/data/grid.qml b/tests/auto/declarative/layouts/data/grid.qml index 3861f63..830df6a 100644 --- a/tests/auto/declarative/layouts/data/grid.qml +++ b/tests/auto/declarative/layouts/data/grid.qml @@ -5,32 +5,32 @@ Item { height: 480 Grid { columns: 3 - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "green" width: 20 height: 50 } - Rect { - id: three + Rectangle { + objectName: "three" color: "blue" width: 50 height: 20 } - Rect { - id: four + Rectangle { + objectName: "four" color: "cyan" width: 50 height: 50 } - Rect { - id: five + Rectangle { + objectName: "five" color: "magenta" width: 10 height: 10 diff --git a/tests/auto/declarative/layouts/data/horizontal-spacing.qml b/tests/auto/declarative/layouts/data/horizontal-spacing.qml index 8594ee6..32bf775 100644 --- a/tests/auto/declarative/layouts/data/horizontal-spacing.qml +++ b/tests/auto/declarative/layouts/data/horizontal-spacing.qml @@ -5,20 +5,20 @@ Item { height: 480 Row { spacing: 10 - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "red" width: 20 height: 10 } - Rect { - id: three + Rectangle { + objectName: "three" color: "red" width: 40 height: 20 diff --git a/tests/auto/declarative/layouts/data/horizontal.qml b/tests/auto/declarative/layouts/data/horizontal.qml index 673e77e..06ae151 100644 --- a/tests/auto/declarative/layouts/data/horizontal.qml +++ b/tests/auto/declarative/layouts/data/horizontal.qml @@ -4,20 +4,20 @@ Item { width: 640 height: 480 Row { - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "red" width: 20 height: 10 } - Rect { - id: three + Rectangle { + objectName: "three" color: "red" width: 40 height: 20 diff --git a/tests/auto/declarative/layouts/data/vertical-spacing.qml b/tests/auto/declarative/layouts/data/vertical-spacing.qml index 49bd8c6..69a8256 100644 --- a/tests/auto/declarative/layouts/data/vertical-spacing.qml +++ b/tests/auto/declarative/layouts/data/vertical-spacing.qml @@ -5,20 +5,20 @@ Item { height: 480 Column { spacing: 10 - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "red" width: 20 height: 10 } - Rect { - id: three + Rectangle { + objectName: "three" color: "red" width: 40 height: 20 diff --git a/tests/auto/declarative/layouts/data/vertical.qml b/tests/auto/declarative/layouts/data/vertical.qml index c8d3a11..856c180 100644 --- a/tests/auto/declarative/layouts/data/vertical.qml +++ b/tests/auto/declarative/layouts/data/vertical.qml @@ -4,20 +4,20 @@ Item { width: 640 height: 480 Column { - Rect { - id: one + Rectangle { + objectName: "one" color: "red" width: 50 height: 50 } - Rect { - id: two + Rectangle { + objectName: "two" color: "red" width: 20 height: 10 } - Rect { - id: three + Rectangle { + objectName: "three" color: "red" width: 40 height: 20 diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index cd4678e..3416b2e 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -20,8 +20,6 @@ private slots: private: QFxView *createView(const QString &filename); - template<typename T> - T *findItem(QFxItem *parent, const QString &id, int index=-1); }; tst_QFxLayouts::tst_QFxLayouts() @@ -35,13 +33,13 @@ void tst_QFxLayouts::test_horizontal() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -59,13 +57,13 @@ void tst_QFxLayouts::test_horizontal_spacing() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -83,13 +81,13 @@ void tst_QFxLayouts::test_vertical() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -107,13 +105,13 @@ void tst_QFxLayouts::test_vertical_spacing() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -131,15 +129,15 @@ void tst_QFxLayouts::test_grid() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); - QFxRect *four = findItem<QFxRect>(canvas->root(), "four"); + QFxRect *four = canvas->root()->findChild<QFxRect*>("four"); QVERIFY(four != 0); - QFxRect *five = findItem<QFxRect>(canvas->root(), "five"); + QFxRect *five = canvas->root()->findChild<QFxRect*>("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); @@ -161,15 +159,15 @@ void tst_QFxLayouts::test_grid_spacing() canvas->execute(); qApp->processEvents(); - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); + QFxRect *one = canvas->root()->findChild<QFxRect*>("one"); QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); + QFxRect *two = canvas->root()->findChild<QFxRect*>("two"); QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); + QFxRect *three = canvas->root()->findChild<QFxRect*>("three"); QVERIFY(three != 0); - QFxRect *four = findItem<QFxRect>(canvas->root(), "four"); + QFxRect *four = canvas->root()->findChild<QFxRect*>("four"); QVERIFY(four != 0); - QFxRect *five = findItem<QFxRect>(canvas->root(), "five"); + QFxRect *five = canvas->root()->findChild<QFxRect*>("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); @@ -196,36 +194,6 @@ QFxView *tst_QFxLayouts::createView(const QString &filename) return canvas; } -/* - Find an item with the specified objectName. If index is supplied then the - item must also evaluate the {index} expression equal to index -*/ -template<typename T> -T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &objectName, int index) -{ - const QMetaObject &mo = T::staticMetaObject; - for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) { - QFxItem *item = qobject_cast<QFxItem*>(parent->QGraphicsObject::children().at(i)); - if(!item) - continue; - //qDebug() << item << item->objectName(); - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - if (index != -1) { - QmlExpression e(qmlContext(item), "index", item); - e.setTrackChange(false); - if (e.value().toInt() == index) - return static_cast<T*>(item); - } else { - return static_cast<T*>(item); - } - } - item = findItem<T>(item, objectName, index); - if (item) - return static_cast<T*>(item); - } - - return 0; -} QTEST_MAIN(tst_QFxLayouts) |