aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickshape
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickshape')
-rw-r--r--tests/auto/quick/qquickshape/BLACKLIST19
-rw-r--r--tests/auto/quick/qquickshape/CMakeLists.txt26
-rw-r--r--tests/auto/quick/qquickshape/data/filltransform.qml58
-rw-r--r--tests/auto/quick/qquickshape/data/multiline.qml29
-rw-r--r--tests/auto/quick/qquickshape/data/multilineStronglyTyped.qml29
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem7.qml29
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem8.qml29
-rw-r--r--tests/auto/quick/qquickshape/data/polyline.qml29
-rw-r--r--tests/auto/quick/qquickshape/tst_qquickshape.cpp176
9 files changed, 191 insertions, 233 deletions
diff --git a/tests/auto/quick/qquickshape/BLACKLIST b/tests/auto/quick/qquickshape/BLACKLIST
new file mode 100644
index 0000000000..f0d5bcd351
--- /dev/null
+++ b/tests/auto/quick/qquickshape/BLACKLIST
@@ -0,0 +1,19 @@
+# QTBUG-103094
+[render]
+android
+[renderWithMultipleSp]
+android
+[radialGrad]
+android
+[conicalGrad]
+android
+[renderPolyline]
+android
+[renderMultiline]
+android
+[polylineDataTypes]
+android
+[multilineDataTypes]
+android
+[multilineStronglyTyped]
+android
diff --git a/tests/auto/quick/qquickshape/CMakeLists.txt b/tests/auto/quick/qquickshape/CMakeLists.txt
index 325d812ed2..b7b536e29d 100644
--- a/tests/auto/quick/qquickshape/CMakeLists.txt
+++ b/tests/auto/quick/qquickshape/CMakeLists.txt
@@ -1,9 +1,18 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qquickshape.pro.
#####################################################################
## tst_qquickshape Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qquickshape LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
@@ -12,22 +21,15 @@ list(APPEND test_data ${test_data_glob})
qt_internal_add_test(tst_qquickshape
SOURCES
- ../../shared/util.cpp ../../shared/util.h
- ../shared/geometrytestutil.cpp ../shared/geometrytestutil.h
- ../shared/viewtestutil.cpp ../shared/viewtestutil.h
- ../shared/visualtestutil.cpp ../shared/visualtestutil.h
tst_qquickshape.cpp
- DEFINES
- QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
- INCLUDE_DIRECTORIES
- ../../shared
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Gui
Qt::GuiPrivate
Qt::QmlPrivate
Qt::QuickPrivate
Qt::QuickShapesPrivate
+ Qt::QuickTestUtilsPrivate
TESTDATA ${test_data}
)
@@ -38,16 +40,16 @@ qt_internal_add_test(tst_qquickshape
#####################################################################
qt_internal_extend_target(tst_qquickshape CONDITION TARGET Qt::Widgets
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Widgets
)
qt_internal_extend_target(tst_qquickshape CONDITION ANDROID OR IOS
DEFINES
- QT_QMLTEST_DATADIR=\\\":/data\\\"
+ QT_QMLTEST_DATADIR=":/data"
)
qt_internal_extend_target(tst_qquickshape CONDITION NOT ANDROID AND NOT IOS
DEFINES
- QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
+ QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
)
diff --git a/tests/auto/quick/qquickshape/data/filltransform.qml b/tests/auto/quick/qquickshape/data/filltransform.qml
new file mode 100644
index 0000000000..4f83c04c43
--- /dev/null
+++ b/tests/auto/quick/qquickshape/data/filltransform.qml
@@ -0,0 +1,58 @@
+import QtQuick
+import QtQuick.Shapes
+import tst_qquickpathitem
+
+Rectangle {
+ width: 440
+ height: 220
+ color: "white"
+
+ Shape {
+ objectName: "shape1"
+ ShapePath {
+ id: path1
+ objectName: "path1"
+ fillGradient: RadialGradient {
+ centerX: path1.startX + 100
+ centerY: path1.startY + 100
+ centerRadius: 100
+ focalX: centerX
+ focalY: centerY
+ GradientStop { position: 0.0; color: "blue" }
+ GradientStop { position: 0.5; color: "cyan" }
+ GradientStop { position: 1.0; color: "blue" }
+ }
+
+ fillTransform: PlanarTransform.fromScale(2, 1);
+
+ startX: 10
+ startY: 10
+ PathLine { relativeX: 200; relativeY: 0 }
+ PathLine { relativeX: 0; relativeY: 200 }
+ PathLine { relativeX: -200; relativeY: 0 }
+ PathLine { relativeX: 0; relativeY: -200 }
+ }
+
+ ShapePath {
+ id: path2
+ objectName: "path2"
+ fillGradient: RadialGradient {
+ centerX: path2.startX + 100
+ centerY: path2.startY + 100
+ centerRadius: 100
+ focalX: centerX
+ focalY: centerY
+ GradientStop { position: 0.0; color: "blue" }
+ GradientStop { position: 0.5; color: "cyan" }
+ GradientStop { position: 1.0; color: "blue" }
+ }
+
+ startX: 220 + 10
+ startY: 10
+ PathLine { relativeX: 200; relativeY: 0 }
+ PathLine { relativeX: 0; relativeY: 200 }
+ PathLine { relativeX: -200; relativeY: 0 }
+ PathLine { relativeX: 0; relativeY: -200 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickshape/data/multiline.qml b/tests/auto/quick/qquickshape/data/multiline.qml
index ad07506972..edf92057c2 100644
--- a/tests/auto/quick/qquickshape/data/multiline.qml
+++ b/tests/auto/quick/qquickshape/data/multiline.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.14
import QtQuick.Shapes 1.14
diff --git a/tests/auto/quick/qquickshape/data/multilineStronglyTyped.qml b/tests/auto/quick/qquickshape/data/multilineStronglyTyped.qml
index 46d650e053..64c61f4331 100644
--- a/tests/auto/quick/qquickshape/data/multilineStronglyTyped.qml
+++ b/tests/auto/quick/qquickshape/data/multilineStronglyTyped.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.14
import QtQuick.Shapes 1.14
diff --git a/tests/auto/quick/qquickshape/data/pathitem7.qml b/tests/auto/quick/qquickshape/data/pathitem7.qml
index b3ef47a4dd..43b42ecabc 100644
--- a/tests/auto/quick/qquickshape/data/pathitem7.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem7.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.14
import tst_qquickpathitem 1.0
diff --git a/tests/auto/quick/qquickshape/data/pathitem8.qml b/tests/auto/quick/qquickshape/data/pathitem8.qml
index 9789ff90e0..8b78dc9429 100644
--- a/tests/auto/quick/qquickshape/data/pathitem8.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem8.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.14
import QtQuick.Shapes 1.14
diff --git a/tests/auto/quick/qquickshape/data/polyline.qml b/tests/auto/quick/qquickshape/data/polyline.qml
index e62d952ae7..9c81bf4031 100644
--- a/tests/auto/quick/qquickshape/data/polyline.qml
+++ b/tests/auto/quick/qquickshape/data/polyline.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.14
import QtQuick.Shapes 1.14
diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
index 3a26f7e382..707e0037f5 100644
--- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp
+++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
#include <QtQuick/qquickview.h>
@@ -36,12 +11,12 @@
#include <QtQuickShapes/private/qquickshape_p.h>
#include <QStandardPaths>
-#include "../../shared/util.h"
-#include "../shared/viewtestutil.h"
-#include "../shared/visualtestutil.h"
+#include <QtQuickTestUtils/private/qmlutils_p.h>
+#include <QtQuickTestUtils/private/viewtestutils_p.h>
+#include <QtQuickTestUtils/private/visualtestutils_p.h>
-using namespace QQuickViewTestUtil;
-using namespace QQuickVisualTestUtil;
+using namespace QQuickViewTestUtils;
+using namespace QQuickVisualTestUtils;
class PolygonProvider : public QObject
{
@@ -87,12 +62,14 @@ private slots:
void multilineDataTypes_data();
void multilineDataTypes();
void multilineStronglyTyped();
+ void fillTransform();
private:
QVector<QPolygonF> m_lowPolyLogo;
};
tst_QQuickShape::tst_QQuickShape()
+ : QQmlDataTest(QT_QMLTEST_DATADIR)
{
// Force the software backend to get reliable rendering results regardless of the hw and drivers.
QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
@@ -228,7 +205,7 @@ void tst_QQuickShape::changeSignals()
QSignalSpy asyncPropSpy(obj, SIGNAL(asynchronousChanged()));
obj->setAsynchronous(true);
obj->setAsynchronous(false);
- QCOMPARE(asyncPropSpy.count(), 2);
+ QCOMPARE(asyncPropSpy.size(), 2);
QQmlListReference list(obj, "data");
QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0));
@@ -248,29 +225,31 @@ void tst_QQuickShape::changeSignals()
vp->setCapStyle(QQuickShapePath::RoundCap);
vp->setDashOffset(10);
vp->setDashPattern(QVector<qreal>() << 1 << 2 << 3 << 4);
- QCOMPARE(strokeColorPropSpy.count(), 1);
- QCOMPARE(vpChangeSpy.count(), 10);
+ QCOMPARE(strokeColorPropSpy.size(), 1);
+ QCOMPARE(vpChangeSpy.size(), 10);
// Verify that property changes from Path and its elements bubble up and result in shapePathChanged().
QQuickPath *path = vp;
path->setStartX(30);
- QCOMPARE(vpChangeSpy.count(), 11);
+ QCOMPARE(vpChangeSpy.size(), 11);
QQmlListReference pathList(path, "pathElements");
qobject_cast<QQuickPathLine *>(pathList.at(1))->setY(200);
- QCOMPARE(vpChangeSpy.count(), 12);
+ QCOMPARE(vpChangeSpy.size(), 12);
// Verify that property changes from the gradient bubble up and result in shapePathChanged().
vp->setFillGradient(g);
- QCOMPARE(vpChangeSpy.count(), 13);
+ QCOMPARE(vpChangeSpy.size(), 13);
QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(g);
lgrad->setX2(200);
- QCOMPARE(vpChangeSpy.count(), 14);
+ QCOMPARE(vpChangeSpy.size(), 14);
QQmlListReference stopList(lgrad, "stops");
QCOMPARE(stopList.count(), 5);
qobject_cast<QQuickGradientStop *>(stopList.at(1))->setPosition(0.3);
- QCOMPARE(vpChangeSpy.count(), 15);
+ QCOMPARE(vpChangeSpy.size(), 15);
qobject_cast<QQuickGradientStop *>(stopList.at(1))->setColor(Qt::black);
- QCOMPARE(vpChangeSpy.count(), 16);
+ QCOMPARE(vpChangeSpy.size(), 16);
+ vp->setFillTransform(QMatrix4x4(QTransform::fromScale(3, 0.14)));
+ QCOMPARE(vpChangeSpy.size(), 17);
}
void tst_QQuickShape::render()
@@ -281,19 +260,18 @@ void tst_QQuickShape::render()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem3.png").toLocalFile());
+ QImage refImg(testFile("pathitem3.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ QVERIFY2(QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage),
qPrintable(errorMessage));
}
@@ -305,19 +283,18 @@ void tst_QQuickShape::renderWithMultipleSp()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem4.png").toLocalFile());
+ QImage refImg(testFile("pathitem4.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ QVERIFY2(QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage),
qPrintable(errorMessage));
}
@@ -329,19 +306,18 @@ void tst_QQuickShape::radialGrad()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem5.png").toLocalFile());
+ QImage refImg(testFile("pathitem5.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ QVERIFY2(QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage),
qPrintable(errorMessage));
}
@@ -353,19 +329,18 @@ void tst_QQuickShape::conicalGrad()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem6.png").toLocalFile());
+ QImage refImg(testFile("pathitem6.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ QVERIFY2(QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage),
qPrintable(errorMessage));
}
@@ -377,19 +352,18 @@ void tst_QQuickShape::renderPolyline()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem3.png").toLocalFile()); // It's a recreation of pathitem3 using PathPolyline
+ QImage refImg(testFile("pathitem3.png")); // It's a recreation of pathitem3 using PathPolyline
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- const bool res = QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage);
+ const bool res = QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage);
if (!res) { // For visual inspection purposes.
QTest::qWait(5000);
const QString &tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@@ -406,19 +380,18 @@ void tst_QQuickShape::renderMultiline()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("pathitem8.png").toLocalFile());
+ QImage refImg(testFile("pathitem8.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- const bool res = QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage);
+ const bool res = QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage);
if (!res) { // For visual inspection purposes.
QTest::qWait(5000);
const QString &tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@@ -472,19 +445,18 @@ void tst_QQuickShape::polylineDataTypes()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("polyline.png").toLocalFile());
+ QImage refImg(testFile("polyline.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- const bool res = QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage);
+ const bool res = QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage);
if (!res) { // For visual inspection purposes.
QTest::qWait(5000);
const QString &tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@@ -623,19 +595,18 @@ void tst_QQuickShape::multilineDataTypes()
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("multiline.png").toLocalFile());
+ QImage refImg(testFile("multiline.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- const bool res = QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage);
+ const bool res = QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage);
if (!res) { // For visual inspection purposes.
QTest::qWait(5000);
const QString &tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@@ -671,19 +642,18 @@ void tst_QQuickShape::multilineStronglyTyped()
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
provider->setPaths(m_lowPolyLogo);
- if ((QGuiApplication::platformName() == QLatin1String("offscreen"))
- || (QGuiApplication::platformName() == QLatin1String("minimal")))
- QEXPECT_FAIL("", "Failure due to grabWindow not functional on offscreen/minimal platforms", Abort);
+ if (QGuiApplication::platformName() == QLatin1String("minimal"))
+ QSKIP("Skipping due to grabWindow not functional on minimal platforms");
QImage img = window->grabWindow();
QVERIFY(!img.isNull());
- QImage refImg(testFileUrl("multiline.png").toLocalFile());
+ QImage refImg(testFile("multiline.png"));
QVERIFY(!refImg.isNull());
QString errorMessage;
const QImage actualImg = img.convertToFormat(refImg.format());
- const bool res = QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage);
+ const bool res = QQuickVisualTestUtils::compareImages(actualImg, refImg, &errorMessage);
if (!res) { // For visual inspection purposes.
QTest::qWait(5000);
const QString &tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
@@ -707,6 +677,40 @@ void tst_QQuickShape::multilineStronglyTyped()
}
}
+void tst_QQuickShape::fillTransform()
+{
+ QScopedPointer<QQuickView> window(createView());
+
+ window->setSource(testFileUrl("filltransform.qml"));
+ qApp->processEvents();
+
+ QQuickShape *obj = findItem<QQuickShape>(window->rootObject(), "shape1");
+ QVERIFY(obj != nullptr);
+ QQmlListReference list(obj, "data");
+ QCOMPARE(list.count(), 2);
+
+ QQuickShapePath *p1 = qobject_cast<QQuickShapePath *>(list.at(0));
+ QVERIFY(p1 != nullptr);
+ QVERIFY(p1->objectName() == "path1");
+ QVERIFY(p1->fillTransform() == QMatrix4x4(2,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1));
+
+ QQuickShapePath *p2 = qobject_cast<QQuickShapePath *>(list.at(1));
+ QVERIFY(p2 != nullptr);
+ QVERIFY(p2->objectName() == "path2");
+ QVERIFY(p2->fillTransform().isIdentity());
+
+ QMatrix4x4 xf(QTransform::fromTranslate(-36, 0).shear(0.35, 0));
+ p1->setFillTransform(xf);
+ QVERIFY(p1->fillTransform() == xf);
+
+ QVERIFY(p2->fillTransform().isIdentity());
+ p2->setFillTransform(xf);
+ QVERIFY(p2->fillTransform() == xf);
+
+ p1->setFillTransform(QMatrix4x4{});
+ QVERIFY(p1->fillTransform().isIdentity());
+}
+
QTEST_MAIN(tst_QQuickShape)
#include "tst_qquickshape.moc"