diff options
3 files changed, 0 insertions, 146 deletions
diff --git a/tests/auto/declarative/simplecanvasitem/data/test.qml b/tests/auto/declarative/simplecanvasitem/data/test.qml deleted file mode 100644 index 8fbbc2e..0000000 --- a/tests/auto/declarative/simplecanvasitem/data/test.qml +++ /dev/null @@ -1,60 +0,0 @@ -import Qt 4.6 - -Item { - width: 320 - height: 480 - Rect { - color: "blue" - x: 20 - y: 20 - width: 20 - height: 20 - Rect { - color: "black" - x: 20 - y: 20 - width: 10 - height: 10 - } - } - Rect { - color: "red" - x: 40 - y: 20 - width: 20 - height: 20 - } - Rect { - color: "green" - x: 60 - y: 20 - width: 20 - height: 20 - } - Rect { - color: "yellow" - x: 20 - y: 40 - width: 20 - height: 20 - } - Rect { - color: "purple" - x: 20 - y: 60 - width: 20 - height: 20 - } - Rect { - color: "white" - x: 40 - y: 40 - width: 20 - height: 20 - } - Rect { - anchors.fill: parent - color: "gray" - z: -1 - } -} diff --git a/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro b/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro deleted file mode 100644 index f4aea32..0000000 --- a/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl -SOURCES += tst_simplecanvasitem.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/simplecanvasitem/tst_simplecanvasitem.cpp b/tests/auto/declarative/simplecanvasitem/tst_simplecanvasitem.cpp deleted file mode 100644 index cce4df1..0000000 --- a/tests/auto/declarative/simplecanvasitem/tst_simplecanvasitem.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include <QtTest/QtTest> -#include <qfxview.h> -#include <qfxitem.h> -#include <qsimplecanvasitem.h> - -/* - Note: this autotest is specifically to test SimpleCanvasItem as a component of - Qt Declarative, and therefore will have all items created in XML. -*/ -class tst_SimpleCanvasItem : public QObject -{ - Q_OBJECT -public: - tst_SimpleCanvasItem(); - -private slots: - void test_pos(); - void test_scenePos(); -private: - QFxView *createView(const QString &filename); -}; - -tst_SimpleCanvasItem::tst_SimpleCanvasItem() -{ -} - -void tst_SimpleCanvasItem::test_pos() -{ - QFxView *canvas = createView(SRCDIR "/data/test.qml"); - canvas->execute(); - qApp->processEvents(); - QSimpleCanvasItem* root = qobject_cast<QSimpleCanvasItem*>(canvas->root()); - QVERIFY(root); - - QCOMPARE(root->pos(), QPointF(0,0)); - QCOMPARE(root->children().at(0)->pos(), QPointF(20,20)); - QCOMPARE(root->children().at(0)->children().at(0)->pos(), QPointF(20,20)); - QCOMPARE(root->children().at(2)->pos(), QPointF(60,20)); - QCOMPARE(root->children().at(3)->pos(), QPointF(20,40)); - QCOMPARE(root->children().at(5)->pos(), QPointF(40,40)); -} - -void tst_SimpleCanvasItem::test_scenePos() -{ - QFxView *canvas = createView(SRCDIR "/data/test.qml"); - canvas->execute(); - qApp->processEvents(); - QSimpleCanvasItem* root = qobject_cast<QSimpleCanvasItem*>(canvas->root()); - QVERIFY(root); - -#ifdef CANVAS_GL - QCOMPARE(root->transform(), QMatrix4x4()); -#else - QCOMPARE(root->transform(), QTransform()); -#endif - QCOMPARE(root->scenePos(), QPointF(0,0)); - QCOMPARE(root->children().at(0)->scenePos(), QPointF(20,20)); - QCOMPARE(root->children().at(0)->children().at(0)->scenePos(), QPointF(40,40)); - QCOMPARE(root->children().at(2)->scenePos(), QPointF(60,20)); - QCOMPARE(root->children().at(3)->scenePos(), QPointF(20,40)); - QCOMPARE(root->children().at(5)->scenePos(), QPointF(40,40)); -} - -QFxView *tst_SimpleCanvasItem::createView(const QString &filename) -{ - QFxView *canvas = new QFxView(0); - canvas->setFixedSize(240,320); - - QFile file(filename); - file.open(QFile::ReadOnly); - QString xml = file.readAll(); - canvas->setQml(xml, filename); - - return canvas; -} - -QTEST_MAIN(tst_SimpleCanvasItem) - -#include "tst_simplecanvasitem.moc" |