aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-05-31 12:42:09 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-06-02 10:16:52 +0000
commit961da5273e17655e73ec0975c6de446b88d7f5ca (patch)
tree6ef897a1149fc69d0905d7233106232208e07b2d /tests/auto
parentdece229a7c2284598c36fb668de766309a6893cf (diff)
Rename to Shape/ShapePath and remove public JS API
Change-Id: I299354da0632fb0b8487cfb13748ed58b97d75fd Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp4
-rw-r--r--tests/auto/quick/qquickpathitem/qquickpathitem.pro35
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem1.qml (renamed from tests/auto/quick/qquickpathitem/data/pathitem1.qml)2
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem2.qml (renamed from tests/auto/quick/qquickpathitem/data/pathitem2.qml)6
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem3.png (renamed from tests/auto/quick/qquickpathitem/data/pathitem3.png)bin5214 -> 5214 bytes
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem3.qml (renamed from tests/auto/quick/qquickpathitem/data/pathitem3.qml)18
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem4.png (renamed from tests/auto/quick/qquickpathitem/data/pathitem4.png)bin5713 -> 5713 bytes
-rw-r--r--tests/auto/quick/qquickshape/data/pathitem4.qml (renamed from tests/auto/quick/qquickpathitem/data/pathitem4.qml)14
-rw-r--r--tests/auto/quick/qquickshape/qquickshape.pro35
-rw-r--r--tests/auto/quick/qquickshape/tst_qquickshape.cpp (renamed from tests/auto/quick/qquickpathitem/tst_qquickpathitem.cpp)88
-rw-r--r--tests/auto/quick/quick.pro2
11 files changed, 102 insertions, 102 deletions
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index c835af55ad..d35a2e971a 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -86,8 +86,8 @@ tst_examples::tst_examples()
excludedDirs << "snippets/qml/visualdatamodel_rootindex";
excludedDirs << "snippets/qml/qtbinding";
excludedDirs << "snippets/qml/imports";
- excludedFiles << "examples/quick/pathitem/content/pathitem.qml"; // relies on resources
- excludedFiles << "examples/quick/pathitem/content/pathiteminteract.qml"; // relies on resources
+ excludedFiles << "examples/quick/shapes/content/pathitem.qml"; // relies on resources
+ excludedFiles << "examples/quick/shapes/content/pathiteminteract.qml"; // relies on resources
#ifdef QT_NO_XMLPATTERNS
excludedDirs << "demos/twitter";
diff --git a/tests/auto/quick/qquickpathitem/qquickpathitem.pro b/tests/auto/quick/qquickpathitem/qquickpathitem.pro
deleted file mode 100644
index 4b70a38436..0000000000
--- a/tests/auto/quick/qquickpathitem/qquickpathitem.pro
+++ /dev/null
@@ -1,35 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qquickpathitem
-macx:CONFIG -= app_bundle
-
-SOURCES += tst_qquickpathitem.cpp
-
-include (../../shared/util.pri)
-include (../shared/util.pri)
-
-TESTDATA = data/*
-
-HEADERS += \
- ../../../../src/imports/pathitem/qquickpathitem_p.h \
- ../../../../src/imports/pathitem/qquickpathitem_p_p.h \
- ../../../../src/imports/pathitem/qquickpathitemgenericrenderer_p.h \
- ../../../../src/imports/pathitem/qquickpathitemsoftwarerenderer_p.h
-
-SOURCES += \
- ../../../../src/imports/pathitem/qquickpathitem.cpp \
- ../../../../src/imports/pathitem/qquickpathitemgenericrenderer.cpp \
- ../../../../src/imports/pathitem/qquickpathitemsoftwarerenderer.cpp
-
-qtConfig(opengl) {
- HEADERS += \
- ../../../../src/imports/pathitem/qquicknvprfunctions_p.h \
- ../../../../src/imports/pathitem/qquicknvprfunctions_p_p.h \
- ../../../../src/imports/pathitem/qquickpathitemnvprrenderer_p.h
-
- SOURCES += \
- ../../../../src/imports/pathitem/qquicknvprfunctions.cpp \
- ../../../../src/imports/pathitem/qquickpathitemnvprrenderer.cpp
-}
-
-QT += core-private gui-private qml-private quick-private testlib
-qtHaveModule(widgets): QT += widgets
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem1.qml b/tests/auto/quick/qquickshape/data/pathitem1.qml
index d4bc133d86..29ca67b0bb 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem1.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem1.qml
@@ -1,5 +1,5 @@
import QtQuick 2.9
import tst_qquickpathitem 1.0
-PathItem {
+Shape {
}
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem2.qml b/tests/auto/quick/qquickshape/data/pathitem2.qml
index fcef43a4fe..a255a37af6 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem2.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem2.qml
@@ -1,7 +1,7 @@
import QtQuick 2.9
import tst_qquickpathitem 1.0
-PathItem {
- VisualPath { }
- VisualPath { }
+Shape {
+ ShapePath { }
+ ShapePath { }
}
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem3.png b/tests/auto/quick/qquickshape/data/pathitem3.png
index a8b4483c96..a8b4483c96 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem3.png
+++ b/tests/auto/quick/qquickshape/data/pathitem3.png
Binary files differ
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem3.qml b/tests/auto/quick/qquickshape/data/pathitem3.qml
index 3d2b9f6229..12bfa1bb5f 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem3.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem3.qml
@@ -5,24 +5,24 @@ Item {
width: 200
height: 150
- PathItem {
+ Shape {
enableVendorExtensions: false
objectName: "pathItem"
anchors.fill: parent
- VisualPath {
+ ShapePath {
strokeWidth: 4
strokeColor: "red"
- fillGradient: PathLinearGradient {
+ fillGradient: ShapeLinearGradient {
x1: 20; y1: 20
x2: 180; y2: 130
- PathGradientStop { position: 0; color: "blue" }
- PathGradientStop { position: 0.2; color: "green" }
- PathGradientStop { position: 0.4; color: "red" }
- PathGradientStop { position: 0.6; color: "yellow" }
- PathGradientStop { position: 1; color: "cyan" }
+ 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" }
}
- strokeStyle: VisualPath.DashLine
+ strokeStyle: ShapePath.DashLine
dashPattern: [ 1, 4 ]
Path {
startX: 20; startY: 20
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem4.png b/tests/auto/quick/qquickshape/data/pathitem4.png
index 3a988ba249..3a988ba249 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem4.png
+++ b/tests/auto/quick/qquickshape/data/pathitem4.png
Binary files differ
diff --git a/tests/auto/quick/qquickpathitem/data/pathitem4.qml b/tests/auto/quick/qquickshape/data/pathitem4.qml
index 3f756336c4..7d9ed4b84e 100644
--- a/tests/auto/quick/qquickpathitem/data/pathitem4.qml
+++ b/tests/auto/quick/qquickshape/data/pathitem4.qml
@@ -5,12 +5,12 @@ Item {
width: 200
height: 150
- PathItem {
+ Shape {
enableVendorExtensions: false
objectName: "pathItem"
anchors.fill: parent
- VisualPath {
+ ShapePath {
strokeColor: "red"
fillColor: "green"
Path {
@@ -21,7 +21,7 @@ Item {
}
}
- VisualPath {
+ ShapePath {
strokeWidth: 10
fillColor: "transparent"
strokeColor: "blue"
@@ -31,11 +31,11 @@ Item {
}
}
- VisualPath {
- fillGradient: PathLinearGradient {
+ ShapePath {
+ fillGradient: ShapeLinearGradient {
y2: 150
- PathGradientStop { position: 0; color: "yellow" }
- PathGradientStop { position: 1; color: "green" }
+ ShapeGradientStop { position: 0; color: "yellow" }
+ ShapeGradientStop { position: 1; color: "green" }
}
Path {
diff --git a/tests/auto/quick/qquickshape/qquickshape.pro b/tests/auto/quick/qquickshape/qquickshape.pro
new file mode 100644
index 0000000000..29c3502b86
--- /dev/null
+++ b/tests/auto/quick/qquickshape/qquickshape.pro
@@ -0,0 +1,35 @@
+CONFIG += testcase
+TARGET = tst_qquickshape
+macos:CONFIG -= app_bundle
+
+SOURCES += tst_qquickshape.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+HEADERS += \
+ ../../../../src/imports/shapes/qquickshape_p.h \
+ ../../../../src/imports/shapes/qquickshape_p_p.h \
+ ../../../../src/imports/shapes/qquickshapegenericrenderer_p.h \
+ ../../../../src/imports/shapes/qquickshapesoftwarerenderer_p.h
+
+SOURCES += \
+ ../../../../src/imports/shapes/qquickshape.cpp \
+ ../../../../src/imports/shapes/qquickshapegenericrenderer.cpp \
+ ../../../../src/imports/shapes/qquickshapesoftwarerenderer.cpp
+
+qtConfig(opengl) {
+ HEADERS += \
+ ../../../../src/imports/shapes/qquicknvprfunctions_p.h \
+ ../../../../src/imports/shapes/qquicknvprfunctions_p_p.h \
+ ../../../../src/imports/shapes/qquickshapenvprrenderer_p.h
+
+ SOURCES += \
+ ../../../../src/imports/shapes/qquicknvprfunctions.cpp \
+ ../../../../src/imports/shapes/qquickshapenvprrenderer.cpp
+}
+
+QT += core-private gui-private qml-private quick-private testlib
+qtHaveModule(widgets): QT += widgets
diff --git a/tests/auto/quick/qquickpathitem/tst_qquickpathitem.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
index 230d82a864..56d891d87e 100644
--- a/tests/auto/quick/qquickpathitem/tst_qquickpathitem.cpp
+++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
@@ -33,7 +33,7 @@
#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlincubator.h>
-#include "../../../../src/imports/pathitem/qquickpathitem_p.h"
+#include "../../../../src/imports/shapes/qquickshape_p.h"
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
@@ -42,76 +42,76 @@
using namespace QQuickViewTestUtil;
using namespace QQuickVisualTestUtil;
-class tst_QQuickPathItem : public QQmlDataTest
+class tst_QQuickShape : public QQmlDataTest
{
Q_OBJECT
public:
- tst_QQuickPathItem();
+ tst_QQuickShape();
private slots:
void initValues();
void vpInitValues();
- void basicPathItem();
+ void basicShape();
void changeSignals();
void render();
- void renderWithMultipleVp();
+ void renderWithMultipleSp();
};
-tst_QQuickPathItem::tst_QQuickPathItem()
+tst_QQuickShape::tst_QQuickShape()
{
// Force the software backend to get reliable rendering results regardless of the hw and drivers.
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
const char *uri = "tst_qquickpathitem";
- qmlRegisterType<QQuickPathItem>(uri, 1, 0, "PathItem");
- qmlRegisterType<QQuickVisualPath>(uri, 1, 0, "VisualPath");
- qmlRegisterType<QQuickPathGradientStop>(uri, 1, 0, "PathGradientStop");
- qmlRegisterUncreatableType<QQuickPathGradient>(uri, 1, 0, "PathGradient", QQuickPathGradient::tr("PathGradient is an abstract base class"));
- qmlRegisterType<QQuickPathLinearGradient>(uri, 1, 0, "PathLinearGradient");
+ 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");
}
-void tst_QQuickPathItem::initValues()
+void tst_QQuickShape::initValues()
{
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("pathitem1.qml"));
- QQuickPathItem *obj = qobject_cast<QQuickPathItem *>(c.create());
+ QQuickShape *obj = qobject_cast<QQuickShape *>(c.create());
QVERIFY(obj != nullptr);
- QVERIFY(obj->rendererType() == QQuickPathItem::UnknownRenderer);
+ QVERIFY(obj->rendererType() == QQuickShape::UnknownRenderer);
QVERIFY(!obj->asynchronous());
QVERIFY(obj->enableVendorExtensions());
- QVERIFY(obj->status() == QQuickPathItem::Null);
+ QVERIFY(obj->status() == QQuickShape::Null);
auto vps = obj->elements();
QVERIFY(vps.count(&vps) == 0);
delete obj;
}
-void tst_QQuickPathItem::vpInitValues()
+void tst_QQuickShape::vpInitValues()
{
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("pathitem2.qml"));
- QQuickPathItem *obj = qobject_cast<QQuickPathItem *>(c.create());
+ QQuickShape *obj = qobject_cast<QQuickShape *>(c.create());
QVERIFY(obj != nullptr);
- QVERIFY(obj->rendererType() == QQuickPathItem::UnknownRenderer);
+ QVERIFY(obj->rendererType() == QQuickShape::UnknownRenderer);
QVERIFY(!obj->asynchronous());
QVERIFY(obj->enableVendorExtensions());
- QVERIFY(obj->status() == QQuickPathItem::Null);
+ QVERIFY(obj->status() == QQuickShape::Null);
auto vps = obj->elements();
QVERIFY(vps.count(&vps) == 2);
- QQuickVisualPath *vp = vps.at(&vps, 0);
+ QQuickShapePath *vp = vps.at(&vps, 0);
QVERIFY(vp != nullptr);
QVERIFY(!vp->path());
QCOMPARE(vp->strokeColor(), QColor(Qt::white));
QCOMPARE(vp->strokeWidth(), 1.0f);
QCOMPARE(vp->fillColor(), QColor(Qt::white));
- QCOMPARE(vp->fillRule(), QQuickVisualPath::OddEvenFill);
- QCOMPARE(vp->joinStyle(), QQuickVisualPath::BevelJoin);
+ QCOMPARE(vp->fillRule(), QQuickShapePath::OddEvenFill);
+ QCOMPARE(vp->joinStyle(), QQuickShapePath::BevelJoin);
QCOMPARE(vp->miterLimit(), 2);
- QCOMPARE(vp->capStyle(), QQuickVisualPath::SquareCap);
- QCOMPARE(vp->strokeStyle(), QQuickVisualPath::SolidLine);
+ QCOMPARE(vp->capStyle(), QQuickShapePath::SquareCap);
+ QCOMPARE(vp->strokeStyle(), QQuickShapePath::SolidLine);
QCOMPARE(vp->dashOffset(), 0.0f);
QCOMPARE(vp->dashPattern(), QVector<qreal>() << 4 << 2);
QVERIFY(!vp->fillGradient());
@@ -119,30 +119,30 @@ void tst_QQuickPathItem::vpInitValues()
delete obj;
}
-void tst_QQuickPathItem::basicPathItem()
+void tst_QQuickShape::basicShape()
{
QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pathitem3.qml"));
qApp->processEvents();
- QQuickPathItem *obj = findItem<QQuickPathItem>(window->rootObject(), "pathItem");
+ QQuickShape *obj = findItem<QQuickShape>(window->rootObject(), "pathItem");
QVERIFY(obj != nullptr);
QQmlListReference list(obj, "elements");
QCOMPARE(list.count(), 1);
- QQuickVisualPath *vp = qobject_cast<QQuickVisualPath *>(list.at(0));
+ QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0));
QVERIFY(vp != nullptr);
QCOMPARE(vp->strokeWidth(), 4.0f);
QVERIFY(vp->fillGradient() != nullptr);
QVERIFY(vp->path() != nullptr);
- QCOMPARE(vp->strokeStyle(), QQuickVisualPath::DashLine);
+ QCOMPARE(vp->strokeStyle(), QQuickShapePath::DashLine);
vp->setStrokeWidth(5.0f);
QCOMPARE(vp->strokeWidth(), 5.0f);
- QQuickPathLinearGradient *lgrad = qobject_cast<QQuickPathLinearGradient *>(vp->fillGradient());
+ QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(vp->fillGradient());
QVERIFY(lgrad != nullptr);
- QCOMPARE(lgrad->spread(), QQuickPathGradient::PadSpread);
+ QCOMPARE(lgrad->spread(), QQuickShapeGradient::PadSpread);
QCOMPARE(lgrad->x1(), 20.0f);
QQmlListReference stopList(lgrad, "stops");
QCOMPARE(stopList.count(), 5);
@@ -154,14 +154,14 @@ void tst_QQuickPathItem::basicPathItem()
QCOMPARE(pathList.count(), 3);
}
-void tst_QQuickPathItem::changeSignals()
+void tst_QQuickShape::changeSignals()
{
QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pathitem3.qml"));
qApp->processEvents();
- QQuickPathItem *obj = findItem<QQuickPathItem>(window->rootObject(), "pathItem");
+ QQuickShape *obj = findItem<QQuickShape>(window->rootObject(), "pathItem");
QVERIFY(obj != nullptr);
QSignalSpy asyncPropSpy(obj, SIGNAL(asynchronousChanged()));
@@ -170,7 +170,7 @@ void tst_QQuickPathItem::changeSignals()
QCOMPARE(asyncPropSpy.count(), 2);
QQmlListReference list(obj, "elements");
- QQuickVisualPath *vp = qobject_cast<QQuickVisualPath *>(list.at(0));
+ QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0));
QVERIFY(vp != nullptr);
// Verify that VisualPath property changes emit changed().
@@ -178,13 +178,13 @@ void tst_QQuickPathItem::changeSignals()
QSignalSpy strokeColorPropSpy(vp, SIGNAL(strokeColorChanged()));
vp->setStrokeColor(Qt::blue);
vp->setStrokeWidth(1.0f);
- QQuickPathGradient *g = vp->fillGradient();
+ QQuickShapeGradient *g = vp->fillGradient();
vp->setFillGradient(nullptr);
vp->setFillColor(Qt::yellow);
- vp->setFillRule(QQuickVisualPath::WindingFill);
- vp->setJoinStyle(QQuickVisualPath::MiterJoin);
+ vp->setFillRule(QQuickShapePath::WindingFill);
+ vp->setJoinStyle(QQuickShapePath::MiterJoin);
vp->setMiterLimit(5);
- vp->setCapStyle(QQuickVisualPath::RoundCap);
+ vp->setCapStyle(QQuickShapePath::RoundCap);
vp->setDashOffset(10);
vp->setDashPattern(QVector<qreal>() << 1 << 2 << 3 << 4);
QCOMPARE(strokeColorPropSpy.count(), 1);
@@ -201,18 +201,18 @@ void tst_QQuickPathItem::changeSignals()
// Verify that property changes from the gradient bubble up and result in changed().
vp->setFillGradient(g);
QCOMPARE(vpChangeSpy.count(), 13);
- QQuickPathLinearGradient *lgrad = qobject_cast<QQuickPathLinearGradient *>(g);
+ QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(g);
lgrad->setX2(200);
QCOMPARE(vpChangeSpy.count(), 14);
QQmlListReference stopList(lgrad, "stops");
QCOMPARE(stopList.count(), 5);
- qobject_cast<QQuickPathGradientStop *>(stopList.at(1))->setPosition(0.3);
+ qobject_cast<QQuickShapeGradientStop *>(stopList.at(1))->setPosition(0.3);
QCOMPARE(vpChangeSpy.count(), 15);
- qobject_cast<QQuickPathGradientStop *>(stopList.at(1))->setColor(Qt::black);
+ qobject_cast<QQuickShapeGradientStop *>(stopList.at(1))->setColor(Qt::black);
QCOMPARE(vpChangeSpy.count(), 16);
}
-void tst_QQuickPathItem::render()
+void tst_QQuickShape::render()
{
QScopedPointer<QQuickView> window(createView());
@@ -229,7 +229,7 @@ void tst_QQuickPathItem::render()
QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
}
-void tst_QQuickPathItem::renderWithMultipleVp()
+void tst_QQuickShape::renderWithMultipleSp()
{
QScopedPointer<QQuickView> window(createView());
@@ -246,6 +246,6 @@ void tst_QQuickPathItem::renderWithMultipleVp()
QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
}
-QTEST_MAIN(tst_QQuickPathItem)
+QTEST_MAIN(tst_QQuickShape)
-#include "tst_qquickpathitem.moc"
+#include "tst_qquickshape.moc"
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index ebc2e32b79..2ff606488c 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -69,7 +69,7 @@ QUICKTESTS = \
qquickmousearea \
qquickmultipointtoucharea \
qquickpainteditem \
- qquickpathitem \
+ qquickshape \
qquickpathview \
qquickpincharea \
qquickpositioners \