diff options
Diffstat (limited to 'tests/auto')
22 files changed, 114 insertions, 29 deletions
diff --git a/tests/auto/particles/shared/table.png b/tests/auto/particles/shared/table.png Binary files differindex a62ceeb4a0..15509ab5b7 100644 --- a/tests/auto/particles/shared/table.png +++ b/tests/auto/particles/shared/table.png diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.pro b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.pro deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.pro +++ /dev/null diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png b/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png Binary files differindex 30228cbbdc..b54163f926 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/TestImage_2x2.png diff --git a/tests/auto/qml/qqmlbinding/data/delayed.qml b/tests/auto/qml/qqmlbinding/data/delayed.qml new file mode 100644 index 0000000000..6f8281cc33 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/data/delayed.qml @@ -0,0 +1,26 @@ +import QtQuick 2.8 + +Item { + width: 400 + height: 400 + + property int changeCount: 0 + + property string text1 + property string text2 + + function updateText() { + text1 = "Hello" + text2 = "World" + } + + Text { + anchors.centerIn: parent + Binding on text { + value: text1 + " " + text2 + delayed: true + } + onTextChanged: ++changeCount + } +} + diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 3e8dfbdb12..6f1d82eca5 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -49,6 +49,7 @@ private slots: void warningOnReadOnlyProperty(); void disabledOnUnknownProperty(); void disabledOnReadonlyProperty(); + void delayed(); private: QQmlEngine engine; @@ -281,6 +282,27 @@ void tst_qqmlbinding::disabledOnReadonlyProperty() QCOMPARE(messageHandler.messages().count(), 0); } +void tst_qqmlbinding::delayed() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("delayed.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + + QVERIFY(item != 0); + // update on creation + QCOMPARE(item->property("changeCount").toInt(), 1); + + QMetaObject::invokeMethod(item, "updateText"); + // doesn't update immediately + QCOMPARE(item->property("changeCount").toInt(), 1); + + QCoreApplication::processEvents(); + // only updates once (non-delayed would update twice) + QCOMPARE(item->property("changeCount").toInt(), 2); + + delete item; +} + QTEST_MAIN(tst_qqmlbinding) #include "tst_qqmlbinding.moc" diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index e0d75e7baa..81b9b8d7bf 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -790,6 +790,7 @@ public: Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_QScriptValue(QJSValue a) { invoke(14); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_intQScriptValue(int a, QJSValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } + Q_INVOKABLE void method_QByteArray(QByteArray value) { invoke(29); m_actuals << value; } Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 5ca760020c..f71d7efe3a 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2346,7 +2346,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::Value &o, scope.engine->catchException(); return false; } - return QV4::Runtime::strictEqual(value, result); + return QV4::Runtime::method_strictEqual(value, result); } static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o, @@ -2937,6 +2937,13 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); QCOMPARE(o->actuals().count(), 0); + + o->reset(); + QVERIFY(EVALUATE_VALUE("object.method_QByteArray(\"Hello\")", QV4::Primitive::undefinedValue())); + QCOMPARE(o->error(), false); + QCOMPARE(o->invoked(), 29); + QCOMPARE(o->actuals().count(), 1); + QCOMPARE(qvariant_cast<QByteArray>(o->actuals().at(0)), QByteArray("Hello")); } // QTBUG-13047 (check that you can pass registered object types as args) diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml index 9b9b7922da..94ee46ddf0 100644 --- a/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml +++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml @@ -1,4 +1,4 @@ -import QtQml 2.5 +import QtQml 2.50 QtObject { } diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 3208745c5c..3af1cf46b3 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -615,9 +615,9 @@ void tst_qqmlengine::qtqmlModule_data() << QString(testFileUrl("qtqmlModule.3.qml").toString() + QLatin1String(":1 module \"QtQml\" version 1.0 is not installed\n")) << QStringList(); - QTest::newRow("import QtQml of incorrect version (2.5)") + QTest::newRow("import QtQml of incorrect version (2.50)") << testFileUrl("qtqmlModule.4.qml") - << QString(testFileUrl("qtqmlModule.4.qml").toString() + QLatin1String(":1 module \"QtQml\" version 2.5 is not installed\n")) + << QString(testFileUrl("qtqmlModule.4.qml").toString() + QLatin1String(":1 module \"QtQml\" version 2.50 is not installed\n")) << QStringList(); QTest::newRow("QtQml 2.0 module provides Component, QtObject, Connections, Binding and Timer") diff --git a/tests/auto/qmltest/animators/tst_zeroduration.qml b/tests/auto/qmltest/animators/tst_zeroduration.qml new file mode 100644 index 0000000000..83ce235f42 --- /dev/null +++ b/tests/auto/qmltest/animators/tst_zeroduration.qml @@ -0,0 +1,35 @@ +import QtQuick 2.2 +import QtTest 1.1 + +Item { + id: root; + width: 200 + height: 200 + + TestCase { + id: testCase + name: "animators-y" + when: box.y == 100 + function test_endresult() { + compare(box.yChangeCounter, 1); + var image = grabImage(root); + verify(image.pixel(0, 100) == Qt.rgba(1, 0, 0)); + verify(image.pixel(0, 99) == Qt.rgba(1, 1, 1)); // outside on the top + } + } + + Box { + id: box + + anchors.centerIn: undefined + + YAnimator { + id: animation + target: box + from: 0; + to: 100 + duration: 0 + running: true + } + } +} diff --git a/tests/auto/qmltest/borderimage/colors.png b/tests/auto/qmltest/borderimage/colors.png Binary files differindex dfb62f3d64..57f5aca821 100644 --- a/tests/auto/qmltest/borderimage/colors.png +++ b/tests/auto/qmltest/borderimage/colors.png diff --git a/tests/auto/quick/qquickanimatedimage/data/green.png b/tests/auto/quick/qquickanimatedimage/data/green.png Binary files differindex 0a2e153ba1..4718c00e62 100644 --- a/tests/auto/quick/qquickanimatedimage/data/green.png +++ b/tests/auto/quick/qquickanimatedimage/data/green.png diff --git a/tests/auto/quick/qquickborderimage/data/colors.png b/tests/auto/quick/qquickborderimage/data/colors.png Binary files differindex dfb62f3d64..57f5aca821 100644 --- a/tests/auto/quick/qquickborderimage/data/colors.png +++ b/tests/auto/quick/qquickborderimage/data/colors.png diff --git a/tests/auto/quick/qquickimage/data/colors.png b/tests/auto/quick/qquickimage/data/colors.png Binary files differindex dfb62f3d64..57f5aca821 100644 --- a/tests/auto/quick/qquickimage/data/colors.png +++ b/tests/auto/quick/qquickimage/data/colors.png diff --git a/tests/auto/quick/qquickimage/data/colors1.png b/tests/auto/quick/qquickimage/data/colors1.png Binary files differindex dfb62f3d64..57f5aca821 100644 --- a/tests/auto/quick/qquickimage/data/colors1.png +++ b/tests/auto/quick/qquickimage/data/colors1.png diff --git a/tests/auto/quick/qquickimage/data/green.png b/tests/auto/quick/qquickimage/data/green.png Binary files differindex 0a2e153ba1..4718c00e62 100644 --- a/tests/auto/quick/qquickimage/data/green.png +++ b/tests/auto/quick/qquickimage/data/green.png diff --git a/tests/auto/quick/qquickimage/data/rect.png b/tests/auto/quick/qquickimage/data/rect.png Binary files differindex d564a2d5a5..fe839a40e4 100644 --- a/tests/auto/quick/qquickimage/data/rect.png +++ b/tests/auto/quick/qquickimage/data/rect.png diff --git a/tests/auto/quick/qquickpixmapcache/data/massive.png b/tests/auto/quick/qquickpixmapcache/data/massive.png Binary files differindex bc6cc9e6ca..9a3e0e112f 100644 --- a/tests/auto/quick/qquickpixmapcache/data/massive.png +++ b/tests/auto/quick/qquickpixmapcache/data/massive.png diff --git a/tests/auto/quick/qquickstates/data/image.png b/tests/auto/quick/qquickstates/data/image.png Binary files differindex ed1833c95b..0e681ba1e1 100644 --- a/tests/auto/quick/qquickstates/data/image.png +++ b/tests/auto/quick/qquickstates/data/image.png diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST index 0c65f1e245..223d8feb67 100644 --- a/tests/auto/quick/qquicktext/BLACKLIST +++ b/tests/auto/quick/qquicktext/BLACKLIST @@ -2,3 +2,5 @@ * [mouseSelection] * +[lineLaidOutRelayout] +msvc-2015 diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 1cd3d1f9e2..7ea36bbafa 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -59,6 +59,7 @@ public: tst_qquicktext(); private slots: + void cleanup(); void text(); void width(); void wrap(); @@ -169,6 +170,11 @@ private: int numberOfNonWhitePixels(int fromX, int toX, const QImage &image); }; +void tst_qquicktext::cleanup() +{ + QVERIFY(QGuiApplication::topLevelWindows().isEmpty()); +} + tst_qquicktext::tst_qquicktext() { standard << "the quick brown fox jumped over the lazy dog" @@ -551,7 +557,7 @@ void tst_qquicktext::multilineElide_data() void tst_qquicktext::multilineElide() { QFETCH(QQuickText::TextFormat, format); - QQuickView *window = createView(testFile("multilineelide.qml")); + QScopedPointer<QQuickView> window(createView(testFile("multilineelide.qml"))); QQuickText *myText = qobject_cast<QQuickText*>(window->rootObject()); QVERIFY(myText != 0); @@ -595,8 +601,6 @@ void tst_qquicktext::multilineElide() // change line height myText->setLineHeight(1.1); QCOMPARE(myText->lineCount(), 1); - - delete window; } void tst_qquicktext::implicitElide_data() @@ -758,7 +762,7 @@ void tst_qquicktext::horizontalAlignment_RightToLeft() dummy.showFullScreen(); // so make test window a second window. #endif - QQuickView *window = createView(testFile("horizontalAlignment_RightToLeft.qml")); + QScopedPointer<QQuickView> window(createView(testFile("horizontalAlignment_RightToLeft.qml"))); QQuickText *text = window->rootObject()->findChild<QQuickText*>("text"); QVERIFY(text != 0); window->showNormal(); @@ -861,7 +865,7 @@ void tst_qquicktext::horizontalAlignment_RightToLeft() text->setHAlign(QQuickText::AlignRight); QCOMPARE(text->hAlign(), QQuickText::AlignRight); - delete window; + window.reset(); // alignment of Text with no text set to it QString componentStr = "import QtQuick 2.0\nText {}"; @@ -2100,7 +2104,7 @@ void tst_qquicktext::embeddedImages() void tst_qquicktext::lineCount() { - QQuickView *window = createView(testFile("lineCount.qml")); + QScopedPointer<QQuickView> window(createView(testFile("lineCount.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2123,13 +2127,11 @@ void tst_qquicktext::lineCount() QCOMPARE(myText->lineCount(), 2); QCOMPARE(myText->truncated(), true); QCOMPARE(myText->maximumLineCount(), 2); - - delete window; } void tst_qquicktext::lineHeight() { - QQuickView *window = createView(testFile("lineHeight.qml")); + QScopedPointer<QQuickView> window(createView(testFile("lineHeight.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2156,8 +2158,6 @@ void tst_qquicktext::lineHeight() myText->setLineHeightMode(QQuickText::FixedHeight); myText->setLineHeight(10); QCOMPARE(myText->height(), myText->lineCount() * 10.0); - - delete window; } void tst_qquicktext::implicitSize_data() @@ -2729,7 +2729,7 @@ void tst_qquicktext::clipRect() void tst_qquicktext::lineLaidOut() { - QQuickView *window = createView(testFile("lineLayout.qml")); + QScopedPointer<QQuickView> window(createView(testFile("lineLayout.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2749,17 +2749,15 @@ void tst_qquicktext::lineLaidOut() QCOMPARE(r.height(), qreal(20)); } } - - delete window; } void tst_qquicktext::lineLaidOutRelayout() { - QQuickView *window = createView(testFile("lineLayoutRelayout.qml")); + QScopedPointer<QQuickView> window(createView(testFile("lineLayoutRelayout.qml"))); window->show(); window->requestActivate(); - QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2782,13 +2780,11 @@ void tst_qquicktext::lineLaidOutRelayout() QCOMPARE(r.y(), i * h - maxH); } } - - delete window; } void tst_qquicktext::lineLaidOutHAlign() { - QQuickView *window = createView(testFile("lineLayoutHAlign.qml")); + QScopedPointer<QQuickView> window(createView(testFile("lineLayoutHAlign.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2799,8 +2795,6 @@ void tst_qquicktext::lineLaidOutHAlign() QCOMPARE(textPrivate->layout.lineCount(), 1); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().x() < 0.0); - - delete window; } void tst_qquicktext::imgTagsBaseUrl_data() @@ -2960,7 +2954,7 @@ void tst_qquicktext::imgTagsMultipleImages() void tst_qquicktext::imgTagsElide() { - QQuickView *window = createView(testFile("imgTagsElide.qml")); + QScopedPointer<QQuickView> window(createView(testFile("imgTagsElide.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2971,12 +2965,11 @@ void tst_qquicktext::imgTagsElide() QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); delete myText; - delete window; } void tst_qquicktext::imgTagsUpdates() { - QQuickView *window = createView(testFile("imgTagsUpdates.qml")); + QScopedPointer<QQuickView> window(createView(testFile("imgTagsUpdates.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); QVERIFY(myText != 0); @@ -2998,7 +2991,6 @@ void tst_qquicktext::imgTagsUpdates() QCOMPARE(spy.count(), 3); delete myText; - delete window; } void tst_qquicktext::imgTagsError() diff --git a/tests/auto/quick/qquickwindow/data/colors.png b/tests/auto/quick/qquickwindow/data/colors.png Binary files differindex dfb62f3d64..57f5aca821 100644 --- a/tests/auto/quick/qquickwindow/data/colors.png +++ b/tests/auto/quick/qquickwindow/data/colors.png |