summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-16 06:10:30 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-16 06:10:30 (GMT)
commit5e907741f941703731116f73a07da8dfdc482d36 (patch)
tree22e9b1bd0ea52991cf6873b6dc7d95041fab010e /tests
parentf620b2d3b2994c2a4749e0040aaf5f23eadad889 (diff)
parent62cc238b857140d69b6edabcb3d6a8240523f9c4 (diff)
downloadQt-5e907741f941703731116f73a07da8dfdc482d36.zip
Qt-5e907741f941703731116f73a07da8dfdc482d36.tar.gz
Qt-5e907741f941703731116f73a07da8dfdc482d36.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/data/path.qml14
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp47
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicspathview/data/path.qml b/tests/auto/declarative/qmlgraphicspathview/data/path.qml
new file mode 100644
index 0000000..7e82a48
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicspathview/data/path.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Path {
+ startX: 120; startY: 100
+
+ PathAttribute { name: "scale"; value: 1.0 }
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathPercent { value: 0.3 }
+ PathLine { x: 120; y: 100 }
+ PathCubic {
+ x: 180; y: 0; control1X: -10; control1Y: 90
+ control2X: 210; control2Y: 90
+ }
+}
diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
index c36b969..561392a 100644
--- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
+++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <private/qmlgraphicspathview_p.h>
+#include <private/qmlgraphicspath_p.h>
#include <qmlcontext.h>
#include <qmlexpression.h>
#include <qtest.h>
@@ -57,6 +58,7 @@ private slots:
void initValues();
void pathview2();
void pathview3();
+ void path();
};
@@ -118,6 +120,51 @@ void tst_QmlGraphicsPathView::pathview3()
QCOMPARE(obj->pathItemCount(), 4);
}
+void tst_QmlGraphicsPathView::path()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/path.qml"));
+ QmlGraphicsPath *obj = qobject_cast<QmlGraphicsPath*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->startX(), 120.);
+ QCOMPARE(obj->startY(), 100.);
+ QVERIFY(obj->path() != QPainterPath());
+
+ QList<QmlGraphicsPathElement*> *list = obj->pathElements();
+ QCOMPARE(list->count(), 5);
+
+ QmlGraphicsPathAttribute* attr = qobject_cast<QmlGraphicsPathAttribute*>(list->at(0));
+ QVERIFY(attr != 0);
+ QCOMPARE(attr->name(), QString("scale"));
+ QCOMPARE(attr->value(), 1.0);
+
+ QmlGraphicsPathQuad* quad = qobject_cast<QmlGraphicsPathQuad*>(list->at(1));
+ QVERIFY(quad != 0);
+ QCOMPARE(quad->x(), 120.);
+ QCOMPARE(quad->y(), 25.);
+ QCOMPARE(quad->controlX(), 260.);
+ QCOMPARE(quad->controlY(), 75.);
+
+ QmlGraphicsPathPercent* perc = qobject_cast<QmlGraphicsPathPercent*>(list->at(2));
+ QVERIFY(perc != 0);
+ QCOMPARE(perc->value(), 0.3);
+
+ QmlGraphicsPathLine* line = qobject_cast<QmlGraphicsPathLine*>(list->at(3));
+ QVERIFY(line != 0);
+ QCOMPARE(line->x(), 120.);
+ QCOMPARE(line->y(), 100.);
+
+ QmlGraphicsPathCubic* cubic = qobject_cast<QmlGraphicsPathCubic*>(list->at(4));
+ QVERIFY(cubic != 0);
+ QCOMPARE(cubic->x(), 180.);
+ QCOMPARE(cubic->y(), 0.);
+ QCOMPARE(cubic->control1X(), -10.);
+ QCOMPARE(cubic->control1Y(), 90.);
+ QCOMPARE(cubic->control2X(), 210.);
+ QCOMPARE(cubic->control2Y(), 90.);
+}
+
QTEST_MAIN(tst_QmlGraphicsPathView)
#include "tst_qmlgraphicspathview.moc"