From 00dbc026d3b7f079920c9eeb8f2773d6c5d83fa3 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 23 Sep 2009 13:45:42 +1000 Subject: Failing autotest for Repeater bug --- tests/auto/declarative/repeater/data/repeater.qml | 6 +++++ tests/auto/declarative/repeater/repeater.pro | 1 + tests/auto/declarative/repeater/tst_repeater.cpp | 30 +++++++++++++++++++---- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/auto/declarative/repeater/data/repeater.qml b/tests/auto/declarative/repeater/data/repeater.qml index 57ba9dc..7d83230 100644 --- a/tests/auto/declarative/repeater/data/repeater.qml +++ b/tests/auto/declarative/repeater/data/repeater.qml @@ -6,6 +6,9 @@ Rectangle { width: 240 height: 320 color: "white" + Text { + text: "Zero" + } Repeater { id: repeater objectName: "repeater" @@ -19,4 +22,7 @@ Rectangle { } } } + Text { + text: "Last" + } } diff --git a/tests/auto/declarative/repeater/repeater.pro b/tests/auto/declarative/repeater/repeater.pro index 0ecd7ee..1d30b7b 100644 --- a/tests/auto/declarative/repeater/repeater.pro +++ b/tests/auto/declarative/repeater/repeater.pro @@ -1,6 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_repeater.cpp +macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp index 5fce70e..1bb746b 100644 --- a/tests/auto/declarative/repeater/tst_repeater.cpp +++ b/tests/auto/declarative/repeater/tst_repeater.cpp @@ -24,6 +24,11 @@ tst_QFxRepeater::tst_QFxRepeater() { } +/* +The Repeater element creates children at its own position in its parent's +stacking order. In this test we insert a repeater between two other Text +elements to test this. +*/ void tst_QFxRepeater::stringList() { QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); @@ -46,12 +51,27 @@ void tst_QFxRepeater::stringList() QFxItem *container = findItem(canvas->root(), "container"); QVERIFY(container != 0); - QCOMPARE(container->childItems().count(), data.count() + 1); + QCOMPARE(container->childItems().count(), data.count() + 3); + + for (int i = 0; i < container->childItems().count(); ++i) { + + if (i == 0) { + QFxText *name = qobject_cast(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), QLatin1String("Zero")); + } else if (i == 1) { + // The repeater itself + continue; + } else if (i == container->childItems().count() - 1) { + QFxText *name = qobject_cast(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), QLatin1String("Last")); + } else { + QFxText *name = qobject_cast(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), data.at(i-2)); + } - for (int i = 1; i < container->childItems().count(); ++i) { - QFxText *name = qobject_cast(container->childItems().at(i)); - QVERIFY(name != 0); - QCOMPARE(name->text(), data.at(i-1)); } delete canvas; -- cgit v0.12