diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-08 10:00:18 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-08 10:00:18 (GMT) |
commit | 136daef2ff117698c6788655bcd75e046ec84753 (patch) | |
tree | 99305b44b9820278e14ed9edcb513c2616ff9d2c /tests | |
parent | 0fcc46e34c7feedfa1758ead64b09be59813f7d1 (diff) | |
parent | db531c30eb73ff7aeac9cf07b06d6a108b2c13ec (diff) | |
download | Qt-136daef2ff117698c6788655bcd75e046ec84753.zip Qt-136daef2ff117698c6788655bcd75e046ec84753.tar.gz Qt-136daef2ff117698c6788655bcd75e046ec84753.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui-scriptopt
Diffstat (limited to 'tests')
18 files changed, 277 insertions, 136 deletions
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml index 122d440..377dd2d 100644 --- a/tests/auto/declarative/anchors/data/anchors.qml +++ b/tests/auto/declarative/anchors/data/anchors.qml @@ -1,116 +1,116 @@ import Qt 4.6 -Rect { +Rectangle { color: "white" width: 240 height: 320 - Rect { id: MasterRect; x: 26; width: 96; height: 20; color: "red" } - Rect { - id: Rect1 + Rectangle { id: MasterRect; objectName: "MasterRect"; x: 26; width: 96; height: 20; color: "red" } + Rectangle { + id: Rect1; objectName: "Rect1" y: 20; width: 10; height: 10 anchors.left: MasterRect.left } - Rect { - id: Rect2 + Rectangle { + id: Rect2; objectName: "Rect2" y: 20; width: 10; height: 10 anchors.left: MasterRect.right } - Rect { - id: Rect3 + Rectangle { + id: Rect3; objectName: "Rect3" y: 20; width: 10; height: 10 anchors.left: MasterRect.horizontalCenter } - Rect { - id: Rect4 + Rectangle { + id: Rect4; objectName: "Rect4" y: 30; width: 10; height: 10 anchors.right: MasterRect.left } - Rect { - id: Rect5 + Rectangle { + id: Rect5; objectName: "Rect5" y: 30; width: 10; height: 10 anchors.right: MasterRect.right } - Rect { - id: Rect6 + Rectangle { + id: Rect6; objectName: "Rect6" y: 30; width: 10; height: 10 anchors.right: MasterRect.horizontalCenter } - Rect { - id: Rect7 + Rectangle { + id: Rect7; objectName: "Rect7" y: 50; width: 10; height: 10 anchors.left: parent.left } - Rect { - id: Rect8 + Rectangle { + id: Rect8; objectName: "Rect8" y: 50; width: 10; height: 10 anchors.left: parent.right } - Rect { - id: Rect9 + Rectangle { + id: Rect9; objectName: "Rect9" y: 50; width: 10; height: 10 anchors.left: parent.horizontalCenter } - Rect { - id: Rect10 + Rectangle { + id: Rect10; objectName: "Rect10" y: 60; width: 10; height: 10 anchors.right: parent.left } - Rect { - id: Rect11 + Rectangle { + id: Rect11; objectName: "Rect11" y: 60; width: 10; height: 10 anchors.right: parent.right } - Rect { - id: Rect12 + Rectangle { + id: Rect12; objectName: "Rect12" y: 60; width: 10; height: 10 anchors.right: parent.horizontalCenter } - Rect { - id: Rect13 + Rectangle { + id: Rect13; objectName: "Rect13" x: 200; width: 10; height: 10 anchors.top: MasterRect.bottom } - Rect { - id: Rect14 + Rectangle { + id: Rect14; objectName: "Rect14" width: 10; height: 10; color: "steelblue" anchors.verticalCenter: parent.verticalCenter } - Rect { - id: Rect15 + Rectangle { + id: Rect15; objectName: "Rect15" y: 200; height: 10 anchors.left: MasterRect.left anchors.right: MasterRect.right } - Rect { - id: Rect16 + Rectangle { + id: Rect16; objectName: "Rect16" y: 220; height: 10 anchors.left: MasterRect.left anchors.horizontalCenter: MasterRect.right } - Rect { - id: Rect17 + Rectangle { + id: Rect17; objectName: "Rect17" y: 240; height: 10 anchors.right: MasterRect.right anchors.horizontalCenter: MasterRect.left } - Rect { - id: Rect18 + Rectangle { + id: Rect18; objectName: "Rect18" x: 180; width: 10 anchors.top: MasterRect.bottom anchors.bottom: Rect12.top } - Rect { - id: Rect19 + Rectangle { + id: Rect19; objectName: "Rect19" y: 70; width: 10; height: 10 anchors.horizontalCenter: parent.horizontalCenter } - Rect { - id: Rect20 + Rectangle { + id: Rect20; objectName: "Rect20" y: 70; width: 10; height: 10 anchors.horizontalCenter: parent.right } - Rect { - id: Rect21 + Rectangle { + id: Rect21; objectName: "Rect21" y: 70; width: 10; height: 10 anchors.horizontalCenter: parent.left } diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml index 1d23110..0a960d0 100644 --- a/tests/auto/declarative/anchors/data/illegal1.qml +++ b/tests/auto/declarative/anchors/data/illegal1.qml @@ -1,10 +1,10 @@ import Qt 4.6 -Rect { +Rectangle { id: rect width: 120; height: 200; color: "white" - Rect { id: TheRect; width: 100; height: 100 } - Rect { + Rectangle { id: TheRect; width: 100; height: 100 } + Rectangle { anchors.left: TheRect.left anchors.right: TheRect.right anchors.horizontalCenter: TheRect.horizontalCenter diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml index 9f81b91..2497738 100644 --- a/tests/auto/declarative/anchors/data/illegal2.qml +++ b/tests/auto/declarative/anchors/data/illegal2.qml @@ -1,6 +1,6 @@ import Qt 4.6 -Rect { +Rectangle { id: rect width: 120; height: 200; color: "white" Text { id: Text1; text: "Hello" } diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml index 4f07456..27b2e4d 100644 --- a/tests/auto/declarative/anchors/data/illegal3.qml +++ b/tests/auto/declarative/anchors/data/illegal3.qml @@ -1,12 +1,12 @@ import Qt 4.6 -Rect { +Rectangle { id: rect width: 120; height: 200; color: "white" Item { - Rect { id: TheRect; width: 100; height: 100 } + Rectangle { id: TheRect; width: 100; height: 100 } } - Rect { + Rectangle { anchors.left: TheRect.left } } diff --git a/tests/auto/declarative/anchors/data/loop1.qml b/tests/auto/declarative/anchors/data/loop1.qml index adc5a10..ef6b63d 100644 --- a/tests/auto/declarative/anchors/data/loop1.qml +++ b/tests/auto/declarative/anchors/data/loop1.qml @@ -1,6 +1,6 @@ import Qt 4.6 -Rect { +Rectangle { id: rect width: 120; height: 200; color: "white" Text { id: Text1; anchors.right: Text2.right; text: "Hello" } diff --git a/tests/auto/declarative/anchors/data/loop2.qml b/tests/auto/declarative/anchors/data/loop2.qml index a6856f8..2445a15 100644 --- a/tests/auto/declarative/anchors/data/loop2.qml +++ b/tests/auto/declarative/anchors/data/loop2.qml @@ -1,6 +1,6 @@ import Qt 4.6 -Rect { +Rectangle { id: container; width: 600; height: 600; diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index a8b119c..38b7fe8 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -3,6 +3,8 @@ #include <QtDeclarative/qmlcomponent.h> #include <QtDeclarative/qmlview.h> #include <QtDeclarative/qfxrect.h> +#include <QtDeclarative/private/qfxanchors_p.h> + class tst_anchors : public QObject { @@ -28,14 +30,17 @@ template<typename T> T *tst_anchors::findItem(QFxItem *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; - for (int i = 0; i < parent->QSimpleCanvasItem::children().count(); ++i) { - QFxItem *item = qobject_cast<QFxItem*>(parent->QSimpleCanvasItem::children().at(i)); - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - return static_cast<T*>(item); + QList<QGraphicsItem *> children = parent->childItems(); + for (int i = 0; i < children.count(); ++i) { + QFxItem *item = qobject_cast<QFxItem *>(children.at(i)->toGraphicsObject()); + if (item) { + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + return static_cast<T*>(item); + } + item = findItem<T>(item, objectName); + if (item) + return static_cast<T*>(item); } - item = findItem<T>(item, objectName); - if (item) - return static_cast<T*>(item); } return 0; @@ -97,7 +102,10 @@ void tst_anchors::loops() view->setUrl(QUrl("file://" SRCDIR "/data/loop1.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Possible anchor loop detected on horizontal anchor. "); //x5 + QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Possible anchor loop detected on horizontal anchor. "; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -109,7 +117,8 @@ void tst_anchors::loops() view->setUrl(QUrl("file://" SRCDIR "/data/loop2.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QFxImage (unknown location): Possible anchor loop detected on horizontal anchor. "); //x3 + QString expect = "QML QFxImage (" + view->url().toString() + ":14:3" + ") Possible anchor loop detected on horizontal anchor. "; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -124,7 +133,8 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors. "); + QString expect = "QML QFxRect (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors. "; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -136,7 +146,8 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors. "); + QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors. "; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); //qApp->processEvents(); @@ -148,7 +159,8 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't anchor to an item that isn't a parent or sibling. "); + QString expect = "QML QFxRect (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling. "; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); //qApp->processEvents(); diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index f2ddbb7..eef9da7 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,24 +1,32 @@ TEMPLATE = subdirs -SUBDIRS += datetimeformatter \ - numberformatter \ - qbindablemap \ +SUBDIRS += anchors \ + animations \ + datetimeformatter \ layouts \ listview \ + numberformatter \ pathview \ + qbindablemap \ + qfxloader \ + qfxpixmapcache \ qfxtext \ qfxtextedit \ - repeater \ - qmllanguage \ + qfxtextinput \ + qfxwebview \ + qmldom \ qmlecmascript \ - qmlmetaproperty \ + qmllanguage \ qmllist \ qmllistaccessor \ + qmlmetaproperty \ qmltimer \ - qfxloader \ - qfxwebview \ + repeater \ + sql \ states \ visual +SUBDIRS -= examples # Human-interactive + # Tests which should run in Pulse PULSE_TESTS = $$SUBDIRS PULSE_TESTS -= visual # All except 'visual' tests, allegedly too flaky diff --git a/tests/auto/declarative/listview/data/listview.qml b/tests/auto/declarative/listview/data/listview.qml index 1a241eb..5083329 100644 --- a/tests/auto/declarative/listview/data/listview.qml +++ b/tests/auto/declarative/listview/data/listview.qml @@ -7,7 +7,7 @@ Rectangle { resources: [ Component { id: Delegate - Item { + Rectangle { id: wrapper objectName: "wrapper" height: 20 diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 19d324d..2a5fa1c 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -33,7 +33,7 @@ private: template <class T> void removed(); QmlView *createView(const QString &filename); template<typename T> - T *findItem(QFxItem *parent, const QString &id, int index=0); + T *findItem(QFxItem *parent, const QString &id, int index=-1); }; class TestModel : public QListModelInterface @@ -188,7 +188,7 @@ void tst_QFxListView::items() QFxItem *viewport = listview->viewport(); QVERIFY(viewport != 0); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QFxText *name = findItem<QFxText>(viewport, "textName", i); @@ -262,7 +262,7 @@ void tst_QFxListView::inserted() // let transitions settle. QTest::qWait(1000); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QFxText *name = findItem<QFxText>(viewport, "textName", 1); QVERIFY(name != 0); @@ -282,7 +282,7 @@ void tst_QFxListView::inserted() // let transitions settle. QTest::qWait(1000); - QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QFxText>(viewport, "textName", 0); QVERIFY(name != 0); @@ -338,6 +338,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QVERIFY(item->y() == i*20); } @@ -357,6 +359,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),i*20.0 + 20.0); } @@ -368,6 +372,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),i*20.0+20.0); } @@ -382,6 +388,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 2; i < 18; ++i) { QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); } @@ -392,6 +400,8 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) { QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); } @@ -452,7 +462,7 @@ QmlView *tst_QFxListView::createView(const QString &filename) } /* - Find an item with the specified id. If index is supplied then the + 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> diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp index 78ec347..412557f 100644 --- a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp +++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp @@ -18,15 +18,11 @@ public: void cleanupTestCase() {} private slots: - void number_data(); - void number(); - void text_data(); void text(); private: QStringList strings; - QList<float> numbers; QStringList formats; QStringList texts; }; @@ -43,16 +39,6 @@ tst_numberformat::tst_numberformat() << "1.0" << "1.01"; - numbers << 100 - << 12345 - << 1234567 - << 0.123 - << 0.9999 - << 0.989 - << 1 - << 1.0 - << 1.01; - formats << "" << "0000" << "0000.00" @@ -151,37 +137,6 @@ tst_numberformat::tst_numberformat() << "texts.size()" << texts.size(); } -void tst_numberformat::number_data() -{ - QTest::addColumn<QString>("string"); - QTest::addColumn<float>("number"); - - for (int i = 0; i < strings.size(); i++) - QTest::newRow(QString::number(i).toAscii()) << strings.at(i) << numbers.at(i); -} - -void tst_numberformat::number() -{ - // ### tests the conversion from string to float - QFETCH(QString, string); - QFETCH(float, number); - - QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\" }"); - - QmlEngine engine; - QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://")); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatterComponent.isReady()); - QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create()); - QVERIFY(formatterComponent.isReady()); - QVERIFY(formatter != 0); - QCOMPARE((float)formatter->number(), number); - //qDebug() << formatter->format() << formatter->text(); - QVERIFY(formatter->format().isEmpty()); - QVERIFY(formatter->text() == QString("%1").arg(number, -1, 'f', -1)); -} - void tst_numberformat::text_data() { QTest::addColumn<QString>("string"); @@ -205,10 +160,10 @@ void tst_numberformat::text() QFETCH(QString, format); QFETCH(QString, text); - QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\"; format: \"") + format + QString("\" }"); + QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: ") + string + QString("; format: \"") + format + QString("\" }"); QmlEngine engine; - QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://")); + QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file:///")); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); QVERIFY(formatterComponent.isReady()); diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp index e2da191..6e670bf 100644 --- a/tests/auto/declarative/pathview/tst_pathview.cpp +++ b/tests/auto/declarative/pathview/tst_pathview.cpp @@ -21,7 +21,7 @@ private slots: private: QmlView *createView(const QString &filename); template<typename T> - T *findItem(QFxItem *parent, const QString &id, int index=0); + T *findItem(QFxItem *parent, const QString &id, int index=-1); }; class TestModel : public QListModelInterface diff --git a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp index 4d3ad55..5e24831 100644 --- a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp +++ b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp @@ -65,12 +65,13 @@ void tst_qfxpixmapcache::single_data() QTest::addColumn<QUrl>("target"); QTest::addColumn<bool>("incache"); QTest::addColumn<bool>("exists"); + QTest::addColumn<bool>("neterror"); // File URLs are optimized - QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true; - QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false; + QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false; + QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false; + QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false; + QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true; } void tst_qfxpixmapcache::single() @@ -78,6 +79,14 @@ void tst_qfxpixmapcache::single() QFETCH(QUrl, target); QFETCH(bool, incache); QFETCH(bool, exists); + QFETCH(bool, neterror); + + if (neterror) { + QString expected = "Network error loading QUrl( \"" + +target.toString()+"\" ) \"Error downloading " + +target.toString()+" - server replied: Not Found\" "; + QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); + } QPixmap pixmap; QVERIFY(pixmap.width() <= 0); // Check Qt assumption diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp index e1419cc..77c13c3 100644 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp @@ -119,7 +119,7 @@ void tst_qmldom::loadComposite() void tst_qmldom::testValueSource() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: Follow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; + "Rectangle { height: SpringFollow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QmlEngine freshEngine; QmlDomDocument document; @@ -135,7 +135,7 @@ void tst_qmldom::testValueSource() QmlDomObject valueSourceObject = valueSource.object(); QVERIFY(valueSourceObject.isValid()); - QVERIFY(valueSourceObject.objectType() == "Qt/Follow"); + QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); const QmlDomValue springValue = valueSourceObject.property("spring").value(); QVERIFY(!springValue.isInvalid()); diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp index 1bb746b..68007a6 100644 --- a/tests/auto/declarative/repeater/tst_repeater.cpp +++ b/tests/auto/declarative/repeater/tst_repeater.cpp @@ -53,14 +53,18 @@ void tst_QFxRepeater::stringList() QCOMPARE(container->childItems().count(), data.count() + 3); + bool saw_repeater = false; for (int i = 0; i < container->childItems().count(); ++i) { if (i == 0) { QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i)); QVERIFY(name != 0); QCOMPARE(name->text(), QLatin1String("Zero")); - } else if (i == 1) { + } else if (i == container->childItems().count() - 2) { // The repeater itself + QFxRepeater *rep = qobject_cast<QFxRepeater*>(container->childItems().at(i)); + QCOMPARE(rep, repeater); + saw_repeater = true; continue; } else if (i == container->childItems().count() - 1) { QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i)); @@ -69,10 +73,10 @@ void tst_QFxRepeater::stringList() } else { QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i)); QVERIFY(name != 0); - QCOMPARE(name->text(), data.at(i-2)); + QCOMPARE(name->text(), data.at(i-1)); } - } + QVERIFY(saw_repeater); delete canvas; } diff --git a/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml new file mode 100644 index 0000000..74c6844 --- /dev/null +++ b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml @@ -0,0 +1,60 @@ +import Qt 4.6 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + color: "white" + width: 200 + height: layout.height + Column { + id: layout + spacing: 2 + WebView { + html: "No width defined." + Rectangle { color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.0.png b/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.0.png Binary files differnew file mode 100644 index 0000000..1f28b9a --- /dev/null +++ b/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.0.png diff --git a/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.qml b/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.qml new file mode 100644 index 0000000..47999be --- /dev/null +++ b/tests/auto/declarative/visual/qfxwebview/autosize/data/autosize.qml @@ -0,0 +1,83 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 32 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 48 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 64 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 80 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 96 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 112 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 128 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 144 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 160 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 176 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 192 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 208 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 224 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 240 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 256 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 272 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 288 + hash: "66539e1b1983d95386b0d30d6e969904" + } + Frame { + msec: 304 + hash: "66539e1b1983d95386b0d30d6e969904" + } +} |