summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeitem
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-26 05:59:43 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-26 05:59:43 (GMT)
commit56309fe1461c4ea3ca654e535a525165c28a0f12 (patch)
tree69220d2803636f67ec67a29a066ab8d2047c842b /tests/auto/declarative/qdeclarativeitem
parenta9f11eea6b4985c9ff2ebcbe1b52acc7a5c64250 (diff)
downloadQt-56309fe1461c4ea3ca654e535a525165c28a0f12.zip
Qt-56309fe1461c4ea3ca654e535a525165c28a0f12.tar.gz
Qt-56309fe1461c4ea3ca654e535a525165c28a0f12.tar.bz2
Test transforms.
Diffstat (limited to 'tests/auto/declarative/qdeclarativeitem')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 7665e18..d800411 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -61,6 +61,8 @@ private slots:
void mapCoordinates();
void mapCoordinates_data();
void propertyChanges();
+ void transforms();
+ void transforms_data();
private:
template<typename T>
@@ -402,6 +404,25 @@ void tst_QDeclarativeItem::mapCoordinates_data()
QTest::newRow(QTest::toString(i)) << i << i;
}
+void tst_QDeclarativeItem::transforms_data()
+{
+ QTest::addColumn<QByteArray>("qml");
+ QTest::addColumn<QMatrix>("matrix");
+ QTest::newRow("translate") << QByteArray("import Qt 4.6\nItem { transform: Translate { x: 10; y: 20 } }") << QMatrix(1,0,0,1,10,20);
+ QTest::newRow("rotation") << QByteArray("import Qt 4.6\nItem { transform: Rotation { angle: 90 } }") << QMatrix(0,1,-1,0,0,0);
+ QTest::newRow("scale") << QByteArray("import Qt 4.6\nItem { transform: Scale { xScale: 1.5; yScale: -2 } }") << QMatrix(1.5,0,0,-2,0,0);
+}
+
+void tst_QDeclarativeItem::transforms()
+{
+ QFETCH(QByteArray, qml);
+ QFETCH(QMatrix, matrix);
+ QDeclarativeComponent component(&engine);
+ component.setData(qml, QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QCOMPARE(item->sceneMatrix(), matrix);
+}
+
void tst_QDeclarativeItem::propertyChanges()
{
QDeclarativeView *canvas = new QDeclarativeView(0);