diff options
Diffstat (limited to 'tests/auto')
15 files changed, 116 insertions, 20 deletions
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml index f723dc3e2e..d35ec84e23 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml +++ b/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml @@ -112,7 +112,7 @@ QtObject { if (m != Qt.matrix4x4(4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7)) qtquickTypeSuccess = false; if (m.toString() != "QMatrix4x4(4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7)") qtquickTypeSuccess = false; c = "blue"; - if (c.toString() != Qt.rgba(0,0,1,0).toString()) qtquickTypeSuccess = false; + if (c.toString() != Qt.rgba(0,0,1,1).toString()) qtquickTypeSuccess = false; if (c.toString() != "#0000FF" && c.toString() != "#0000ff") qtquickTypeSuccess = false; // color string converter is special // no string converter for fonts. } diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml index 8701dae612..141404b067 100644 --- a/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml +++ b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml @@ -15,12 +15,12 @@ MyTypeObject { // compare different color.toString()s property bool colorToStringEqualsColorString: (color.toString() == colorToString) // true - property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // true + property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.34).toString()) // true property bool colorToStringEqualsDifferentRgbaString: (color.toString() == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false // compare colors to strings property bool colorEqualsColorString: (color == colorToString) // false - property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // false + property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34).toString()) // false property bool colorEqualsDifferentRgbaString: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false // compare colors to various value types diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index c8107e58bf..58755927b5 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -937,7 +937,7 @@ void tst_qqmlvaluetypes::color() QQmlComponent component(&engine, testFileUrl("color_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); QVERIFY(object != 0); - QString colorString("#33e199"); + QString colorString("#5733e199"); QCOMPARE(object->property("colorToString").toString(), colorString); QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true); QCOMPARE(object->property("colorEqualsDifferentAlpha").toBool(), false); diff --git a/tests/auto/quick/qquickbehaviors/data/Accelerator.qml b/tests/auto/quick/qquickbehaviors/data/Accelerator.qml new file mode 100644 index 0000000000..a2b5146c3f --- /dev/null +++ b/tests/auto/quick/qquickbehaviors/data/Accelerator.qml @@ -0,0 +1,18 @@ +import QtQuick 2.3 + +Rectangle { + property alias value: range.width + color: "yellow" + Text { + text: 'value: ' + value + } + + Rectangle { + id: range + objectName: "range" + color: "red" + width: 0 + height: 5 + anchors.bottom: parent.bottom + } +} diff --git a/tests/auto/quick/qquickbehaviors/data/aliased.qml b/tests/auto/quick/qquickbehaviors/data/aliased.qml new file mode 100644 index 0000000000..e65e035d83 --- /dev/null +++ b/tests/auto/quick/qquickbehaviors/data/aliased.qml @@ -0,0 +1,39 @@ +import QtQuick 2.3 + +Rectangle { + width: 400 + height: 400 + id: rect + property bool accelerating : false + + Text { + anchors.centerIn: parent + text: "Press anywere to accelerate" + } + + Accelerator { + id: acc + objectName: "acc" + anchors.fill: parent + value: accelerating ? 400 : 0 + Behavior on value { + NumberAnimation { + duration: 500 + } + } + } + + MouseArea { + id: clicker + anchors.fill: parent + } + + states: State { + name: "moved" + when: clicker.pressed + PropertyChanges { + target: rect + accelerating: true + } + } +} diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index 643bed4376..635958314f 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -76,6 +76,7 @@ private slots: void multipleChangesToValueType(); void currentValue(); void disabledWriteWhileRunning(); + void aliasedProperty(); }; void tst_qquickbehaviors::simpleBehavior() @@ -576,6 +577,23 @@ void tst_qquickbehaviors::disabledWriteWhileRunning() } } +void tst_qquickbehaviors::aliasedProperty() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("aliased.qml")); + QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle*>(c.create())); + QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); + + QQuickItemPrivate::get(rect.data())->setState("moved"); + QScopedPointer<QQuickRectangle> acc(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("acc"))); + QScopedPointer<QQuickRectangle> range(qobject_cast<QQuickRectangle*>(acc->findChild<QQuickRectangle*>("range"))); + QTRY_VERIFY(acc->property("value").toDouble() > 0); + QTRY_VERIFY(range->width() > 0); + QTRY_VERIFY(acc->property("value").toDouble() < 400); + QTRY_VERIFY(range->width() < 400); + //i.e. the behavior has been triggered +} + QTEST_MAIN(tst_qquickbehaviors) #include "tst_qquickbehaviors.moc" diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 071ea0b494..265579ead2 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -123,7 +123,7 @@ void tst_qquickborderimage::imageSource_data() << "<Unknown File>:2:1: QML BorderImage: Cannot open: " + testFileUrl("no-such-file.png").toString(); QTest::newRow("remote") << "/colors.png" << true << ""; QTest::newRow("remote not found") << "/no-such-file.png" << true - << "<Unknown File>:2:1: QML BorderImage: Error downloading {{ServerBaseUrl}}/no-such-file.png - server replied: Not found"; + << "<Unknown File>:2:1: QML BorderImage: Error transferring {{ServerBaseUrl}}/no-such-file.png - server replied: Not found"; } void tst_qquickborderimage::imageSource() diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 71e9d747f4..3975654694 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -154,7 +154,7 @@ void tst_qquickimage::imageSource_data() if (QImageReader::supportedImageFormats().contains("svgz")) QTest::newRow("remote svgz") << "/heart.svgz" << 550.0 << 500.0 << true << false << false << ""; QTest::newRow("remote not found") << "/no-such-file.png" << 0.0 << 0.0 << true - << false << true << "<Unknown File>:2:1: QML Image: Error downloading {{ServerBaseUrl}}/no-such-file.png - server replied: Not found"; + << false << true << "<Unknown File>:2:1: QML Image: Error transferring {{ServerBaseUrl}}/no-such-file.png - server replied: Not found"; } diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml index 0b0b15a767..a9c5030e12 100644 --- a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml +++ b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml @@ -65,12 +65,20 @@ Item { } function checkMapAToInvalid(x, y) { - var pos = itemA.mapToItem(1122, x, y) - return pos == undefined; + try { + itemA.mapToItem(1122, x, y) + } catch (e) { + return e instanceof TypeError + } + return false } function checkMapAFromInvalid(x, y) { - var pos = itemA.mapFromItem(1122, x, y) - return pos == undefined; + try { + itemA.mapFromItem(1122, x, y) + } catch (e) { + return e instanceof TypeError + } + return false } } diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml index e21aab1f01..c127407eae 100644 --- a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml +++ b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml @@ -66,12 +66,20 @@ Item { } function checkMapAToInvalid(x, y, w, h) { - var pos = itemA.mapToItem(1122, x, y, w, h) - return pos == undefined; + try { + itemA.mapToItem(1122, x, y, w, h) + } catch (e) { + return e instanceof TypeError + } + return false; } function checkMapAFromInvalid(x, y, w, h) { - var pos = itemA.mapFromItem(1122, x, y, w, h) - return pos == undefined; + try { + itemA.mapFromItem(1122, x, y, w, h) + } catch (e) { + return e instanceof TypeError + } + return false; } } diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp index 0064212a78..0fc8a7f001 100644 --- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp +++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp @@ -148,7 +148,7 @@ void tst_qquickpixmapcache::single() QString expectedError; if (neterror) { - expectedError = "Error downloading " + target.toString() + " - server replied: Not found"; + expectedError = "Error transferring " + target.toString() + " - server replied: Not found"; } else if (!exists) { expectedError = "Cannot open: " + target.toString(); } diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 3f37cf233b..46eae89024 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -2050,7 +2050,7 @@ void tst_qquicktext::embeddedImages_data() QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << ""; QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << ""; QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml") - << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading {{ServerBaseUrl}}/notexists.png - server replied: Not found"; + << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error transferring {{ServerBaseUrl}}/notexists.png - server replied: Not found"; QTest::newRow("remote-relative") << testFileUrl("embeddedImagesRemoteRelative.qml") << ""; } diff --git a/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml b/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml index 017bab97a7..1280a655f0 100644 --- a/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml +++ b/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml @@ -10,5 +10,6 @@ Rectangle { anchors.centerIn: parent horizontalAlignment: Text.AlignLeft font.pointSize: 12 + font.family: "Times New Roman" } } diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index b0ab58538a..c7de73da88 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2368,8 +2368,8 @@ void tst_qquicktextedit::positionAt() secondLine.setLineWidth(texteditObject->width()); layout.endLayout(); - qreal y0; - qreal y1; + qreal y0 = 0; + qreal y1 = 0; switch (verticalAlignment) { case QQuickTextEdit::AlignTop: @@ -5263,8 +5263,8 @@ void tst_qquicktextedit::embeddedImages_data() QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << ""; QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << ""; QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml") - << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML TextEdit: Error downloading {{ServerBaseUrl}}/notexists.png - server replied: Not found"; - QTest::newRow("remote-relative") << testFileUrl("embeddedImagesRemoteRelative.qml") << ""; + << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML TextEdit: Error transferring {{ServerBaseUrl}}/notexists.png - server replied: Not found"; + QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << ""; } void tst_qquicktextedit::embeddedImages() diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 493c03d00e..2a687b3c69 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -5087,6 +5087,10 @@ void tst_qquicktextinput::keySequence_data() << standard.at(0) << QKeySequence(QKeySequence::DeleteStartOfWord) << 7 << 7 << 4 << (standard.at(0).mid(0, 4) + standard.at(0).mid(7)) << QString() << QQuickTextInput::Normal << Qt::Key_Direction_L; + QTest::newRow("delete complete line") + << standard.at(0) << QKeySequence(QKeySequence::DeleteCompleteLine) << 0 << 0 + << 0 << QString() << QString() + << QQuickTextInput::Normal << Qt::Key_Direction_L; } void tst_qquicktextinput::keySequence() |