diff options
Diffstat (limited to 'tests/auto/declarative')
36 files changed, 232 insertions, 399 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 3d2dbf0..a7fb3b8 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -52,8 +52,7 @@ SUBDIRS += \ qdeclarativeqt \ qdeclarativerepeater \ qdeclarativesmoothedanimation \ - qdeclarativesmoothedfollow\ - qdeclarativespringfollow \ + qdeclarativespringanimation \ qdeclarativesqldatabase \ qdeclarativestates \ qdeclarativestyledtext \ diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index a965ef3..3e80c2c 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -310,7 +310,7 @@ void tst_qdeclarativeanimations::badTypes() c.create(); QVERIFY(c.errors().count() == 1); - QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: double expected")); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected")); } //make sure we get a compiler error diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index bb7fc7b..174967b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -401,6 +401,7 @@ void tst_qdeclarativebehaviors::sameValue() target->setProperty("x", 0); QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100)); + QTRY_VERIFY(target->x() == qreal(0)); //make sure Behavior has finished. target->setX(100); QCOMPARE(target->x(), qreal(100)); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml index db7f2b5..2c79729 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml @@ -7,7 +7,7 @@ MyTypeObject { uintProperty: if(1) 10 intProperty: if(1) -19 realProperty: if(1) 23.2 - doubleProperty: if(1) -19.7 + doubleProperty: if(1) -19.75 floatProperty: if(1) 8.5 colorProperty: if(1) "red" dateProperty: if(1) "1982-11-25" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml index 72ae865..1cd78a5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml @@ -9,7 +9,7 @@ MyTypeObject { uintProperty = 10 intProperty = -19 realProperty = 23.2 - doubleProperty = -19.7 + doubleProperty = -19.75 floatProperty = 8.5 colorProperty = "red" dateProperty = "1982-11-25" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 849879e..19bfd37 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -572,7 +572,7 @@ public: Q_INVOKABLE void method_NoArgs() { invoke(0); } Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; } - Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.7; } + Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.75; } Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); } Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; } Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 43900ae..a6d2dac 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -179,7 +179,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes() QCOMPARE(object->uintProperty(), uint(10)); QCOMPARE(object->intProperty(), -19); QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->doubleProperty(), float(-19.75)); QCOMPARE((float)object->floatProperty(), float(8.5)); QCOMPARE(object->colorProperty(), QColor("red")); QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); @@ -207,7 +207,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes() QCOMPARE(object->uintProperty(), uint(10)); QCOMPARE(object->intProperty(), -19); QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->doubleProperty(), float(-19.75)); QCOMPARE((float)object->floatProperty(), float(8.5)); QCOMPARE(object->colorProperty(), QColor("red")); QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); @@ -280,8 +280,8 @@ void tst_qdeclarativeecmascript::signalAssignment() MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); - emit object->argumentSignal(19, "Hello world!", 10.3); - QCOMPARE(object->string(), QString("pass 19 Hello world! 10.3")); + emit object->argumentSignal(19, "Hello world!", 10.25); + QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25")); } } @@ -1387,7 +1387,7 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().count(), 0); o.reset(); - QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.7))); + QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.75))); QCOMPARE(o.error(), false); QCOMPARE(o.invoked(), 2); QCOMPARE(o.actuals().count(), 0); @@ -1818,7 +1818,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1831,7 +1831,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1844,7 +1844,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toBool(), true); delete object; @@ -1857,7 +1857,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->methodCalled(), true); delete object; @@ -1870,7 +1870,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->methodCalled(), true); delete object; @@ -1883,7 +1883,7 @@ void tst_qdeclarativeecmascript::scriptConnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1899,13 +1899,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1918,13 +1918,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); delete object; @@ -1937,13 +1937,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 3); delete object; @@ -1955,13 +1955,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 0); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 1); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 2); emit object->basicSignal(); QCOMPARE(object->property("test").toInt(), 2); - emit object->argumentSignal(19, "Hello world!", 10.3); + emit object->argumentSignal(19, "Hello world!", 10.25); QCOMPARE(object->property("test").toInt(), 3); delete object; diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png Binary files differnew file mode 100644 index 0000000..3245027 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png Binary files differnew file mode 100644 index 0000000..b16db76 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index adee312..b8d2828 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -123,8 +123,8 @@ void tst_qdeclarativeimage::noSource() void tst_qdeclarativeimage::imageSource_data() { QTest::addColumn<QString>("source"); - QTest::addColumn<qreal>("width"); - QTest::addColumn<qreal>("height"); + QTest::addColumn<double>("width"); + QTest::addColumn<double>("height"); QTest::addColumn<bool>("remote"); QTest::addColumn<bool>("async"); QTest::addColumn<QString>("error"); @@ -136,6 +136,7 @@ void tst_qdeclarativeimage::imageSource_data() QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << ""; + QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << ""; QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true << false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; @@ -145,8 +146,8 @@ void tst_qdeclarativeimage::imageSource_data() void tst_qdeclarativeimage::imageSource() { QFETCH(QString, source); - QFETCH(qreal, width); - QFETCH(qreal, height); + QFETCH(double, width); + QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); QFETCH(QString, error); @@ -155,6 +156,7 @@ void tst_qdeclarativeimage::imageSource() if (remote) { QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); + server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); } if (!error.isEmpty()) @@ -177,8 +179,8 @@ void tst_qdeclarativeimage::imageSource() if (error.isEmpty()) { TRY_WAIT(obj->status() == QDeclarativeImage::Ready); - QCOMPARE(obj->width(), width); - QCOMPARE(obj->height(), height); + QCOMPARE(obj->width(), qreal(width)); + QCOMPARE(obj->height(), qreal(height)); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); QCOMPARE(obj->progress(), 1.0); } else { @@ -276,6 +278,8 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-arm.png")); #else QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); #endif @@ -290,6 +294,8 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-arm.png")); #else QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); #endif diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 9d62f22..e0b46f0 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -256,9 +256,7 @@ void tst_qdeclarativeimageprovider::requestPixmap_async() engine.addImageProvider("test", provider); QVERIFY(engine.imageProvider("test") != 0); - QTest::ignoreMessage(QtWarningMsg, - "Pixmaps must be loaded synchronously, ignoring asynchronous property for Image with source: \"image://test/pixmap-async-test.png\""); - + // pixmaps are loaded synchronously regardless of 'asynchronous' value QString componentStr = "import Qt 4.7\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt new file mode 100644 index 0000000..3fdac09 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt @@ -0,0 +1 @@ +1:1:"MyComponent.qml": no such directory diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml new file mode 100644 index 0000000..a0d8410 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml @@ -0,0 +1,3 @@ +import "MyComponent.qml" 1.0 + +MyComponent { text: "Hello" } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 886da55..6e11786 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt @@ -1,2 +1,2 @@ 4:5:Unable to create type NestedErrorsType -4:8:Invalid property assignment: double expected +4:8:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt index d0a0b00..d2b8c54 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt @@ -1 +1 @@ -3:19:Invalid property assignment: double expected +3:19:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index e687ba0..fcdf926 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -289,6 +289,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("importNonExistOlder (installed)") << "importNonExistOlder.qml" << "importNonExistOlder.errors.txt" << false; QTest::newRow("importNewerVersion (installed)") << "importNewerVersion.qml" << "importNewerVersion.errors.txt" << false; QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; + QTest::newRow("importFile") << "importFile.qml" << "importFile.errors.txt" << false; QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 8964f8a..b06ad7c 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -124,6 +124,7 @@ QML_DECLARE_TYPE(ValueInterceptorTestType); { \ cpptype v = (value); cpptype v2 = (value); \ QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, 0)); \ + QCOMPARE((cpptype)(v),(cpptype)(defaultvalue)); \ QVERIFY(v == (defaultvalue)); \ QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, &v2)); \ QVERIFY(v == (value)); \ @@ -273,7 +274,7 @@ void tst_qdeclarativemetatype::copy() QWidget widgetValue; COPY_TEST(QObject *, QObjectStar, &objectValue, 0); COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0); - COPY_TEST(qreal, QReal, 10.2, 0); + COPY_TEST(qreal, QReal, 10.5, 0); { QVariant tv = QVariant::fromValue(QVariant(10)); diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml deleted file mode 100644 index 8c9d8ad..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml +++ /dev/null @@ -1,3 +0,0 @@ -import Qt 4.7 - -SmoothedFollow {} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml deleted file mode 100644 index a634302..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.7 - -SmoothedFollow { - to: 10; duration: 300; reversingMode: SmoothedFollow.Immediate -} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml deleted file mode 100644 index c60da7f..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Qt 4.7 - -SmoothedFollow { - to: 10; velocity: 250; reversingMode: SmoothedFollow.Sync - maximumEasingTime: 150 -} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml deleted file mode 100644 index 486bdee..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.7 - -Rectangle { - width: 300; height: 300; - Rectangle { - objectName: "theRect" - color: "red" - width: 60; height: 60; - x: 100; y: 100; - SmoothedFollow on x { id: animX; objectName: "animX"; to: 200; enabled: true; duration: 200 } - SmoothedFollow on y { id: animY; objectName: "animY"; to: 200; enabled: false; duration: 200 } - } -} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml deleted file mode 100644 index 2e01d74..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.7 - -Rectangle { - width: 300; height: 300; - Rectangle { - objectName: "theRect" - color: "red" - width: 60; height: 60; - x: 100; y: 100; - SmoothedFollow on x { objectName: "easeX"; to: 200; velocity: 500 } - SmoothedFollow on y { objectName: "easeY"; to: 200; duration: 250; velocity: 500 } - } -} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro deleted file mode 100644 index dff4922..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ /dev/null @@ -1,16 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qdeclarativesmoothedfollow.cpp - -symbian: { - importFiles.sources = data - importFiles.path = . - DEPLOYMENT = importFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} - -CONFIG += parallel_test - diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp b/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp deleted file mode 100644 index b9ac23f..0000000 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qtest.h> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecomponent.h> -#include <QtDeclarative/qdeclarativeview.h> - -#include <private/qdeclarativesmoothedfollow_p.h> -#include <private/qdeclarativerectangle_p.h> -#include <private/qdeclarativevaluetype_p.h> -#include "../../../shared/util.h" - -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -#define SRCDIR "." -#endif - -class tst_qdeclarativesmoothedfollow : public QObject -{ - Q_OBJECT -public: - tst_qdeclarativesmoothedfollow(); - -private slots: - void defaultValues(); - void values(); - void disabled(); - void valueSource(); - void followTo(); - -private: - QDeclarativeEngine engine; -}; - -tst_qdeclarativesmoothedfollow::tst_qdeclarativesmoothedfollow() -{ -} - -void tst_qdeclarativesmoothedfollow::defaultValues() -{ - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow1.qml")); - QDeclarativeSmoothedFollow *obj = qobject_cast<QDeclarativeSmoothedFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->to(), 0.); - QCOMPARE(obj->velocity(), 200.); - QCOMPARE(obj->duration(), -1); - QCOMPARE(obj->maximumEasingTime(), -1); - QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Eased); - - delete obj; -} - -void tst_qdeclarativesmoothedfollow::values() -{ - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow2.qml")); - QDeclarativeSmoothedFollow *obj = qobject_cast<QDeclarativeSmoothedFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->to(), 10.); - QCOMPARE(obj->velocity(), 200.); - QCOMPARE(obj->duration(), 300); - QCOMPARE(obj->maximumEasingTime(), -1); - QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Immediate); - - delete obj; -} - -void tst_qdeclarativesmoothedfollow::disabled() -{ - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow3.qml")); - QDeclarativeSmoothedFollow *obj = qobject_cast<QDeclarativeSmoothedFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->to(), 10.); - QCOMPARE(obj->velocity(), 250.); - QCOMPARE(obj->maximumEasingTime(), 150); - QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Sync); - - delete obj; -} - -void tst_qdeclarativesmoothedfollow::valueSource() -{ - QDeclarativeEngine engine; - - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollowValueSource.qml")); - - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - - QDeclarativeRectangle *theRect = rect->findChild<QDeclarativeRectangle*>("theRect"); - QVERIFY(theRect); - - QDeclarativeSmoothedFollow *easeX = rect->findChild<QDeclarativeSmoothedFollow*>("easeX"); - QVERIFY(easeX); - QVERIFY(easeX->enabled()); - - QDeclarativeSmoothedFollow *easeY = rect->findChild<QDeclarativeSmoothedFollow*>("easeY"); - QVERIFY(easeY); - QVERIFY(easeY->enabled()); - - // XXX get the proper duration - QTest::qWait(200); - - QTRY_COMPARE(theRect->x(), easeX->to()); - QTRY_COMPARE(theRect->y(), easeY->to()); - - QTRY_COMPARE(theRect->x(), qreal(200)); - QTRY_COMPARE(theRect->y(), qreal(200)); -} - -void tst_qdeclarativesmoothedfollow::followTo() -{ - QDeclarativeView canvas; - canvas.setFixedSize(240,320); - - canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/smoothedfollowDisabled.qml")); - canvas.show(); - canvas.setFocus(); - QVERIFY(canvas.rootObject() != 0); - - QDeclarativeRectangle *rect = canvas.rootObject()->findChild<QDeclarativeRectangle*>("theRect"); - QVERIFY(rect != 0); - - QDeclarativeSmoothedFollow *animX = canvas.rootObject()->findChild<QDeclarativeSmoothedFollow*>("animX"); - QVERIFY(animX != 0); - QDeclarativeSmoothedFollow *animY = canvas.rootObject()->findChild<QDeclarativeSmoothedFollow*>("animY"); - QVERIFY(animY != 0); - - QVERIFY(animX->enabled()); - QVERIFY(!animY->enabled()); - - // animX should track 'to' - animX->setTo(50.0); - // animY should not track this 'to' change - animY->setTo(50.0); - - // XXX get the proper duration - QTest::qWait(250); - - QTRY_COMPARE(rect->x(), animX->to()); - - QCOMPARE(rect->x(), 50.0); - QCOMPARE(rect->y(), 100.0); -} - -QTEST_MAIN(tst_qdeclarativesmoothedfollow) - -#include "tst_qdeclarativesmoothedfollow.moc" diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml index b1f701b..762e2b6 100644 --- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml @@ -20,9 +20,9 @@ Rectangle { id: t anchors.fill: parent - horizontalAlignment: TextEdit.AlignRight - verticalAlignment: TextEdit.AlignBottom - wrapMode: TextEdit.WordWrap + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + wrapMode: Text.WordWrap text: top.txt } Timer { diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml index b1f701b..9281a06 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml @@ -16,7 +16,7 @@ Rectangle { height: 40 color: "green" - Text { + TextEdit { id: t anchors.fill: parent diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 0723b36..57a5e29 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -53,6 +53,7 @@ #include <private/qdeclarativetextedit_p_p.h> #include <QFontMetrics> #include <QDeclarativeView> +#include <QDir> #include <QStyle> #include <QInputContext> #include <private/qapplication_p.h> @@ -63,6 +64,23 @@ #define SRCDIR "." #endif +QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) +{ + // XXX This will be replaced by some clever persistent platform image store. + QString persistent_dir = SRCDIR "/data"; + QString arch = "unknown-architecture"; // QTest needs to help with this. + + QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png"; + + if (!QFile::exists(expectfile)) { + actual.save(expectfile); + qWarning() << "created" << expectfile; + } + + return expectfile; +} + + class tst_qdeclarativetextedit : public QObject { @@ -309,17 +327,17 @@ void tst_qdeclarativetextedit::alignments_data() QTest::addColumn<int>("vAlign"); QTest::addColumn<QString>("expectfile"); - QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png"; - QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png"; - QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png"; + QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << "alignments_lt"; + QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << "alignments_rt"; + QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << "alignments_ct"; - QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png"; - QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png"; - QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png"; + QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << "alignments_lb"; + QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << "alignments_rb"; + QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << "alignments_cb"; - QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png"; - QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png"; - QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png"; + QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << "alignments_lc"; + QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << "alignments_rc"; + QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << "alignments_cc"; } @@ -329,13 +347,6 @@ void tst_qdeclarativetextedit::alignments() QFETCH(int, vAlign); QFETCH(QString, expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - QFont fn; - fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); - QApplication::setFont(fn); -#endif - QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml"); canvas->show(); @@ -353,14 +364,11 @@ void tst_qdeclarativetextedit::alignments() QPainter p(&actual); canvas->render(&p); + expectfile = createExpectedFileIfNotFound(expectfile, actual); + QImage expect(expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { - QCOMPARE(actual,expect); - } -#endif + QCOMPARE(actual,expect); } @@ -846,6 +854,18 @@ void tst_qdeclarativetextedit::navigation() void tst_qdeclarativetextedit::copyAndPaste() { #ifndef QT_NO_CLIPBOARD + +#ifdef Q_WS_MAC + { + PasteboardRef pasteboard; + OSStatus status = PasteboardCreate(0, &pasteboard); + if (status == noErr) + CFRelease(pasteboard); + else + QSKIP("This machine doesn't support the clipboard", SkipAll); + } +#endif + QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello world!\" }"; QDeclarativeComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index aceebf3..6e15a4a 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -47,6 +47,7 @@ #include <private/qdeclarativetextinput_p.h> #include <private/qdeclarativetextinput_p_p.h> #include <QDebug> +#include <QDir> #include <QStyle> #include <QInputContext> #include <private/qapplication_p.h> @@ -56,6 +57,22 @@ #define SRCDIR "." #endif +QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) +{ + // XXX This will be replaced by some clever persistent platform image store. + QString persistent_dir = SRCDIR "/data"; + QString arch = "unknown-architecture"; // QTest needs to help with this. + + QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png"; + + if (!QFile::exists(expectfile)) { + actual.save(expectfile); + qWarning() << "created" << expectfile; + } + + return expectfile; +} + class tst_qdeclarativetextinput : public QObject { @@ -176,7 +193,8 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor + int delta = abs(int(textinputObject->width()) - metricWidth); + QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform. delete textinputObject; } @@ -381,9 +399,9 @@ void tst_qdeclarativetextinput::horizontalAlignment_data() QTest::addColumn<int>("hAlign"); QTest::addColumn<QString>("expectfile"); - QTest::newRow("L") << int(Qt::AlignLeft) << SRCDIR "/data/halign_left.png"; - QTest::newRow("R") << int(Qt::AlignRight) << SRCDIR "/data/halign_right.png"; - QTest::newRow("C") << int(Qt::AlignHCenter) << SRCDIR "/data/halign_center.png"; + QTest::newRow("L") << int(Qt::AlignLeft) << "halign_left"; + QTest::newRow("R") << int(Qt::AlignRight) << "halign_right"; + QTest::newRow("C") << int(Qt::AlignHCenter) << "halign_center"; } void tst_qdeclarativetextinput::horizontalAlignment() @@ -391,13 +409,6 @@ void tst_qdeclarativetextinput::horizontalAlignment() QFETCH(int, hAlign); QFETCH(QString, expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - QFont fn; - fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); - QApplication::setFont(fn); -#endif - QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment.qml"); canvas->show(); @@ -409,17 +420,18 @@ void tst_qdeclarativetextinput::horizontalAlignment() ob->setProperty("horizontalAlignment",hAlign); QImage actual(canvas->width(), canvas->height(), QImage::Format_RGB32); actual.fill(qRgb(255,255,255)); - QPainter p(&actual); - canvas->render(&p); + { + QPainter p(&actual); + canvas->render(&p); + } + + expectfile = createExpectedFileIfNotFound(expectfile, actual); QImage expect(expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { - QCOMPARE(actual,expect); - } -#endif + QCOMPARE(actual,expect); + + delete canvas; } void tst_qdeclarativetextinput::positionAt() @@ -464,11 +476,13 @@ void tst_qdeclarativetextinput::positionAt() void tst_qdeclarativetextinput::maxLength() { - //QString componentStr = "import Qt 4.7\nTextInput { maximumLength: 10; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); + QVERIFY(canvas->rootObject() != 0); canvas->show(); canvas->setFocus(); - QVERIFY(canvas->rootObject() != 0); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); QVERIFY(textinputObject != 0); QVERIFY(textinputObject->text().isEmpty()); @@ -686,6 +700,18 @@ void tst_qdeclarativetextinput::navigation() void tst_qdeclarativetextinput::copyAndPaste() { #ifndef QT_NO_CLIPBOARD + +#ifdef Q_WS_MAC + { + PasteboardRef pasteboard; + OSStatus status = PasteboardCreate(0, &pasteboard); + if (status == noErr) + CFRelease(pasteboard); + else + QSKIP("This machine doesn't support the clipboard", SkipAll); + } +#endif + QString componentStr = "import Qt 4.7\nTextInput { text: \"Hello world!\" }"; QDeclarativeComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); @@ -776,6 +802,9 @@ void tst_qdeclarativetextinput::echoMode() QDeclarativeView *canvas = createView(SRCDIR "/data/echoMode.qml"); canvas->show(); canvas->setFocus(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); QVERIFY(canvas->rootObject() != 0); @@ -823,6 +852,7 @@ void tst_qdeclarativetextinput::echoMode() QCOMPARE(input->text(), QLatin1String("a")); QCOMPARE(input->displayText(), QLatin1String("a")); input->setFocus(false); + QVERIFY(input->hasActiveFocus() == false); QCOMPARE(input->displayText(), QLatin1String("Q")); } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 81334f2..a4819f3 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -141,8 +141,8 @@ void tst_qdeclarativevaluetypes::pointf() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("p_x").toDouble(), 11.3); - QCOMPARE(object->property("p_y").toDouble(), -10.9); + QCOMPARE(float(object->property("p_x").toDouble()), float(11.3)); + QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9)); QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9))); delete object; @@ -191,8 +191,8 @@ void tst_qdeclarativevaluetypes::sizef() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("s_width").toDouble(), 0.1); - QCOMPARE(object->property("s_height").toDouble(), 100923.2); + QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); + QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); delete object; @@ -287,10 +287,10 @@ void tst_qdeclarativevaluetypes::rectf() MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->property("r_x").toDouble(), 103.8); - QCOMPARE(object->property("r_y").toDouble(), 99.2); - QCOMPARE(object->property("r_width").toDouble(), 88.1); - QCOMPARE(object->property("r_height").toDouble(), 77.6); + QCOMPARE(float(object->property("r_x").toDouble()), float(103.8)); + QCOMPARE(float(object->property("r_y").toDouble()), float(99.2)); + QCOMPARE(float(object->property("r_width").toDouble()), float(88.1)); + QCOMPARE(float(object->property("r_height").toDouble()), float(77.6)); QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6))); delete object; diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index 5344698..de8d222 100644 --- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -130,6 +130,8 @@ void tst_QDeclarativeViewer::orientation() QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); QCOMPARE(viewer->size(), QSize(200, 300 + MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->size(), viewer->sizeHint()); + + delete viewer; } void tst_QDeclarativeViewer::loading() @@ -150,16 +152,16 @@ void tst_QDeclarativeViewer::loading() TEST_INITIAL_SIZES(viewer); - viewer->resize(QSize(400, 500)); + viewer->resize(QSize(250, 350)); qApp->processEvents(); // window resized - QTRY_COMPARE(rootItem->width(), 400.0); - QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer)); - QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer))); + QTRY_COMPARE(rootItem->width(), 250.0); + QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer)); + QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); - QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer))); - QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer))); + QCOMPARE(viewer->size(), QSize(250, 350)); QCOMPARE(viewer->size(), viewer->sizeHint()); viewer->reload(); @@ -175,16 +177,16 @@ void tst_QDeclarativeViewer::loading() QCOMPARE(viewer->size(), QSize(200, 300 + MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->size(), viewer->sizeHint()); - viewer->resize(QSize(400, 500)); + viewer->resize(QSize(250, 350)); qApp->processEvents(); // window resized again - QTRY_COMPARE(rootItem->width(), 400.0); - QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer)); - QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer))); + QTRY_COMPARE(rootItem->width(), 250.0); + QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer)); + QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); - QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer))); - QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer))); + QCOMPARE(viewer->size(), QSize(250, 350)); QCOMPARE(viewer->size(), viewer->sizeHint()); viewer->open(SRCDIR "/data/orientation.qml"); @@ -199,6 +201,8 @@ void tst_QDeclarativeViewer::loading() QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); QCOMPARE(viewer->size(), QSize(200, 300 + MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->size(), viewer->sizeHint()); + + delete viewer; } void tst_QDeclarativeViewer::fileBrowser() @@ -233,6 +237,8 @@ void tst_QDeclarativeViewer::fileBrowser() QVERIFY(viewer->view()); QVERIFY(viewer->menuBar()); QVERIFY(browserItem); + + delete viewer; } void tst_QDeclarativeViewer::resizing() @@ -288,6 +294,8 @@ void tst_QDeclarativeViewer::resizing() rootItem->setWidth(150); rootItem->setHeight(200); QTRY_COMPARE(viewer->size(), QSize(250, 350)); + + delete viewer; } void tst_QDeclarativeViewer::paths() @@ -300,6 +308,8 @@ void tst_QDeclarativeViewer::paths() viewer->addPluginPath("miscPluginPath"); viewer->view()->engine()->pluginPathList().contains("miscPluginPath"); + + delete viewer; } void tst_QDeclarativeViewer::slowMode() @@ -309,6 +319,8 @@ void tst_QDeclarativeViewer::slowMode() viewer->setSlowMode(true); viewer->setSlowMode(false); + + delete viewer; } QTEST_MAIN(tst_QDeclarativeViewer) diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 8e98874..3140265 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -134,7 +134,7 @@ void tst_QDeclarativeWorkerScript::messaging_data() QTest::newRow("invalid") << QVariant(); QTest::newRow("bool") << qVariantFromValue(true); QTest::newRow("int") << qVariantFromValue(1001); - QTest::newRow("real") << qVariantFromValue(10334.323); + QTest::newRow("real") << qVariantFromValue(10334.375); QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!")); QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c")); } diff --git a/tests/auto/declarative/qmlvisual/focusscope/test.qml b/tests/auto/declarative/qmlvisual/focusscope/test.qml index d83bad4..24b4b99 100644 --- a/tests/auto/declarative/qmlvisual/focusscope/test.qml +++ b/tests/auto/declarative/qmlvisual/focusscope/test.qml @@ -19,14 +19,14 @@ Rectangle { color: "transparent" border.width: 5 - border.color: myScope.wantsFocus?"blue":"black" + border.color: myScope.activeFocus?"blue":"black" Rectangle { id: item1 x: 10; y: 10 width: 100; height: 100; color: "green" border.width: 5 - border.color: wantsFocus?"blue":"black" + border.color: activeFocus?"blue":"black" Keys.onDigit9Pressed: console.log("Top Left"); KeyNavigation.right: item2 focus: true @@ -42,7 +42,7 @@ Rectangle { x: 310; y: 10 width: 100; height: 100; color: "green" border.width: 5 - border.color: wantsFocus?"blue":"black" + border.color: activeFocus?"blue":"black" KeyNavigation.left: item1 Keys.onDigit9Pressed: console.log("Top Right"); @@ -62,7 +62,7 @@ Rectangle { x: 10; y: 300 width: 100; height: 100; color: "green" border.width: 5 - border.color: wantsFocus?"blue":"black" + border.color: activeFocus?"blue":"black" Keys.onDigit9Pressed: console.log("Bottom Left"); KeyNavigation.up: myScope diff --git a/tests/auto/declarative/qmlvisual/focusscope/test2.qml b/tests/auto/declarative/qmlvisual/focusscope/test2.qml index 7a6ed83..19c8bed 100644 --- a/tests/auto/declarative/qmlvisual/focusscope/test2.qml +++ b/tests/auto/declarative/qmlvisual/focusscope/test2.qml @@ -10,27 +10,27 @@ Rectangle { FocusScope { y: 100 focus: true - Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" } + Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" } FocusScope { y: 100 focus: true - Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" } + Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" } FocusScope { y: 100 focus: true - Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" } + Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" } FocusScope { y: 100 focus: true - Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" } + Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" } FocusScope { y: 100 focus: true - Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" } + Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" } } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml index 7ca0ca5..0df727b 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -14,27 +14,27 @@ Rectangle { } Rectangle { - width: 50; height: 20; y: 60; color: "red" - SmoothedFollow on x { to: rect.x; velocity: 400; enabled: true } + width: 50; height: 20; x: rect.x; y: 60; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } } Rectangle { - width: 50; height: 20; y: 90; color: "yellow" - SmoothedFollow on x { to: rect.x; velocity: 300; reversingMode: SmoothedAnimation.Immediate; enabled: true } + width: 50; height: 20; x: rect.x; y: 90; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } } Rectangle { - width: 50; height: 20; y: 120; color: "green" - SmoothedFollow on x { to: rect.x; reversingMode: SmoothedAnimation.Sync; enabled: true } + width: 50; height: 20; x: rect.x; y: 120; color: "green" + Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } } } Rectangle { - width: 50; height: 20; y: 150; color: "purple" - SmoothedFollow on x { to: rect.x; maximumEasingTime: 200; enabled: true } + width: 50; height: 20; x: rect.x; y: 150; color: "purple" + Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } } } Rectangle { - width: 50; height: 20; y: 180; color: "blue" - SmoothedFollow on x { to: rect.x; duration: 300; enabled: true } + width: 50; height: 20; x: rect.x; y: 180; color: "blue" + Behavior on x { SmoothedAnimation { duration: 300 } } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml index d981763..c64497a 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml @@ -22,10 +22,11 @@ Rectangle { smooth: true transform: Rotation { id: hourRotation - origin.x: 7.5; origin.y: 73; angle: 0 - SpringFollow on angle { - spring: 2; damping: 0.2; modulus: 360 - to: (clock.hours * 30) + (clock.minutes * 0.5) + origin.x: 7.5; origin.y: 73 + angle: (clock.hours * 30) + (clock.minutes * 0.5) + + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } } } } @@ -36,10 +37,11 @@ Rectangle { smooth: true transform: Rotation { id: minuteRotation - origin.x: 6.5; origin.y: 83; angle: 0 - SpringFollow on angle { - spring: 2; damping: 0.2; modulus: 360 - to: clock.minutes * 6 + origin.x: 6.5; origin.y: 83 + angle: clock.minutes * 6 + + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } } } } @@ -50,10 +52,11 @@ Rectangle { smooth: true transform: Rotation { id: secondRotation - origin.x: 2.5; origin.y: 80; angle: 0 - SpringFollow on angle { - spring: 5; damping: 0.25; modulus: 360 - to: clock.seconds * 6 + origin.x: 2.5; origin.y: 80 + angle: clock.seconds * 6 + + Behavior on angle { + SpringAnimation { spring: 5; damping: 0.25; modulus: 360 } } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml index cabdce7..05b93df 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml @@ -3,6 +3,7 @@ import Qt 4.7 Rectangle { color: "#ffffff" width: 320; height: 240 + Rectangle { id: rect color: "#00ff00" @@ -25,22 +26,22 @@ Rectangle { Rectangle { color: "#ff0000" x: rect.width; width: rect.width; height: 20 - y: 200 - SpringFollow on y { to: rect.y; velocity: 200 } + y: rect.y + Behavior on y { SpringAnimation { velocity: 200 } } } // Spring Rectangle { color: "#ff0000" x: rect.width * 2; width: rect.width/2; height: 20 - y: 200 - SpringFollow on y { to: rect.y; spring: 1.0; damping: 0.2 } + y: rect.y + Behavior on y { SpringAnimation { spring: 1.0; damping: 0.2 } } } Rectangle { color: "#880000" x: rect.width * 2.5; width: rect.width/2; height: 20 - y: 200 - SpringFollow on y { to: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object + y: rect.y + Behavior on y { SpringAnimation { spring: 1.0; damping: 0.2; mass: 3.0 } } // "heavier" object } // Follow mouse @@ -49,15 +50,22 @@ Rectangle { anchors.fill: parent Rectangle { id: ball + property int targetX: mouseRegion.mouseX - 10 + property int targetY: mouseRegion.mouseY - 10 + + x: targetX + y: targetY width: 20; height: 20 radius: 10 color: "#0000ff" - SpringFollow on x { id: f1; to: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } - SpringFollow on y { id: f2; to: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + + Behavior on x { SpringAnimation { spring: 1.0; damping: 0.05; epsilon: 0.25 } } + Behavior on y { SpringAnimation { spring: 1.0; damping: 0.05; epsilon: 0.25 } } + states: [ State { name: "following" - when: !f1.inSync || !f2.inSync + when: ball.x != ball.targetX || ball.y != ball.targetY PropertyChanges { target: ball; color: "#ff0000" } } ] |