diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-02 15:12:05 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-07 08:33:33 +0000 |
commit | 5af4c9b237a23ce12ca7c56eb6c9ecda17743228 (patch) | |
tree | fe8f85d5c353216cddc18df3c996be0c50cf0c67 /tests/auto/quick/qquickshape | |
parent | 961da5273e17655e73ec0975c6de446b88d7f5ca (diff) |
Reduce objects: Make ShapePath inherit Path
Shape { ShapePath { Path { ... } } } simply becomes
Shape { ShapePath { ... } }
Change-Id: Ie57936cd7953c8a8d6c67e78b9d73bdbe2a05316
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickshape')
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem3.qml | 10 | ||||
-rw-r--r-- | tests/auto/quick/qquickshape/data/pathitem4.qml | 50 | ||||
-rw-r--r-- | tests/auto/quick/qquickshape/tst_qquickshape.cpp | 16 |
3 files changed, 34 insertions, 42 deletions
diff --git a/tests/auto/quick/qquickshape/data/pathitem3.qml b/tests/auto/quick/qquickshape/data/pathitem3.qml index 12bfa1bb5f..3b819991e6 100644 --- a/tests/auto/quick/qquickshape/data/pathitem3.qml +++ b/tests/auto/quick/qquickshape/data/pathitem3.qml @@ -24,12 +24,10 @@ Item { } strokeStyle: ShapePath.DashLine dashPattern: [ 1, 4 ] - Path { - startX: 20; startY: 20 - PathLine { x: 180; y: 130 } - PathLine { x: 20; y: 130 } - PathLine { x: 20; y: 20 } - } + 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/data/pathitem4.qml b/tests/auto/quick/qquickshape/data/pathitem4.qml index 7d9ed4b84e..26e7084b8d 100644 --- a/tests/auto/quick/qquickshape/data/pathitem4.qml +++ b/tests/auto/quick/qquickshape/data/pathitem4.qml @@ -13,22 +13,18 @@ Item { ShapePath { strokeColor: "red" fillColor: "green" - Path { - startX: 40; startY: 30 - PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } - PathLine { x: 150; y: 80 } - PathQuad { x: 160; y: 30; controlX: 200; controlY: 80 } - } + startX: 40; startY: 30 + PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } + PathLine { x: 150; y: 80 } + PathQuad { x: 160; y: 30; controlX: 200; controlY: 80 } } ShapePath { strokeWidth: 10 fillColor: "transparent" strokeColor: "blue" - Path { - startX: 40; startY: 30 - PathCubic { x: 50; y: 80; control1X: 0; control1Y: 80; control2X: 100; control2Y: 100 } - } + startX: 40; startY: 30 + PathCubic { x: 50; y: 80; control1X: 0; control1Y: 80; control2X: 100; control2Y: 100 } } ShapePath { @@ -38,24 +34,22 @@ Item { ShapeGradientStop { position: 1; color: "green" } } - Path { - startX: 10; startY: 100 - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 25 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 35 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 60 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 50; radiusY: 120 - } + startX: 10; startY: 100 + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 25 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 35 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 60 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 50; radiusY: 120 } } } diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index 56d891d87e..fecac573b7 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -103,7 +103,8 @@ void tst_QQuickShape::vpInitValues() QQuickShapePath *vp = vps.at(&vps, 0); QVERIFY(vp != nullptr); - QVERIFY(!vp->path()); + QQmlListReference pathList(vp, "pathElements"); + QCOMPARE(pathList.count(), 0); QCOMPARE(vp->strokeColor(), QColor(Qt::white)); QCOMPARE(vp->strokeWidth(), 1.0f); QCOMPARE(vp->fillColor(), QColor(Qt::white)); @@ -134,7 +135,6 @@ void tst_QQuickShape::basicShape() QVERIFY(vp != nullptr); QCOMPARE(vp->strokeWidth(), 4.0f); QVERIFY(vp->fillGradient() != nullptr); - QVERIFY(vp->path() != nullptr); QCOMPARE(vp->strokeStyle(), QQuickShapePath::DashLine); vp->setStrokeWidth(5.0f); @@ -148,7 +148,7 @@ void tst_QQuickShape::basicShape() QCOMPARE(stopList.count(), 5); QVERIFY(stopList.at(2) != nullptr); - QQuickPath *path = vp->path(); + QQuickPath *path = vp; QCOMPARE(path->startX(), 20.0f); QQmlListReference pathList(path, "pathElements"); QCOMPARE(pathList.count(), 3); @@ -173,8 +173,8 @@ void tst_QQuickShape::changeSignals() QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0)); QVERIFY(vp != nullptr); - // Verify that VisualPath property changes emit changed(). - QSignalSpy vpChangeSpy(vp, SIGNAL(changed())); + // Verify that VisualPath property changes emit shapePathChanged(). + QSignalSpy vpChangeSpy(vp, SIGNAL(shapePathChanged())); QSignalSpy strokeColorPropSpy(vp, SIGNAL(strokeColorChanged())); vp->setStrokeColor(Qt::blue); vp->setStrokeWidth(1.0f); @@ -190,15 +190,15 @@ void tst_QQuickShape::changeSignals() QCOMPARE(strokeColorPropSpy.count(), 1); QCOMPARE(vpChangeSpy.count(), 10); - // Verify that property changes from Path and its elements bubble up and result in changed(). - QQuickPath *path = vp->path(); + // 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); QQmlListReference pathList(path, "pathElements"); qobject_cast<QQuickPathLine *>(pathList.at(1))->setY(200); QCOMPARE(vpChangeSpy.count(), 12); - // Verify that property changes from the gradient bubble up and result in changed(). + // Verify that property changes from the gradient bubble up and result in shapePathChanged(). vp->setFillGradient(g); QCOMPARE(vpChangeSpy.count(), 13); QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(g); |