diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-06 14:54:37 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-08 10:32:18 +0000 |
commit | f4f89858cffa1107af5139dfb1e1d7b16ca3a1a0 (patch) | |
tree | 848471b6d85eebfea8915f1da89b26286f0dbbc7 /tests/auto/quick/qquickshape | |
parent | 8a5837467d153c50c869625390a584b0335b77b7 (diff) |
Use GradientStop and rename ShapeLinearGradient to LinearGradient
Thus application code becomes:
ShapePath {
...
fillGradient: LinearGradient {
...
GradientStop { ... }
}
}
which is even more clean and readable. The duplication for stops is
now avoided.
Change-Id: I50ae2f388e21683a37dc4787763dc71e16eef4f5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickshape')
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem3.qml | 12 | ||||
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem4.qml | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickshape/tst_qquickshape.cpp | 7 |
3 files changed, 12 insertions, 13 deletions
diff --git a/tests/auto/quick/qquickshape/data/pathitem3.qml b/tests/auto/quick/qquickshape/data/pathitem3.qml index 3b819991e6..fccd1aa2de 100644 --- a/tests/auto/quick/qquickshape/data/pathitem3.qml +++ b/tests/auto/quick/qquickshape/data/pathitem3.qml @@ -13,14 +13,14 @@ Item { ShapePath { strokeWidth: 4 strokeColor: "red" - fillGradient: ShapeLinearGradient { + fillGradient: LinearGradient { x1: 20; y1: 20 x2: 180; y2: 130 - ShapeGradientStop { position: 0; color: "blue" } - ShapeGradientStop { position: 0.2; color: "green" } - ShapeGradientStop { position: 0.4; color: "red" } - ShapeGradientStop { position: 0.6; color: "yellow" } - ShapeGradientStop { position: 1; color: "cyan" } + GradientStop { position: 0; color: "blue" } + GradientStop { position: 0.2; color: "green" } + GradientStop { position: 0.4; color: "red" } + GradientStop { position: 0.6; color: "yellow" } + GradientStop { position: 1; color: "cyan" } } strokeStyle: ShapePath.DashLine dashPattern: [ 1, 4 ] diff --git a/tests/auto/quick/qquickshape/data/pathitem4.qml b/tests/auto/quick/qquickshape/data/pathitem4.qml index 26e7084b8d..1d769051ee 100644 --- a/tests/auto/quick/qquickshape/data/pathitem4.qml +++ b/tests/auto/quick/qquickshape/data/pathitem4.qml @@ -28,10 +28,10 @@ Item { } ShapePath { - fillGradient: ShapeLinearGradient { + fillGradient: LinearGradient { y2: 150 - ShapeGradientStop { position: 0; color: "yellow" } - ShapeGradientStop { position: 1; color: "green" } + GradientStop { position: 0; color: "yellow" } + GradientStop { position: 1; color: "green" } } startX: 10; startY: 100 diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index fecac573b7..a984c28732 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -65,9 +65,8 @@ tst_QQuickShape::tst_QQuickShape() const char *uri = "tst_qquickpathitem"; qmlRegisterType<QQuickShape>(uri, 1, 0, "Shape"); qmlRegisterType<QQuickShapePath>(uri, 1, 0, "ShapePath"); - qmlRegisterType<QQuickShapeGradientStop>(uri, 1, 0, "ShapeGradientStop"); qmlRegisterUncreatableType<QQuickShapeGradient>(uri, 1, 0, "ShapeGradient", QQuickShapeGradient::tr("ShapeGradient is an abstract base class")); - qmlRegisterType<QQuickShapeLinearGradient>(uri, 1, 0, "ShapeLinearGradient"); + qmlRegisterType<QQuickShapeLinearGradient>(uri, 1, 0, "LinearGradient"); } void tst_QQuickShape::initValues() @@ -206,9 +205,9 @@ void tst_QQuickShape::changeSignals() QCOMPARE(vpChangeSpy.count(), 14); QQmlListReference stopList(lgrad, "stops"); QCOMPARE(stopList.count(), 5); - qobject_cast<QQuickShapeGradientStop *>(stopList.at(1))->setPosition(0.3); + qobject_cast<QQuickGradientStop *>(stopList.at(1))->setPosition(0.3); QCOMPARE(vpChangeSpy.count(), 15); - qobject_cast<QQuickShapeGradientStop *>(stopList.at(1))->setColor(Qt::black); + qobject_cast<QQuickGradientStop *>(stopList.at(1))->setColor(Qt::black); QCOMPARE(vpChangeSpy.count(), 16); } |