diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-07-31 13:29:40 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-08-08 12:44:23 +0000 |
commit | 0047b3bdc0938077d7049f4103f835b52897b93a (patch) | |
tree | 346956ce402d8d244d67c7f477df8763174a5ae1 /tests/auto | |
parent | 003e24d72a9647e2dc397906234059fee19103ec (diff) |
shapes: Add support for conical gradients
Task-number: QTBUG-61857
Change-Id: Iacefcc3b22b31ed3dbcfbf7f00c8b0ea51c63b95
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem6.png | bin | 0 -> 11024 bytes | |||
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem6.qml | 35 | ||||
-rw-r--r-- | tests/auto/quick/qquickshape/tst_qquickshape.cpp | 19 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickshape/data/pathitem6.png b/tests/auto/quick/qquickshape/data/pathitem6.png Binary files differnew file mode 100644 index 0000000000..d9e53d6c00 --- /dev/null +++ b/tests/auto/quick/qquickshape/data/pathitem6.png diff --git a/tests/auto/quick/qquickshape/data/pathitem6.qml b/tests/auto/quick/qquickshape/data/pathitem6.qml new file mode 100644 index 0000000000..fafcc48196 --- /dev/null +++ b/tests/auto/quick/qquickshape/data/pathitem6.qml @@ -0,0 +1,35 @@ +import QtQuick 2.9 +import tst_qquickpathitem 1.0 + +Item { + width: 200 + height: 150 + + Shape { + vendorExtensionsEnabled: false + objectName: "pathItem" + anchors.fill: parent + + ShapePath { + strokeWidth: 4 + strokeColor: "red" + fillGradient: ConicalGradient { + centerX: 100; centerY: 100; angle: 45 + GradientStop { position: 0; color: "#00000000" } + GradientStop { position: 0.10; color: "#ffe0cc73" } + GradientStop { position: 0.17; color: "#ffc6a006" } + GradientStop { position: 0.46; color: "#ff600659" } + GradientStop { position: 0.72; color: "#ff0680ac" } + GradientStop { position: 0.92; color: "#ffb9d9e6" } + GradientStop { position: 1.00; color: "#00000000" } + } + fillColor: "blue" // ignored with the gradient set + strokeStyle: ShapePath.DashLine + dashPattern: [ 1, 4 ] + startX: 20; startY: 20 + PathLine { x: 180; y: 130 } + PathLine { x: 20; y: 130 } + PathLine { x: 20; y: 20 } + } + } +} diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index a779b23abd..1b5b345d19 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -56,6 +56,7 @@ private slots: void render(); void renderWithMultipleSp(); void radialGrad(); + void conicalGrad(); }; tst_QQuickShape::tst_QQuickShape() @@ -69,6 +70,7 @@ tst_QQuickShape::tst_QQuickShape() qmlRegisterUncreatableType<QQuickShapeGradient>(uri, 1, 0, "ShapeGradient", QQuickShapeGradient::tr("ShapeGradient is an abstract base class")); qmlRegisterType<QQuickShapeLinearGradient>(uri, 1, 0, "LinearGradient"); qmlRegisterType<QQuickShapeRadialGradient>(uri, 1, 0, "RadialGradient"); + qmlRegisterType<QQuickShapeConicalGradient>(uri, 1, 0, "ConicalGradient"); } void tst_QQuickShape::initValues() @@ -264,6 +266,23 @@ void tst_QQuickShape::radialGrad() QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); } +void tst_QQuickShape::conicalGrad() +{ + QScopedPointer<QQuickView> window(createView()); + + window->setSource(testFileUrl("pathitem6.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QImage img = window->grabWindow(); + QVERIFY(!img.isNull()); + + QImage refImg(testFileUrl("pathitem6.png").toLocalFile()); + QVERIFY(!refImg.isNull()); + + QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); +} + QTEST_MAIN(tst_QQuickShape) #include "tst_qquickshape.moc" |