diff options
Diffstat (limited to 'tests/auto')
20 files changed, 109 insertions, 11 deletions
diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 6b7d57f..16ae7fc 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -390,7 +390,7 @@ void tst_qdeclarativeanchors::fill() QCOMPARE(rect->y(), 0.0 + 30.0); QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0); - //Alter Offsets (QTBUG-6631) + //Alter Offsets (tests QTBUG-6631) rect->anchors()->setLeftMargin(20.0); rect->anchors()->setRightMargin(0.0); rect->anchors()->setBottomMargin(0.0); @@ -411,7 +411,7 @@ void tst_qdeclarativeanchors::centerIn() QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("centered")); QCOMPARE(rect->x(), 75.0 + 10); QCOMPARE(rect->y(), 75.0 + 30); - //Alter Offsets (QTBUG-6631) + //Alter Offsets (tests QTBUG-6631) rect->anchors()->setHorizontalCenterOffset(-20.0); rect->anchors()->setVerticalCenterOffset(-10.0); QCOMPARE(rect->x(), 75.0 - 20.0); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml new file mode 100644 index 0000000..a0706ad --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml @@ -0,0 +1,2 @@ +import Qt 4.6 +Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml new file mode 100644 index 0000000..d8a22a8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml @@ -0,0 +1,2 @@ +import Qt 4.6 +Rectangle {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir index eeb9a05..0adb0f6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir @@ -1,4 +1,5 @@ Rectangle 1.5 InstalledTest2.qml +LocalLast 1.0 LocalLast.qml InstalledTest 1.4 InstalledTest2.qml InstalledTest 1.0 InstalledTest.qml InstalledTestTP 0.0 InstalledTest.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index e2cf5ca..722e161 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1065,7 +1065,6 @@ void tst_qdeclarativelanguage::defaultPropertyListOrder() void tst_qdeclarativelanguage::declaredPropertyValues() { QDeclarativeComponent component(&engine, TEST_FILE("declaredPropertyValues.qml")); - QEXPECT_FAIL("", "QTBUG-7860", Abort); VERIFY_ERRORS(0); } @@ -1358,6 +1357,13 @@ void tst_qdeclarativelanguage::importsOrder_data() "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" << "QDeclarativeImage"; + QTest::newRow("local last 1") << + "LocalLast {}" + << "QDeclarativeText"; + QTest::newRow("local last 2") << + "import com.nokia.installedtest 1.0\n" + "LocalLast {}" + << "QDeclarativeRectangle"; // i.e. from com.nokia.installedtest, not data/LocalLast.qml } void tst_qdeclarativelanguage::importsOrder() diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 12000d0..d02f54f 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -41,6 +41,7 @@ #include <qtest.h> #include <QtDeclarative/private/qdeclarativeitem_p.h> #include <QtDeclarative/private/qdeclarativetext_p.h> +#include <QtDeclarative/private/qdeclarativeengine_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> #include <QtDeclarative/private/qdeclarativeexpression_p.h> #include <QDeclarativeComponent> @@ -77,6 +78,7 @@ private slots: void convertNestedToFlat_ok_data(); void error_data(); void error(); + void set(); }; QScriptValue tst_QDeclarativeListModel::nestedListValue(QScriptEngine *eng) const @@ -550,6 +552,30 @@ void tst_QDeclarativeListModel::error() } } +void tst_QDeclarativeListModel::set() +{ + QDeclarativeEngine engine; + QDeclarativeListModel model; + QDeclarativeEngine::setContextForObject(&model,engine.rootContext()); + engine.rootContext()->setContextObject(&model); + QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(&engine); + + QScriptValue sv = seng->newObject(); + sv.setProperty("test", QScriptValue(false)); + model.append(sv); + + sv.setProperty("test", QScriptValue(true)); + model.set(0, sv); + QCOMPARE(model.get(0).property("test").toBool(), true); // triggers creation of model cache + QCOMPARE(model.data(0, model.roles()[0]), qVariantFromValue(true)); + + sv.setProperty("test", QScriptValue(false)); + model.set(0, sv); + QCOMPARE(model.get(0).property("test").toBool(), false); // tests model cache is updated + QCOMPARE(model.data(0, model.roles()[0]), qVariantFromValue(false)); +} + + QTEST_MAIN(tst_QDeclarativeListModel) #include "tst_qdeclarativelistmodel.moc" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml index bd13bac..6c1c823 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml @@ -4,7 +4,8 @@ Item { width: 90 height: 480 Flow { - anchors.fill: parent + objectName: "flow" + width: parent.width Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml index f6376a1..9741ba9 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Grid { + objectName: "grid" columns: 3 add: Transition { NumberAnimation { diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml index 5b4a30d..e335932 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Grid { + objectName: "grid" columns: 3 spacing: 4 Rectangle { diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml index 830df6a..1d6f44e 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Grid { + objectName: "grid" columns: 3 Rectangle { objectName: "one" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml index c113a36..a1c05a8 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Row { + objectName: "row" add: Transition { NumberAnimation { properties: "x"; diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml index 32bf775..fb9fdd1 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Row { + objectName: "row" spacing: 10 Rectangle { objectName: "one" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml index 06ae151..3a7a3b1 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Row { + objectName: "row" Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml index 10f6cbb..31faa54 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Column { + objectName: "column" add: Transition { NumberAnimation { properties: "y"; diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml index 69a8256..1c5696b 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Column { + objectName: "column" spacing: 10 Rectangle { objectName: "one" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml index 856c180..cd777e2 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml @@ -4,6 +4,7 @@ Item { width: 640 height: 480 Column { + objectName: "column" Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 9026566..08eac0a 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -94,6 +94,10 @@ void tst_QDeclarativePositioners::test_horizontal() QCOMPARE(two->y(), 0.0); QCOMPARE(three->x(), 70.0); QCOMPARE(three->y(), 0.0); + + QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); + QCOMPARE(row->width(), 110.0); + QCOMPARE(row->height(), 50.0); } void tst_QDeclarativePositioners::test_horizontal_spacing() @@ -115,6 +119,10 @@ void tst_QDeclarativePositioners::test_horizontal_spacing() QCOMPARE(two->y(), 0.0); QCOMPARE(three->x(), 90.0); QCOMPARE(three->y(), 0.0); + + QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); + QCOMPARE(row->width(), 130.0); + QCOMPARE(row->height(), 50.0); } void tst_QDeclarativePositioners::test_horizontal_animated() @@ -135,6 +143,11 @@ void tst_QDeclarativePositioners::test_horizontal_animated() QCOMPARE(two->x(), -100.0); QCOMPARE(three->x(), -100.0); + QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); + QVERIFY(row); + QCOMPARE(row->width(), 100.0); + QCOMPARE(row->height(), 50.0); + //QTRY_COMPARE used instead of waiting for the expected time of animation completion //Note that this means the duration of the animation is NOT tested @@ -149,6 +162,11 @@ void tst_QDeclarativePositioners::test_horizontal_animated() //Add 'two' two->setOpacity(1.0); QCOMPARE(two->opacity(), 1.0); + + // New size should be immediate + QCOMPARE(row->width(), 150.0); + QCOMPARE(row->height(), 50.0); + QTest::qWait(0);//Let the animation start QCOMPARE(two->x(), -100.0); QCOMPARE(three->x(), 50.0); @@ -176,6 +194,11 @@ void tst_QDeclarativePositioners::test_vertical() QCOMPARE(two->y(), 50.0); QCOMPARE(three->x(), 0.0); QCOMPARE(three->y(), 60.0); + + QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); + QVERIFY(column); + QCOMPARE(column->height(), 80.0); + QCOMPARE(column->width(), 50.0); } void tst_QDeclarativePositioners::test_vertical_spacing() @@ -197,6 +220,10 @@ void tst_QDeclarativePositioners::test_vertical_spacing() QCOMPARE(two->y(), 60.0); QCOMPARE(three->x(), 0.0); QCOMPARE(three->y(), 80.0); + + QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); + QCOMPARE(column->height(), 100.0); + QCOMPARE(column->width(), 50.0); } void tst_QDeclarativePositioners::test_vertical_animated() @@ -216,6 +243,11 @@ void tst_QDeclarativePositioners::test_vertical_animated() QVERIFY(three != 0); QCOMPARE(three->y(), -100.0); + QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); + QVERIFY(column); + QCOMPARE(column->height(), 100.0); + QCOMPARE(column->width(), 50.0); + //QTRY_COMPARE used instead of waiting for the expected time of animation completion //Note that this means the duration of the animation is NOT tested @@ -230,6 +262,8 @@ void tst_QDeclarativePositioners::test_vertical_animated() //Add 'two' two->setOpacity(1.0); QTRY_COMPARE(two->opacity(), 1.0); + QCOMPARE(column->height(), 150.0); + QCOMPARE(column->width(), 50.0); QTest::qWait(0);//Let the animation start QCOMPARE(two->y(), -100.0); QCOMPARE(three->y(), 50.0); @@ -264,6 +298,10 @@ void tst_QDeclarativePositioners::test_grid() QCOMPARE(four->y(), 50.0); QCOMPARE(five->x(), 50.0); QCOMPARE(five->y(), 50.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QCOMPARE(grid->width(), 120.0); + QCOMPARE(grid->height(), 100.0); } void tst_QDeclarativePositioners::test_grid_spacing() @@ -291,6 +329,10 @@ void tst_QDeclarativePositioners::test_grid_spacing() QCOMPARE(four->y(), 54.0); QCOMPARE(five->x(), 54.0); QCOMPARE(five->y(), 54.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QCOMPARE(grid->width(), 128.0); + QCOMPARE(grid->height(), 104.0); } void tst_QDeclarativePositioners::test_grid_animated() @@ -323,6 +365,11 @@ void tst_QDeclarativePositioners::test_grid_animated() QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QVERIFY(grid); + QCOMPARE(grid->width(), 150.0); + QCOMPARE(grid->height(), 100.0); + //QTRY_COMPARE used instead of waiting for the expected time of animation completion //Note that this means the duration of the animation is NOT tested @@ -341,6 +388,8 @@ void tst_QDeclarativePositioners::test_grid_animated() //Add 'two' two->setOpacity(1.0); QCOMPARE(two->opacity(), 1.0); + QCOMPARE(grid->width(), 150.0); + QCOMPARE(grid->height(), 100.0); QTest::qWait(0);//Let the animation start QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); @@ -468,6 +517,11 @@ void tst_QDeclarativePositioners::test_flow() QCOMPARE(four->y(), 70.0); QCOMPARE(five->x(), 50.0); QCOMPARE(five->y(), 70.0); + + QDeclarativeItem *flow = canvas->rootObject()->findChild<QDeclarativeItem*>("flow"); + QVERIFY(flow); + QCOMPARE(flow->width(), 90.0); + QCOMPARE(flow->height(), 120.0); } void tst_QDeclarativePositioners::test_flow_resize() diff --git a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml index fc6b34c..d74b2dc 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml @@ -21,17 +21,17 @@ Rectangle { objectName: "itemModel" Rectangle { objectName: "item1" - height: view.height; width: view.width; color: "#FFFEF0" + height: 50; width: 100; color: "#FFFEF0" Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } Rectangle { objectName: "item2" - height: view.height; width: view.width; color: "#F0FFF7" + height: 50; width: 100; color: "#F0FFF7" Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } Rectangle { objectName: "item3" - height: view.height; width: view.width; color: "#F4F0FF" + height: 50; width: 100; color: "#F4F0FF" Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } } @@ -41,8 +41,6 @@ Rectangle { Repeater { id: view objectName: "repeater" - anchors.fill: parent - anchors.bottomMargin: 30 model: testObject.useModel ? itemModel : 0 } } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 84e7182..b6f55dd 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -523,7 +523,7 @@ void tst_qdeclarativetextinput::navigation() QVERIFY(input->hasFocus() == false); simulateKey(canvas, Qt::Key_Right); QVERIFY(input->hasFocus() == true); - //QT-2944: If text is selected, then we should deselect first. + //QT-2944: If text is selected, ensure we deselect upon cursor motion input->setCursorPosition(input->text().length()); input->setSelectionStart(0); input->setSelectionEnd(input->text().length()); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index a5cb16f..4e254eb 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -432,7 +432,6 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() object->setProperty("value", QVariant(92)); - //QEXPECT_FAIL("", "QT-2920", Continue); QCOMPARE(object->rect().x(), 42); delete object; |