diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-01-29 16:41:59 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-01-29 16:52:58 +0100 |
commit | b684ba219493fb7b0108ae367d6d033aaa28053b (patch) | |
tree | f1fec8922da198e231416b50ef8f441ef6db065b /tests/auto/quick | |
parent | 97a5cf86345fd72cdff83c03664c19a8f5cdf79a (diff) | |
parent | 8354851b628ebae567a9125cbd0ba69268470c1b (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
dependencies.yaml
Change-Id: Ie3e9dc62031a85e5e81cbdf04694b95159d49fca
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/nodes/tst_nodestest.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/nokeywords/nokeywords.pro | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickcanvasitem/BLACKLIST | 14 | ||||
-rw-r--r-- | tests/auto/quick/qquickfontloader/data/qtbug-20268.qml | 8 | ||||
-rw-r--r-- | tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp | 24 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/data/mapCoordinates.qml | 20 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml | 10 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 24 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/data/changeModelAndDestroyTheOldOne.qml | 34 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 16 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml | 18 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 30 | ||||
-rw-r--r-- | tests/auto/quick/touchmouse/BLACKLIST | 4 |
15 files changed, 181 insertions, 31 deletions
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 249ecd5aa5..1b2b355596 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -30,7 +30,7 @@ #include <QtTest/QtTest> #include <QtGui/QOffscreenSurface> -#include <QtGui/QOpenGLContext> +#include <QOpenGLContext> #include <QtQuick/qsgnode.h> #include <QtQuick/private/qsgbatchrenderer_p.h> #include <QtQuick/private/qsgnodeupdater_p.h> diff --git a/tests/auto/quick/nokeywords/nokeywords.pro b/tests/auto/quick/nokeywords/nokeywords.pro index 6872dac22a..69e1abe43e 100644 --- a/tests/auto/quick/nokeywords/nokeywords.pro +++ b/tests/auto/quick/nokeywords/nokeywords.pro @@ -7,3 +7,5 @@ SOURCES += tst_nokeywords.cpp CONFIG+=parallel_test QT += quick core-private gui-private qml-private quick-private testlib +qtConfig(opengl): \ + QT_PRIVATE += opengl-private diff --git a/tests/auto/quick/qquickcanvasitem/BLACKLIST b/tests/auto/quick/qquickcanvasitem/BLACKLIST new file mode 100644 index 0000000000..21580b6730 --- /dev/null +++ b/tests/auto/quick/qquickcanvasitem/BLACKLIST @@ -0,0 +1,14 @@ +[arcTo::test_transform] +macos +[canvas::test_paint] +macos +[canvas::test_save] +macos +[canvas::test_implicitlySizedParent] +macos ci +[canvas::test_toDataURL] +macos +[fillRect::test_fillRect] +macos +[imagedata::test_rounding] +macos ci diff --git a/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml index 0eafdfa17b..e9282bf2c7 100644 --- a/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml +++ b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml @@ -4,7 +4,7 @@ Rectangle { id: test property variant fontloader: fontloaderelement height: 100; width: 100 - property bool usename: false + property bool useotherfont: false property int statenum: 1 property alias name: fontloaderelement.name property alias source: fontloaderelement.source @@ -15,11 +15,11 @@ Rectangle { } states: [ - State { name: "start"; when: !usename + State { name: "start"; when: !useotherfont PropertyChanges { target: fontloaderelement; source: "tarzeau_ocr_a.ttf" } }, - State { name: "changefont"; when: usename - PropertyChanges { target: fontloaderelement; name: "Tahoma" } + State { name: "changefont"; when: useotherfont + PropertyChanges { target: fontloaderelement; source: "daniel.ttf" } } ] diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index 87a5bd469a..8f6910bee4 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -45,7 +45,6 @@ public: private slots: void initTestCase(); void noFont(); - void namedFont(); void localFont(); void failLocalFont(); void webFont(); @@ -85,19 +84,6 @@ void tst_qquickfontloader::noFont() delete fontObject; } -void tst_qquickfontloader::namedFont() -{ - QString componentStr = "import QtQuick 2.0\nFontLoader { name: \"Helvetica\" }"; - QQmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - - QVERIFY(fontObject != nullptr); - QCOMPARE(fontObject->source(), QUrl("")); - QCOMPARE(fontObject->name(), QString("Helvetica")); - QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); -} - void tst_qquickfontloader::localFont() { QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("tarzeau_ocr_a.ttf").toString() + "\" }"; @@ -223,16 +209,10 @@ void tst_qquickfontloader::changeFontSourceViaState() QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); - window.rootObject()->setProperty("usename", true); - - // This warning should probably not be printed once QTBUG-20268 is fixed - QString warning = QString(testFileUrl("qtbug-20268.qml").toString()) + - QLatin1String(":13:5: QML FontLoader: Cannot load font: \"\""); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + window.rootObject()->setProperty("useotherfont", true); - QEXPECT_FAIL("", "QTBUG-20268", Abort); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(window.rootObject()->property("name").toString(), QString("Tahoma")); + QCOMPARE(window.rootObject()->property("name").toString(), QString("Daniel")); } QTEST_MAIN(tst_qquickfontloader) diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml index 596dedab90..3e34633338 100644 --- a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml +++ b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml @@ -49,11 +49,21 @@ Item { return Qt.point(pos.x, pos.y) } + function mapAToBPoint(x, y) { + var pos = itemA.mapToItem(itemB, Qt.point(x, y)) + return Qt.point(pos.x, pos.y) + } + function mapAFromB(x, y) { var pos = itemA.mapFromItem(itemB, x, y) return Qt.point(pos.x, pos.y) } + function mapAFromBPoint(x, y) { + var pos = itemA.mapFromItem(itemB, Qt.point(x, y)) + return Qt.point(pos.x, pos.y) + } + function mapAToNull(x, y) { var pos = itemA.mapToItem(null, x, y) return Qt.point(pos.x, pos.y) @@ -69,11 +79,21 @@ Item { return Qt.point(pos.x, pos.y) } + function mapAToGlobalPoint(x, y) { + var pos = itemA.mapToGlobal(Qt.point(x, y)) + return Qt.point(pos.x, pos.y) + } + function mapAFromGlobal(x, y) { var pos = itemA.mapFromGlobal(x, y) return Qt.point(pos.x, pos.y) } + function mapAFromGlobalPoint(x, y) { + var pos = itemA.mapFromGlobal(Qt.point(x, y)) + return Qt.point(pos.x, pos.y) + } + function mapOrphanToGlobal(x, y) { var obj = itemComponent.createObject(null); var pos = obj.mapToGlobal(x, y) diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml index 2b856a27fc..c66d1e89b6 100644 --- a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml +++ b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml @@ -45,11 +45,21 @@ Item { return Qt.rect(pos.x, pos.y, pos.width, pos.height) } + function mapAToBRect(x, y, w, h) { + var pos = itemA.mapToItem(itemB, Qt.rect(x, y, w, h)) + return Qt.rect(pos.x, pos.y, pos.width, pos.height) + } + function mapAFromB(x, y, w, h) { var pos = itemA.mapFromItem(itemB, x, y, w, h) return Qt.rect(pos.x, pos.y, pos.width, pos.height) } + function mapAFromBRect(x, y, w, h) { + var pos = itemA.mapFromItem(itemB, Qt.rect(x, y, w, h)) + return Qt.rect(pos.x, pos.y, pos.width, pos.height) + } + function mapAToNull(x, y, w, h) { var pos = itemA.mapToItem(null, x, y, w, h) return Qt.rect(pos.x, pos.y, pos.width, pos.height) diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 607cf91bfe..a1b4a70217 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -2391,10 +2391,18 @@ void tst_QQuickItem::mapCoordinates() Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToItem(b, QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAToBPoint", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); + QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToItem(b, QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromB", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromItem(b, QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromBPoint", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); + QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromItem(b, QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAToNull", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToScene(QPointF(x, y))); @@ -2407,10 +2415,18 @@ void tst_QQuickItem::mapCoordinates() Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToGlobal(QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAToGlobalPoint", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); + QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToGlobal(QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromGlobal", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromGlobal(QPointF(x, y))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromGlobalPoint", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); + QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromGlobal(QPointF(x, y))); + // for orphans we are primarily testing that we don't crash. // when orphaned the final position is the original position of the item translated by x,y QVERIFY(QMetaObject::invokeMethod(root, "mapOrphanToGlobal", @@ -2472,10 +2488,18 @@ void tst_QQuickItem::mapCoordinatesRect() Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height))); QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectToItem(b, QRectF(x, y, width, height))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAToBRect", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height))); + QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectToItem(b, QRectF(x, y, width, height))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromB", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height))); QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectFromItem(b, QRectF(x, y, width, height))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAFromBRect", + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height))); + QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectFromItem(b, QRectF(x, y, width, height))); + QVERIFY(QMetaObject::invokeMethod(root, "mapAToNull", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height))); QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectToScene(QRectF(x, y, width, height))); diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST index 1f3736328a..6ef69550a4 100644 --- a/tests/auto/quick/qquicklistview/BLACKLIST +++ b/tests/auto/quick/qquicklistview/BLACKLIST @@ -5,10 +5,10 @@ opensuse-leap [populateTransitions] opensuse-42.1 [contentHeightWithDelayRemove] -osx-10.12 +macos #QTBUG-75960 #QTBUG-76652 [currentIndex] -osx-10.12 +macos opensuse-leap ubuntu-18.04 diff --git a/tests/auto/quick/qquicklistview/data/changeModelAndDestroyTheOldOne.qml b/tests/auto/quick/qquicklistview/data/changeModelAndDestroyTheOldOne.qml new file mode 100644 index 0000000000..6a33decde6 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/changeModelAndDestroyTheOldOne.qml @@ -0,0 +1,34 @@ +import QtQuick 2.13 +import QtQml 2.13 +import QtQml.Models 2.13 + +Rectangle { + width: 640 + height: 480 + property var model1: null + property var model2: null + Component { + id: m1 + ObjectModel { + Rectangle { height: 30; width: 80; color: "red" } + Rectangle { height: 30; width: 80; color: "green" } + Rectangle { height: 30; width: 80; color: "blue" } + } + } + Component { + id: m2 + ObjectModel { + Rectangle { height: 30; width: 80; color: "red" } + } + } + ListView { + anchors.fill: parent + Component.onCompleted: { + model1 = m1.createObject() + model = model1 + model2 = m2.createObject() + model = model2 + model1.destroy() + } + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index e527853148..9a8dfee9d2 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -289,6 +289,7 @@ private slots: void reuse_reuseIsOffByDefault(); void reuse_checkThatItemsAreReused(); void moveObjectModelItemToAnotherObjectModel(); + void changeModelAndDestroyTheOldOne(); private: template <class T> void items(const QUrl &source); @@ -9415,6 +9416,21 @@ void tst_QQuickListView::moveObjectModelItemToAnotherObjectModel() QVERIFY(!QQuickItemPrivate::get(redRect)->culled); } +void tst_QQuickListView::changeModelAndDestroyTheOldOne() // QTBUG-80203 +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("changeModelAndDestroyTheOldOne.qml")); + window->resize(640, 480); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickItem *root = window->rootObject(); + QVERIFY(root); + + QVERIFY(QQuickTest::qWaitForItemPolished(root)); + // no crash +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST index 594f9af3b3..b551575e9d 100644 --- a/tests/auto/quick/qquicktext/BLACKLIST +++ b/tests/auto/quick/qquicktext/BLACKLIST @@ -1,7 +1,7 @@ [dependentImplicitSizes] b2qt qemu -osx-10.12 +macos [fontSizeMode] opensuse-42.1 [contentSize] diff --git a/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml b/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml new file mode 100644 index 0000000000..b0ed21a0c8 --- /dev/null +++ b/tests/auto/quick/qquicktext/data/displaySuperscriptedTag.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +Rectangle { + width: 200 + height: 200 + color: "white" + Text { + objectName: "text" + textFormat: Text.RichText + anchors.fill: parent + color: "black" + // display a black rectangle at the top left of the text + text: "<span style=\"background-color:rgba(255,255,255,255);vertical-align:super;\">█</span>This is a test" + verticalAlignment: Text.AlignTop + horizontalAlignment: Text.AlignLeft + font.pixelSize: 30 + } +} diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 06ce730091..19a33f1861 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -168,6 +168,8 @@ private slots: void transparentBackground(); + void displaySuperscriptedTag(); + private: QStringList standard; QStringList richText; @@ -1504,7 +1506,7 @@ void tst_qquicktext::weight() delete textObject; } { - QString componentStr = "import QtQuick 2.0\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 2.0\nText { font.weight: Font.Bold; text: \"Hello world!\" }"; QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); @@ -4507,6 +4509,32 @@ void tst_qquicktext::transparentBackground() QCOMPARE(color.blue(), 255); QCOMPARE(color.green(), 255); } + +void tst_qquicktext::displaySuperscriptedTag() +{ + if ((QGuiApplication::platformName() == QLatin1String("offscreen")) + || (QGuiApplication::platformName() == QLatin1String("minimal"))) + QSKIP("Skipping due to grabToImage not functional on offscreen/minimimal platforms"); + + QScopedPointer<QQuickView> window(new QQuickView); + window->setSource(testFileUrl("displaySuperscriptedTag.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickText *text = window->findChild<QQuickText *>("text"); + QVERIFY(text); + + QImage img = window->grabWindow(); + QCOMPARE(img.isNull(), false); + + QColor color = img.pixelColor(1, static_cast<int>(text->contentHeight()) / 4 * 3); + QCOMPARE(color.red(), 255); + QCOMPARE(color.blue(), 255); + QCOMPARE(color.green(), 255); +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" diff --git a/tests/auto/quick/touchmouse/BLACKLIST b/tests/auto/quick/touchmouse/BLACKLIST index 0dfe28087a..9afc86c2fe 100644 --- a/tests/auto/quick/touchmouse/BLACKLIST +++ b/tests/auto/quick/touchmouse/BLACKLIST @@ -4,3 +4,7 @@ windows gcc developer-build # QTBUG-74517 [buttonOnFlickable] windows gcc developer-build + +# QTBUG-74517 +[touchButtonOnFlickable] +windows gcc developer-build |