diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-05 22:51:39 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-05 22:51:39 (GMT) |
commit | 4266b0616bb5d67244173dbe4d9d417dbf4d302f (patch) | |
tree | 4d8320dfafe09657fb0e475bd6b36a50c4d79105 /tests | |
parent | ec543f79c7d036961eb6cdcd956b3e8ca28b8e54 (diff) | |
parent | 96f3abd4df881789bd2677100a2417c96fd2edb4 (diff) | |
download | Qt-4266b0616bb5d67244173dbe4d9d417dbf4d302f.zip Qt-4266b0616bb5d67244173dbe4d9d417dbf4d302f.tar.gz Qt-4266b0616bb5d67244173dbe4d9d417dbf4d302f.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
84 files changed, 5241 insertions, 31 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index b9f59d6..716d278 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -8,6 +8,7 @@ SUBDIRS += \ examples \ layouts \ # Cover listview \ # Cover + qmlgraphicsgridview \ # Cover numberformatter \ # Cover pathview \ # Cover qfxloader \ # Cover @@ -18,6 +19,7 @@ SUBDIRS += \ qmlcontext \ # Cover qmldom \ # Cover qmlecmascript \ # Cover + qmlerror \ # Cover qmlfontloader \ # Cover qmlgraphicsborderimage \ # Cover qmlgraphicsparticles \ # Cover @@ -30,6 +32,7 @@ SUBDIRS += \ qmlpixmapcache \ # Cover qmlpropertymap \ # Cover qmlqt \ # Cover + qmlsystempalette \ # Cover qmltimer \ # Cover qmlxmllistmodel \ # Cover repeater \ # Cover diff --git a/tests/auto/declarative/layouts/data/grid-animated.qml b/tests/auto/declarative/layouts/data/grid-animated.qml new file mode 100644 index 0000000..9edccaf --- /dev/null +++ b/tests/auto/declarative/layouts/data/grid-animated.qml @@ -0,0 +1,55 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Grid { + columns: 3 + add: Transition { + NumberAnimation { + properties: "x,y"; from: -100 + } + } + remove: Transition { + NumberAnimation { + properties: "x,y"; to: -100 + } + } + move: Transition { + NumberAnimation { + properties: "x,y"; + } + } + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + opacity: 0 + color: "green" + width: 50 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 50 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 50 + height: 50 + } + } +} diff --git a/tests/auto/declarative/layouts/data/horizontal-animated.qml b/tests/auto/declarative/layouts/data/horizontal-animated.qml new file mode 100644 index 0000000..f757d18 --- /dev/null +++ b/tests/auto/declarative/layouts/data/horizontal-animated.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Row { + add: Transition { + NumberAnimation { + properties: "x"; from: -100 + } + } + remove: Transition { + NumberAnimation { + properties: "x"; to: -100 + } + } + move: Transition { + NumberAnimation { + properties: "x"; + } + } + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "blue" + opacity: 0 + width: 50 + height: 50 + } + Rectangle { + objectName: "three" + color: "red" + width: 50 + height: 50 + } + } +} diff --git a/tests/auto/declarative/layouts/data/repeater.qml b/tests/auto/declarative/layouts/data/repeater.qml new file mode 100644 index 0000000..2bc5e94 --- /dev/null +++ b/tests/auto/declarative/layouts/data/repeater.qml @@ -0,0 +1,20 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Row { + Repeater{ model: 3; + delegate: Component { + Rectangle { + color: "red" + width: 50 + height: 50 + z: {if(index == 0){2;}else if(index == 1){1;} else{3;}} + objectName: {if(index == 0){"one";}else if(index == 1){"two";} else{"three";}} + + } + } + } + } +} diff --git a/tests/auto/declarative/layouts/data/vertical-animated.qml b/tests/auto/declarative/layouts/data/vertical-animated.qml new file mode 100644 index 0000000..f52a78a --- /dev/null +++ b/tests/auto/declarative/layouts/data/vertical-animated.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Column { + add: Transition { + NumberAnimation { + properties: "y"; from: -100 + } + } + remove: Transition { + NumberAnimation { + properties: "y"; to: -100 + } + } + move: Transition { + NumberAnimation { + properties: "y"; + } + } + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "blue" + opacity: 0 + width: 50 + height: 50 + } + Rectangle { + objectName: "three" + color: "red" + width: 50 + height: 50 + } + } +} diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index b0df57ea..c0c067a 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -53,11 +53,15 @@ public: private slots: void test_horizontal(); void test_horizontal_spacing(); + void test_horizontal_animated(); void test_vertical(); void test_vertical_spacing(); + void test_vertical_animated(); void test_grid(); void test_grid_spacing(); + void test_grid_animated(); + void test_repeater(); private: QmlView *createView(const QString &filename); }; @@ -114,6 +118,57 @@ void tst_QmlGraphicsLayouts::test_horizontal_spacing() QCOMPARE(three->y(), 0.0); } +void tst_QmlGraphicsLayouts::test_horizontal_animated() +{ + QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + + canvas->execute(); + qApp->processEvents(); + + QTest::qWait(0);//Let the animation start + //Note that one and three animate in + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); + QVERIFY(one != 0); + QCOMPARE(one->x(), -100.0); + + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); + QVERIFY(two != 0); + QCOMPARE(two->x(), 0.0); + + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); + QVERIFY(three != 0); + QCOMPARE(three->x(), -100.0); + + QTest::qWait(300);//Let the animation complete + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->x(), -100.0); + QCOMPARE(three->x(), 50.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->x(), 50.0); + QCOMPARE(three->x(), 100.0); + + //Remove 'two' + two->setOpacity(0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(three->x(), 100.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->x(), 50.0); + QCOMPARE(three->x(), 50.0); +} + void tst_QmlGraphicsLayouts::test_vertical() { QmlView *canvas = createView(SRCDIR "/data/vertical.qml"); @@ -162,6 +217,57 @@ void tst_QmlGraphicsLayouts::test_vertical_spacing() QCOMPARE(three->y(), 80.0); } +void tst_QmlGraphicsLayouts::test_vertical_animated() +{ + QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); + + canvas->execute(); + qApp->processEvents(); + + QTest::qWait(0);//Let the animation start + //Note that one and three animate in + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); + QVERIFY(one != 0); + QCOMPARE(one->y(), -100.0); + + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); + QVERIFY(two != 0); + QCOMPARE(two->y(), 0.0); + + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); + QVERIFY(three != 0); + QCOMPARE(three->y(), -100.0); + + QTest::qWait(300);//Let the animation complete + + QCOMPARE(one->y(), 0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(three->y(), 50.0); + QCOMPARE(three->x(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->y(), -100.0); + QCOMPARE(three->y(), 50.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->y(), 100.0); + + //Remove 'two' + two->setOpacity(0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->y(), 100.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->y(), 50.0); +} + void tst_QmlGraphicsLayouts::test_grid() { QmlView *canvas = createView("data/grid.qml"); @@ -222,6 +328,129 @@ void tst_QmlGraphicsLayouts::test_grid_spacing() QCOMPARE(five->y(), 54.0); } +void tst_QmlGraphicsLayouts::test_grid_animated() +{ + QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + canvas->execute(); + qApp->processEvents(); + + QTest::qWait(0);//Let the animation start + //Note that all but two animate in + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); + QVERIFY(one != 0); + QCOMPARE(one->x(), -100.0); + QCOMPARE(one->y(), -100.0); + + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); + QVERIFY(two != 0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 0.0); + + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); + QVERIFY(three != 0); + QCOMPARE(three->x(), -100.0); + QCOMPARE(three->y(), -100.0); + + QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four"); + QVERIFY(four != 0); + QCOMPARE(four->x(), -100.0); + QCOMPARE(four->y(), -100.0); + + QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five"); + QVERIFY(five != 0); + QCOMPARE(five->x(), -100.0); + QCOMPARE(five->y(), -100.0); + + QTest::qWait(300);//Let the animation complete + + QCOMPARE(one->y(), 0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(four->x(), 100.0); + QCOMPARE(five->y(), 50.0); + QCOMPARE(five->x(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->x(), -100.0); + QCOMPARE(two->y(), -100.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 100.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 0.0); + QCOMPARE(five->y(), 50.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 100.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 50.0); + QCOMPARE(five->x(), 50.0); + QCOMPARE(five->y(), 50.0); + + //Remove 'two' + two->setOpacity(0.0); + QCOMPARE(two->opacity(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 100.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 50.0); + QCOMPARE(five->x(), 50.0); + QCOMPARE(five->y(), 50.0); + QTest::qWait(300);//Let the animation complete + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 100.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 0.0); + QCOMPARE(five->y(), 50.0); +} + +void tst_QmlGraphicsLayouts::test_repeater() +{ + QmlView *canvas = createView("data/repeater.qml"); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); + QVERIFY(one != 0); + + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); + QVERIFY(two != 0); + + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 100.0); + QCOMPARE(three->y(), 0.0); +} + QmlView *tst_QmlGraphicsLayouts::createView(const QString &filename) { QmlView *canvas = new QmlView(0); diff --git a/tests/auto/declarative/listview/data/listview-sections.qml b/tests/auto/declarative/listview/data/listview-sections.qml new file mode 100644 index 0000000..56700be --- /dev/null +++ b/tests/auto/declarative/listview/data/listview-sections.qml @@ -0,0 +1,59 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Item { + id: wrapper + objectName: "wrapper" + height: ListView.prevSection != ListView.section ? 40 : 20; + width: 240 + Rectangle { + y: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0 + height: 20 + width: parent.width + color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white" + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 120 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + x: 200 + text: wrapper.y + } + } + Rectangle { + color: "#99bb99" + height: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0 + width: parent.width + visible: wrapper.ListView.prevSection != wrapper.ListView.section ? true : false + Text { text: wrapper.ListView.section } + } + } + } + ] + ListView { + id: list + objectName: "list" + width: 240 + height: 320 + model: testModel + delegate: myDelegate + sectionExpression: "Math.floor(index/5)" + } +} diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 6bf1080..5575ace 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -70,6 +70,8 @@ private slots: void qAbstractItemModel_moved(); void enforceRange(); + void spacing(); + void sections(); private: template <class T> void items(); @@ -264,6 +266,13 @@ void tst_QmlGraphicsListView::items() listview->decrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 0); + // set an empty model and confirm that items are destroyed + T model2; + ctxt->setContextProperty("testModel", &model2); + + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 0); + delete canvas; } @@ -632,6 +641,97 @@ void tst_QmlGraphicsListView::enforceRange() delete canvas; } +void tst_QmlGraphicsListView::spacing() +{ + QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list"); + QVERIFY(listview != 0); + + QmlGraphicsItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + listview->setSpacing(10); + QVERIFY(listview->spacing() == 10); + + // Confirm items positioned correctly + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*30); + } + + listview->setSpacing(0); + + // Confirm items positioned correctly + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + delete canvas; +} + +void tst_QmlGraphicsListView::sections() +{ + QmlView *canvas = createView(SRCDIR "/data/listview-sections.qml"); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list"); + QVERIFY(listview != 0); + + QmlGraphicsItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); + } + + QVERIFY(listview->currentSection() == "0"); + + listview->setViewportY(140); + QVERIFY(listview->currentSection() == "1"); + + delete canvas; +} + void tst_QmlGraphicsListView::qListModelInterface_items() { items<TestModel>(); diff --git a/tests/auto/declarative/qfxloader/tst_qfxloader.cpp b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp index 9a8f8f1..9a3da90 100644 --- a/tests/auto/declarative/qfxloader/tst_qfxloader.cpp +++ b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp @@ -110,14 +110,21 @@ void tst_qfxloader::component() void tst_qfxloader::clear() { - QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), QUrl("file://" SRCDIR "/")); + QmlComponent component(&engine, QByteArray( + "import Qt 4.6\n" + " Loader { id: loader\n" + " source: 'Rect120x60.qml'\n" + " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" + " }") + , QUrl("file://" SRCDIR "/")); QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - loader->setSource(QUrl("")); + QTest::qWait(500); + QVERIFY(loader->item() == 0); QCOMPARE(loader->progress(), 0.0); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); @@ -136,7 +143,7 @@ void tst_qfxloader::urlToComponent() "}" ) , QUrl("file://" SRCDIR "/")); QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QTest::qWait(1000); + QTest::qWait(500); QVERIFY(loader != 0); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp index 7bc6121..19d5998 100644 --- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp +++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qtest.h> #include "../../../shared/util.h" +#include <math.h> #include <QFile> #include <QTextDocument> #include <QtDeclarative/qmlengine.h> @@ -183,8 +184,9 @@ void tst_qfxtextedit::width() for (int i = 0; i < standard.size(); i++) { QFont f; - QFontMetrics fm(f); - int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp index 2dc096d..8eeb22d 100644 --- a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp +++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp @@ -132,8 +132,8 @@ void tst_qfxtextinput::width() for (int i = 0; i < standard.size(); i++) { QFont f; - QFontMetrics fm(f); - int metricWidth = fm.width(standard.at(i)); + QFontMetricsF fm(f); + qreal metricWidth = fm.width(standard.at(i)); QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); diff --git a/tests/auto/declarative/qmlerror/qmlerror.pro b/tests/auto/declarative/qmlerror/qmlerror.pro new file mode 100644 index 0000000..fa9b79e --- /dev/null +++ b/tests/auto/declarative/qmlerror/qmlerror.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qmlerror.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlerror/test.txt b/tests/auto/declarative/qmlerror/test.txt new file mode 100644 index 0000000..cdafd9e --- /dev/null +++ b/tests/auto/declarative/qmlerror/test.txt @@ -0,0 +1,3 @@ +Line Content +Line2 Content +Line3 Content diff --git a/tests/auto/declarative/qmlerror/tst_qmlerror.cpp b/tests/auto/declarative/qmlerror/tst_qmlerror.cpp new file mode 100644 index 0000000..70fef1d --- /dev/null +++ b/tests/auto/declarative/qmlerror/tst_qmlerror.cpp @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QmlError> +#include <QDebug> + +class tst_qmlerror : public QObject +{ + Q_OBJECT +private slots: + void url(); + void description(); + void line(); + void column(); + void toString(); + + void copy(); + void debug(); +}; + +void tst_qmlerror::url() +{ + QmlError error; + + QCOMPARE(error.url(), QUrl()); + + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + + QCOMPARE(error.url(), QUrl("http://www.nokia.com/main.qml")); + + QmlError error2 = error; + + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); + + error.setUrl(QUrl("http://qt.nokia.com/main.qml")); + + QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); +} + +void tst_qmlerror::description() +{ + QmlError error; + + QCOMPARE(error.description(), QString()); + + error.setDescription("An Error"); + + QCOMPARE(error.description(), QString("An Error")); + + QmlError error2 = error; + + QCOMPARE(error2.description(), QString("An Error")); + + error.setDescription("Another Error"); + + QCOMPARE(error.description(), QString("Another Error")); + QCOMPARE(error2.description(), QString("An Error")); +} + +void tst_qmlerror::line() +{ + QmlError error; + + QCOMPARE(error.line(), -1); + + error.setLine(102); + + QCOMPARE(error.line(), 102); + + QmlError error2 = error; + + QCOMPARE(error2.line(), 102); + + error.setLine(4); + + QCOMPARE(error.line(), 4); + QCOMPARE(error2.line(), 102); +} + +void tst_qmlerror::column() +{ + QmlError error; + + QCOMPARE(error.column(), -1); + + error.setColumn(16); + + QCOMPARE(error.column(), 16); + + QmlError error2 = error; + + QCOMPARE(error2.column(), 16); + + error.setColumn(3); + + QCOMPARE(error.column(), 3); + QCOMPARE(error2.column(), 16); +} + +void tst_qmlerror::toString() +{ + { + QmlError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92:13: An Error")); + } + + { + QmlError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + + QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92: An Error")); + } +} + +void tst_qmlerror::copy() +{ + QmlError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QmlError error2(error); + QmlError error3; + error3 = error; + + error.setUrl(QUrl("http://qt.nokia.com/main.qml")); + error.setDescription("Another Error"); + error.setLine(2); + error.setColumn(33); + + QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); + QCOMPARE(error.description(), QString("Another Error")); + QCOMPARE(error.line(), 2); + QCOMPARE(error.column(), 33); + + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); + QCOMPARE(error2.description(), QString("An Error")); + QCOMPARE(error2.line(), 92); + QCOMPARE(error2.column(), 13); + + QCOMPARE(error3.url(), QUrl("http://www.nokia.com/main.qml")); + QCOMPARE(error3.description(), QString("An Error")); + QCOMPARE(error3.line(), 92); + QCOMPARE(error3.column(), 13); + +} + +void tst_qmlerror::debug() +{ + { + QmlError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QTest::ignoreMessage(QtWarningMsg, "http://www.nokia.com/main.qml:92:13: An Error "); + qWarning() << error; + } + + { + QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("test.txt"))); + QmlError error; + error.setUrl(url); + error.setDescription("An Error"); + error.setLine(2); + error.setColumn(5); + + QString out = url.toString() + ":2:5: An Error \n Line2 Content \n ^ "; + QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); + + qWarning() << error; + } + + { + QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("foo.txt"))); + QmlError error; + error.setUrl(url); + error.setDescription("An Error"); + error.setLine(2); + error.setColumn(5); + + QString out = url.toString() + ":2:5: An Error "; + QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); + + qWarning() << error; + } +} + + + +QTEST_MAIN(tst_qmlerror) + +#include "tst_qmlerror.moc" diff --git a/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf b/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf Binary files differdeleted file mode 100644 index f6a33b0..0000000 --- a/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf +++ /dev/null diff --git a/tests/auto/declarative/qmlfontloader/data/FreeMono.ttf b/tests/auto/declarative/qmlfontloader/data/FreeMono.ttf Binary files differnew file mode 100644 index 0000000..d7ce52d --- /dev/null +++ b/tests/auto/declarative/qmlfontloader/data/FreeMono.ttf diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp index 23f7025..a5ab13d 100644 --- a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp +++ b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp @@ -97,13 +97,13 @@ void tst_qmlfontloader::namedFont() void tst_qmlfontloader::localFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/Fontin-Bold.ttf\" }"; + QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/FreeMono.ttf\" }"; QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("Fontin")); + QTRY_COMPARE(fontObject->name(), QString("FreeMono")); QTRY_VERIFY(fontObject->status() == QmlFontLoader::Ready); } diff --git a/tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml b/tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml new file mode 100644 index 0000000..37eb622 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml @@ -0,0 +1,49 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.color: "blue" + Text { + text: index + } + Text { + x: 40 + text: wrapper.x + ", " + wrapper.y + } + Text { + y: 20 + id: textName + objectName: "textName" + text: name + } + Text { + y: 40 + id: textNumber + objectName: "textNumber" + text: number + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + ] + GridView { + id: grid + objectName: "grid" + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + } +} diff --git a/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro b/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro new file mode 100644 index 0000000..8eae8ae --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qmlgraphicsgridview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp new file mode 100644 index 0000000..c6ea25a --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp @@ -0,0 +1,585 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtTest/QtTest> +#include <private/qlistmodelinterface_p.h> +#include <qmlview.h> +#include <private/qmlgraphicsgridview_p.h> +#include <private/qmlgraphicstext_p.h> +#include <qmlcontext.h> +#include <qmlexpression.h> + +class tst_QmlGraphicsGridView : public QObject +{ + Q_OBJECT +public: + tst_QmlGraphicsGridView(); + +private slots: + void items(); + void changed(); + void inserted(); + void removed(); + void moved(); + +private: + QmlView *createView(const QString &filename); + template<typename T> + T *findItem(QmlGraphicsItem *parent, const QString &id, int index=-1); + template<typename T> + QList<T*> findItems(QmlGraphicsItem *parent, const QString &objectName); +}; + +class TestModel : public QAbstractListModel +{ +public: + enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; + + TestModel(QObject *parent=0) : QAbstractListModel(parent) { + QHash<int, QByteArray> roles; + roles[Name] = "name"; + roles[Number] = "number"; + setRoleNames(roles); + } + + int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { + QVariant rv; + if (role == Name) + rv = list.at(index.row()).first; + else if (role == Number) + rv = list.at(index.row()).second; + + return rv; + } + + int count() const { return rowCount(); } + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + void addItem(const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()); + list.append(QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void insertItem(int index, const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), index, index); + list.insert(index, QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void removeItem(int index) { + emit beginRemoveRows(QModelIndex(), index, index); + list.removeAt(index); + emit endRemoveRows(); + } + + void moveItem(int from, int to) { + emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + list.move(from, to); + emit endMoveRows(); + } + + void modifyItem(int idx, const QString &name, const QString &number) { + list[idx] = QPair<QString,QString>(name, number); + emit dataChanged(index(idx,0), index(idx,0)); + } + +private: + QList<QPair<QString,QString> > list; +}; + +tst_QmlGraphicsGridView::tst_QmlGraphicsGridView() +{ +} + +void tst_QmlGraphicsGridView::items() +{ + QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + model.addItem("Billy", "22345"); + model.addItem("Sam", "2945"); + model.addItem("Ben", "04321"); + model.addItem("Jim", "0780"); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid"); + QVERIFY(gridview != 0); + + QmlGraphicsItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + QCOMPARE(gridview->count(), model.count()); + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + for (int i = 0; i < model.count(); ++i) { + QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + gridview->moveCurrentIndexRight(); + QCOMPARE(gridview->currentIndex(), 1); + gridview->moveCurrentIndexDown(); + QCOMPARE(gridview->currentIndex(), 4); + gridview->moveCurrentIndexUp(); + QCOMPARE(gridview->currentIndex(), 1); + gridview->moveCurrentIndexLeft(); + QCOMPARE(gridview->currentIndex(), 0); + + // set an empty model and confirm that items are destroyed + TestModel model2; + ctxt->setContextProperty("testModel", &model2); + + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 0); + + delete canvas; +} + +void tst_QmlGraphicsGridView::changed() +{ + QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + model.addItem("Billy", "22345"); + model.addItem("Sam", "2945"); + model.addItem("Ben", "04321"); + model.addItem("Jim", "0780"); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->root(), "grid"); + QVERIFY(gridview != 0); + + QmlGraphicsItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.modifyItem(1, "Will", "9876"); + QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + delete canvas; +} + +void tst_QmlGraphicsGridView::inserted() +{ + QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid"); + QVERIFY(gridview != 0); + + QmlGraphicsItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.insertItem(1, "Will", "9876"); + + // let transitions settle. + QTest::qWait(300); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + model.insertItem(0, "Foo", "1111"); // zero index, and current item + + // let transitions settle. + QTest::qWait(300); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + name = findItem<QmlGraphicsText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + QCOMPARE(gridview->currentIndex(), 1); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + for (int i = model.count(); i < 30; ++i) + model.insertItem(i, "Hello", QString::number(i)); + QTest::qWait(300); + + gridview->setViewportY(120); + QTest::qWait(300); + + // Insert item outside visible area + model.insertItem(1, "Hello", "1324"); + QTest::qWait(300); + + QVERIFY(gridview->viewportY() == 120); + + delete canvas; +} + +void tst_QmlGraphicsGridView::removed() +{ + QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid"); + QVERIFY(gridview != 0); + + QmlGraphicsItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.removeItem(1); + + // let transitions settle. + QTest::qWait(300); + + QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove first item (which is the current item); + model.removeItem(0); + + // let transitions settle. + QTest::qWait(300); + + name = findItem<QmlGraphicsText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + // Confirm items positioned correctly + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove items not visible + model.removeItem(25); + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove items before visible + gridview->setViewportY(120); + gridview->setCurrentIndex(10); + + model.removeItem(1); + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + for (int i = 6; i < 18; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + gridview->setViewportY(0); + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + delete canvas; +} + +void tst_QmlGraphicsGridView::moved() +{ + QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QmlContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->execute(); + qApp->processEvents(); + + QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid"); + QVERIFY(gridview != 0); + + QmlGraphicsItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.moveItem(1, 8); + + // let transitions settle. + QTest::qWait(300); + + QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + name = findItem<QmlGraphicsText>(viewport, "textName", 8); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(8)); + number = findItem<QmlGraphicsText>(viewport, "textNumber", 8); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(8)); + + // Confirm items positioned correctly + int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + gridview->setViewportY(120); + + // move outside visible area + model.moveItem(1, 25); + + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly and indexes correct + itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); + for (int i = 3; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), qreal((i%3)*80)); + QCOMPARE(item->y(), qreal((i/3)*60 + 60)); + name = findItem<QmlGraphicsText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QmlGraphicsText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + // move from outside visible into visible + model.moveItem(28, 8); + + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly and indexes correct + for (int i = 3; i < model.count() && i < itemCount; ++i) { + QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60 + 60); + name = findItem<QmlGraphicsText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QmlGraphicsText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + delete canvas; +} + +QmlView *tst_QmlGraphicsGridView::createView(const QString &filename) +{ + QmlView *canvas = new QmlView(0); + canvas->setFixedSize(240,320); + + QFile file(filename); + file.open(QFile::ReadOnly); + QString qml = file.readAll(); + canvas->setQml(qml, filename); + + return canvas; +} + +/* + Find an item with the specified objectName. If index is supplied then the + item must also evaluate the {index} expression equal to index +*/ +template<typename T> +T *tst_QmlGraphicsGridView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index) +{ + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) { + QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->QGraphicsObject::children().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + if (index != -1) { + QmlExpression e(qmlContext(item), "index", item); + e.setTrackChange(false); + if (e.value().toInt() == index) + return static_cast<T*>(item); + } else { + return static_cast<T*>(item); + } + } + item = findItem<T>(item, objectName, index); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + +template<typename T> +QList<T*> tst_QmlGraphicsGridView::findItems(QmlGraphicsItem *parent, const QString &objectName) +{ + QList<T*> items; + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) { + QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->QGraphicsObject::children().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + items.append(static_cast<T*>(item)); + items += findItems<T>(item, objectName); + } + + return items; +} + + +QTEST_MAIN(tst_QmlGraphicsGridView) + +#include "tst_qmlgraphicsgridview.moc" diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml b/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml index dccd2c7..c58927e 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml +++ b/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml @@ -8,7 +8,7 @@ Rectangle{ objectName: "particles" width:1; height:1; anchors.centerIn: parent; opacity: 1 lifeSpan: 100; lifeSpanDeviation: 20; count:1000; - fadeInDuration: 20; fadeOutDuration: 20; + fadeInDuration: 20; fadeOutDuration: 20; count: -1; emissionRate: 1000 angle: 0; angleDeviation: 360; velocity: 500; velocityDeviation:30 source: "particle.png" } diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp index e50437a..ed68eaf 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp @@ -91,8 +91,11 @@ void tst_QmlGraphicsParticles::properties() particles->setVelocityDeviation(100.0); QCOMPARE(particles->velocityDeviation(), 100.0); - particles->setEmitting(false); - QCOMPARE(particles->emitting(), false); + particles->setEmissionVariance(0.5); + QCOMPARE(particles->emissionVariance(),0.5); + + particles->setEmissionRate(12); + QCOMPARE(particles->emissionRate(), 12); } void tst_QmlGraphicsParticles::runs() diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index ba5c835..2a3cdde 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -45,6 +45,7 @@ #include <private/qmlgraphicstext_p.h> #include <private/qmlvaluetype_p.h> #include <QFontMetrics> +#include <math.h> class tst_qmlgraphicstext : public QObject @@ -201,8 +202,9 @@ void tst_qmlgraphicstext::width() QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test QFont f; - QFontMetrics fm(f); - int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); diff --git a/tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt new file mode 100644 index 0000000..a65f5fd --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt @@ -0,0 +1 @@ +2:18:Invalid import qualifier ID diff --git a/tests/auto/declarative/qmllanguage/data/invalidImportID.qml b/tests/auto/declarative/qmllanguage/data/invalidImportID.qml new file mode 100644 index 0000000..75aa06d --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/invalidImportID.qml @@ -0,0 +1,4 @@ +import Qt 4.6 +import Qt 4.6 as qt + +Object {} diff --git a/tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt b/tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt new file mode 100644 index 0000000..4bcc948 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt @@ -0,0 +1 @@ +1:1:Expected type name diff --git a/tests/auto/declarative/qmllanguage/data/invalidRoot.qml b/tests/auto/declarative/qmllanguage/data/invalidRoot.qml new file mode 100644 index 0000000..427827c --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/invalidRoot.qml @@ -0,0 +1,2 @@ +foo { +} diff --git a/tests/auto/declarative/qmllanguage/data/property.1.errors.txt b/tests/auto/declarative/qmllanguage/data/property.1.errors.txt new file mode 100644 index 0000000..3ae6c46 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.1.errors.txt @@ -0,0 +1 @@ +4:14:Expected property type diff --git a/tests/auto/declarative/qmllanguage/data/property.1.qml b/tests/auto/declarative/qmllanguage/data/property.1.qml new file mode 100644 index 0000000..62178e5 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.1.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Object { + property blah a; +} diff --git a/tests/auto/declarative/qmllanguage/data/property.2.errors.txt b/tests/auto/declarative/qmllanguage/data/property.2.errors.txt new file mode 100644 index 0000000..a18e21a --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.2.errors.txt @@ -0,0 +1 @@ +4:14:Unexpected property type modifier diff --git a/tests/auto/declarative/qmllanguage/data/property.2.qml b/tests/auto/declarative/qmllanguage/data/property.2.qml new file mode 100644 index 0000000..1d6d015 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.2.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Object { + property invalidmodifier<int> a; +} + diff --git a/tests/auto/declarative/qmllanguage/data/property.3.errors.txt b/tests/auto/declarative/qmllanguage/data/property.3.errors.txt new file mode 100644 index 0000000..5e09a25 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.3.errors.txt @@ -0,0 +1 @@ +4:14:Invalid property type modifier diff --git a/tests/auto/declarative/qmllanguage/data/property.3.qml b/tests/auto/declarative/qmllanguage/data/property.3.qml new file mode 100644 index 0000000..1b14b86 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.3.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +Object { + property invalidmodifier<Object> a; +} + + diff --git a/tests/auto/declarative/qmllanguage/data/property.4.errors.txt b/tests/auto/declarative/qmllanguage/data/property.4.errors.txt new file mode 100644 index 0000000..b447186 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.4.errors.txt @@ -0,0 +1 @@ +5:1:Syntax error diff --git a/tests/auto/declarative/qmllanguage/data/property.4.qml b/tests/auto/declarative/qmllanguage/data/property.4.qml new file mode 100644 index 0000000..d256c96 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.4.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Object { + readonly property int a +} diff --git a/tests/auto/declarative/qmllanguage/data/property.5.errors.txt b/tests/auto/declarative/qmllanguage/data/property.5.errors.txt new file mode 100644 index 0000000..32a8dc1 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.5.errors.txt @@ -0,0 +1 @@ +4:5:Readonly not yet supported diff --git a/tests/auto/declarative/qmllanguage/data/property.5.qml b/tests/auto/declarative/qmllanguage/data/property.5.qml new file mode 100644 index 0000000..c3aaf5e --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/property.5.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Object { + readonly property int a: value +} + diff --git a/tests/auto/declarative/qmllanguage/data/script.12.errors.txt b/tests/auto/declarative/qmllanguage/data/script.12.errors.txt new file mode 100644 index 0000000..85c8396 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/script.12.errors.txt @@ -0,0 +1 @@ +4:5:QmlJS declaration outside Script element diff --git a/tests/auto/declarative/qmllanguage/data/script.12.qml b/tests/auto/declarative/qmllanguage/data/script.12.qml new file mode 100644 index 0000000..ea6c482 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/script.12.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Object { + var a +} + diff --git a/tests/auto/declarative/qmllanguage/data/signal.1.errors.txt b/tests/auto/declarative/qmllanguage/data/signal.1.errors.txt new file mode 100644 index 0000000..78d9960 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.1.errors.txt @@ -0,0 +1 @@ +4:12:Expected parameter type diff --git a/tests/auto/declarative/qmllanguage/data/signal.1.qml b/tests/auto/declarative/qmllanguage/data/signal.1.qml new file mode 100644 index 0000000..d0ad155 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.1.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Object { + signal mySignal(nontype a) +} diff --git a/tests/auto/declarative/qmllanguage/data/signal.2.errors.txt b/tests/auto/declarative/qmllanguage/data/signal.2.errors.txt new file mode 100644 index 0000000..fce8928 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.2.errors.txt @@ -0,0 +1 @@ +4:21:Unexpected token `;' diff --git a/tests/auto/declarative/qmllanguage/data/signal.2.qml b/tests/auto/declarative/qmllanguage/data/signal.2.qml new file mode 100644 index 0000000..aa45ae9 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.2.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Object { + signal mySignal(,) +} + diff --git a/tests/auto/declarative/qmllanguage/data/signal.3.errors.txt b/tests/auto/declarative/qmllanguage/data/signal.3.errors.txt new file mode 100644 index 0000000..bf043ac --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.3.errors.txt @@ -0,0 +1 @@ +4:22:Expected token `identifier' diff --git a/tests/auto/declarative/qmllanguage/data/signal.3.qml b/tests/auto/declarative/qmllanguage/data/signal.3.qml new file mode 100644 index 0000000..f38ccc5 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/signal.3.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Object { + signal mySignal(a) +} + diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 0fa36a1..c646583 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -246,6 +246,17 @@ void tst_qmllanguage::errors_data() QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false; + QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; + + QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; + QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; + QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false; + + QTest::newRow("property.1") << "property.1.qml" << "property.1.errors.txt" << false; + QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false; + QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false; + QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false; + QTest::newRow("property.5") << "property.5.qml" << "property.5.errors.txt" << false; QTest::newRow("Script.1") << "script.1.qml" << "script.1.errors.txt" << false; QTest::newRow("Script.2") << "script.2.qml" << "script.2.errors.txt" << false; @@ -258,6 +269,7 @@ void tst_qmllanguage::errors_data() QTest::newRow("Script.9") << "script.9.qml" << "script.9.errors.txt" << false; QTest::newRow("Script.10") << "script.10.qml" << "script.10.errors.txt" << false; QTest::newRow("Script.11") << "script.11.qml" << "script.11.errors.txt" << false; + QTest::newRow("Script.12") << "script.12.qml" << "script.12.errors.txt" << false; QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; @@ -270,6 +282,7 @@ void tst_qmllanguage::errors_data() QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false; QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false; + QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false; } void tst_qmllanguage::errors() diff --git a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp b/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp index ed102a5..b481ce4 100644 --- a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp +++ b/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp @@ -51,6 +51,7 @@ #include <QVector3D> #include <QVector4D> #include <QQuaternion> +#include <qml.h> class tst_qmlmetatype : public QObject { @@ -60,8 +61,62 @@ public: private slots: void copy(); + + void qmlParserStatusCast(); + void qmlPropertyValueSourceCast(); + void qmlPropertyValueInterceptorCast(); + + void isList(); + void isQmlList(); + + void listCount(); + void listAt(); + + void defaultObject(); }; +class TestType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo); + + Q_CLASSINFO("DefaultProperty", "foo"); +public: + int foo() { return 0; } +}; +QML_DECLARE_TYPE(TestType); +QML_DEFINE_TYPE(Test, 1, 0, TestType, TestType); + +class ParserStatusTestType : public QObject, public QmlParserStatus +{ + Q_OBJECT + Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property +}; +QML_DECLARE_TYPE(ParserStatusTestType); +QML_DEFINE_TYPE(Test, 1, 0, ParserStatusTestType, ParserStatusTestType); + +class ValueSourceTestType : public QObject, public QmlPropertyValueSource +{ + Q_OBJECT + Q_INTERFACES(QmlPropertyValueSource) +public: + virtual void setTarget(const QmlMetaProperty &) {} +}; +QML_DECLARE_TYPE(ValueSourceTestType); +QML_DEFINE_TYPE(Test, 1, 0, ValueSourceTestType, ValueSourceTestType); + +class ValueInterceptorTestType : public QObject, public QmlPropertyValueInterceptor +{ + Q_OBJECT + Q_INTERFACES(QmlPropertyValueInterceptor) +public: + virtual void setTarget(const QmlMetaProperty &) {} + virtual void write(const QVariant &) {} +}; +QML_DECLARE_TYPE(ValueInterceptorTestType); +QML_DEFINE_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); + + #define COPY_TEST(cpptype, metatype, value, defaultvalue) \ { \ cpptype v = (value); cpptype v2 = (value); \ @@ -181,6 +236,7 @@ void tst_qmlmetatype::copy() QT_COPY_TEST(QKeySequence, QKeySequence("Ctrl+O")); QT_COPY_TEST(QPen, QPen(Qt::red)); QT_COPY_TEST(QTextLength, QTextLength(QTextLength::FixedLength, 10.2)); + QT_COPY_TEST(QTextFormat, QTextFormat(QTextFormat::ListFormat)); QT_COPY_TEST(QMatrix, QMatrix().translate(10, 10)); QT_COPY_TEST(QTransform, QTransform().translate(10, 10)); QT_COPY_TEST(QMatrix4x4, QMatrix4x4().translate(10, 10)); @@ -204,6 +260,175 @@ void tst_qmlmetatype::copy() COPY_TEST(QObject *, QObjectStar, &objectValue, 0); COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0); COPY_TEST(qreal, QReal, 10.2, 0); + + { + QVariant tv = QVariant::fromValue(QVariant(10)); + QVariant v(tv); QVariant v2(tv); + QVERIFY(QmlMetaType::copy(qMetaTypeId<QVariant>(), &v, 0)); + QVERIFY(v == QVariant()); + QVERIFY(QmlMetaType::copy(qMetaTypeId<QVariant>(), &v, &v2)); + QVERIFY(v == tv); + } + + { + TestType t; QVariant tv = QVariant::fromValue(&t); + + QVariant v(tv); QVariant v2(tv); + QVERIFY(QmlMetaType::copy(qMetaTypeId<TestType *>(), &v, 0)); + QVERIFY(v == QVariant::fromValue((TestType *)0)); + QVERIFY(QmlMetaType::copy(qMetaTypeId<TestType *>(), &v, &v2)); + QVERIFY(v == tv); + } +} + +void tst_qmlmetatype::qmlParserStatusCast() +{ + QCOMPARE(QmlMetaType::qmlParserStatusCast(QVariant::Int), -1); + QCOMPARE(QmlMetaType::qmlParserStatusCast(qMetaTypeId<TestType *>()), -1); + QCOMPARE(QmlMetaType::qmlParserStatusCast(qMetaTypeId<ValueSourceTestType *>()), -1); + + int cast = QmlMetaType::qmlParserStatusCast(qMetaTypeId<ParserStatusTestType *>()); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ParserStatusTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlParserStatus *)&t)); + + QmlParserStatus *status = reinterpret_cast<QmlParserStatus *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(status, &t); +} + +void tst_qmlmetatype::qmlPropertyValueSourceCast() +{ + QCOMPARE(QmlMetaType::qmlPropertyValueSourceCast(QVariant::Int), -1); + QCOMPARE(QmlMetaType::qmlPropertyValueSourceCast(qMetaTypeId<TestType *>()), -1); + QCOMPARE(QmlMetaType::qmlPropertyValueSourceCast(qMetaTypeId<ParserStatusTestType *>()), -1); + + int cast = QmlMetaType::qmlPropertyValueSourceCast(qMetaTypeId<ValueSourceTestType *>()); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ValueSourceTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlPropertyValueSource *)&t)); + + QmlPropertyValueSource *source = reinterpret_cast<QmlPropertyValueSource *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(source, &t); +} + +void tst_qmlmetatype::qmlPropertyValueInterceptorCast() +{ + QCOMPARE(QmlMetaType::qmlPropertyValueInterceptorCast(QVariant::Int), -1); + QCOMPARE(QmlMetaType::qmlPropertyValueInterceptorCast(qMetaTypeId<TestType *>()), -1); + QCOMPARE(QmlMetaType::qmlPropertyValueInterceptorCast(qMetaTypeId<ParserStatusTestType *>()), -1); + + int cast = QmlMetaType::qmlPropertyValueInterceptorCast(qMetaTypeId<ValueInterceptorTestType *>()); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ValueInterceptorTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlPropertyValueInterceptor *)&t)); + + QmlPropertyValueInterceptor *interceptor = reinterpret_cast<QmlPropertyValueInterceptor *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(interceptor, &t); +} + +void tst_qmlmetatype::isList() +{ + QCOMPARE(QmlMetaType::isList(QVariant()), false); + QCOMPARE(QmlMetaType::isList(QVariant::Invalid), false); + QCOMPARE(QmlMetaType::isList(QVariant::Int), false); + QCOMPARE(QmlMetaType::isList(QVariant(10)), false); + + QList<TestType *> list; + QmlConcreteList<TestType *> qmllist; + + QCOMPARE(QmlMetaType::isList(qMetaTypeId<QList<TestType *>*>()), true); + QCOMPARE(QmlMetaType::isList(QVariant::fromValue(&list)), true); + QCOMPARE(QmlMetaType::isList(qMetaTypeId<QmlList<TestType *>*>()), false); + QCOMPARE(QmlMetaType::isList(QVariant::fromValue((QmlList<TestType *>*)&qmllist)), false); +} + +void tst_qmlmetatype::isQmlList() +{ + QCOMPARE(QmlMetaType::isQmlList(QVariant::Invalid), false); + QCOMPARE(QmlMetaType::isQmlList(QVariant::Int), false); + + QCOMPARE(QmlMetaType::isQmlList(qMetaTypeId<QList<TestType *>*>()), false); + QCOMPARE(QmlMetaType::isQmlList(qMetaTypeId<QmlList<TestType *>*>()), true); +} + +void tst_qmlmetatype::listCount() +{ + QCOMPARE(QmlMetaType::listCount(QVariant()), 0); + QCOMPARE(QmlMetaType::listCount(QVariant(10)), 0); + + QList<TestType *> list; + QVariant listVar = QVariant::fromValue(&list); + QmlConcreteList<TestType *> qmllist; + QVariant qmllistVar = QVariant::fromValue((QmlList<TestType *>*)&qmllist); + + QCOMPARE(QmlMetaType::listCount(listVar), 0); + QCOMPARE(QmlMetaType::listCount(qmllistVar), 0); + + list.append(0); list.append(0); list.append(0); + qmllist.append(0); qmllist.append(0); qmllist.append(0); + + QCOMPARE(QmlMetaType::listCount(listVar), 3); + QCOMPARE(QmlMetaType::listCount(qmllistVar), 0); +} + +void tst_qmlmetatype::listAt() +{ + QCOMPARE(QmlMetaType::listAt(QVariant(), 0), QVariant()); + QCOMPARE(QmlMetaType::listAt(QVariant(10), 0), QVariant()); + QCOMPARE(QmlMetaType::listAt(QVariant(), 10), QVariant()); + QCOMPARE(QmlMetaType::listAt(QVariant(10), 10), QVariant()); + QCOMPARE(QmlMetaType::listAt(QVariant(), -10), QVariant()); + QCOMPARE(QmlMetaType::listAt(QVariant(10), -10), QVariant()); + + QList<TestType *> list; + QVariant listVar = QVariant::fromValue(&list); + QmlConcreteList<TestType *> qmllist; + QVariant qmllistVar = QVariant::fromValue((QmlList<TestType *>*)&qmllist); + + QCOMPARE(QmlMetaType::listAt(listVar, 0), QVariant()); + QCOMPARE(QmlMetaType::listAt(listVar, 2), QVariant()); + QCOMPARE(QmlMetaType::listAt(listVar, -1), QVariant()); + + QCOMPARE(QmlMetaType::listAt(qmllistVar, 0), QVariant()); + QCOMPARE(QmlMetaType::listAt(qmllistVar, 2), QVariant()); + QCOMPARE(QmlMetaType::listAt(qmllistVar, -1), QVariant()); + + TestType ttype; + QVariant ttypeVar = QVariant::fromValue(&ttype); + QVariant nullttypeVar = QVariant::fromValue((TestType *)0); + + list.append(0); list.append(&ttype); list.append(0); + qmllist.append(0); qmllist.append(&ttype); qmllist.append(0); + + QCOMPARE(QmlMetaType::listAt(listVar, 0), nullttypeVar); + QCOMPARE(QmlMetaType::listAt(listVar, 1), ttypeVar); + QCOMPARE(QmlMetaType::listAt(listVar, -1), QVariant()); + + QCOMPARE(QmlMetaType::listAt(qmllistVar, 0), QVariant()); + QCOMPARE(QmlMetaType::listAt(qmllistVar, 2), QVariant()); + QCOMPARE(QmlMetaType::listAt(qmllistVar, -1), QVariant()); +} + +void tst_qmlmetatype::defaultObject() +{ + QVERIFY(QmlMetaType::defaultProperty(&QObject::staticMetaObject).name() == 0); + QVERIFY(QmlMetaType::defaultProperty(&ParserStatusTestType::staticMetaObject).name() == 0); + QCOMPARE(QString(QmlMetaType::defaultProperty(&TestType::staticMetaObject).name()), QString("foo")); + + QObject o; + TestType t; + ParserStatusTestType p; + + QVERIFY(QmlMetaType::defaultProperty((QObject *)0).name() == 0); + QVERIFY(QmlMetaType::defaultProperty(&o).name() == 0); + QVERIFY(QmlMetaType::defaultProperty(&p).name() == 0); + QCOMPARE(QString(QmlMetaType::defaultProperty(&t).name()), QString("foo")); } QTEST_MAIN(tst_qmlmetatype) diff --git a/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro b/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro new file mode 100644 index 0000000..4d55b46 --- /dev/null +++ b/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qmlsystempalette.cpp diff --git a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp new file mode 100644 index 0000000..039eaa8 --- /dev/null +++ b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <qtest.h> +#include <QtDeclarative/qmlengine.h> +#include <QtDeclarative/qmlcomponent.h> +#include <private/qmlsystempalette_p.h> +#include <qpalette.h> +#include "../../../shared/util.h" + +class tst_qmlsystempalette : public QObject + +{ + Q_OBJECT +public: + tst_qmlsystempalette(); + +private slots: + void activePalette(); + void inactivePalette(); + void disabledPalette(); + +private: + QmlEngine engine; +}; + +tst_qmlsystempalette::tst_qmlsystempalette() +{ +} + +void tst_qmlsystempalette::activePalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Active); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +void tst_qmlsystempalette::inactivePalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Inactive); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +void tst_qmlsystempalette::disabledPalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Disabled); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +QTEST_MAIN(tst_qmlsystempalette) + +#include "tst_qmlsystempalette.moc" diff --git a/tests/auto/declarative/valuetypes/data/autoBindingRemoval.2.qml b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.2.qml new file mode 100644 index 0000000..ce2e82d --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.2.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + rect.x: value + + onRunScript: { rect = Qt.rect(10, 10, 10, 10) } +} + diff --git a/tests/auto/declarative/valuetypes/data/autoBindingRemoval.3.qml b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.3.qml new file mode 100644 index 0000000..c82b533 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.3.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property var value + + rect: value + + onRunScript: { rect.x = 44 } +} + diff --git a/tests/auto/declarative/valuetypes/data/autoBindingRemoval.qml b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.qml new file mode 100644 index 0000000..a8a72f5 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/autoBindingRemoval.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + rect.x: value + + onRunScript: { rect.x = 42; } +} + diff --git a/tests/auto/declarative/valuetypes/data/bindingAssignment.qml b/tests/auto/declarative/valuetypes/data/bindingAssignment.qml new file mode 100644 index 0000000..a652186 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/bindingAssignment.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + + rect.x: value +} diff --git a/tests/auto/declarative/valuetypes/data/bindingConflict.qml b/tests/auto/declarative/valuetypes/data/bindingConflict.qml new file mode 100644 index 0000000..fd25c9f --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/bindingConflict.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int value: 13 + + rect.x: value + rect: "10,10,10x10" +} diff --git a/tests/auto/declarative/valuetypes/data/bindingRead.qml b/tests/auto/declarative/valuetypes/data/bindingRead.qml new file mode 100644 index 0000000..538d776 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/bindingRead.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + property int value: rect.x +} diff --git a/tests/auto/declarative/valuetypes/data/scriptAccess.qml b/tests/auto/declarative/valuetypes/data/scriptAccess.qml new file mode 100644 index 0000000..96592eb --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/scriptAccess.qml @@ -0,0 +1,9 @@ +import Qt 4.6 +import Test 1.0 + +MyTypeObject { + property int valuePre; + property int valuePost; + + Component.onCompleted: { valuePre = rect.x; rect.x = 19; valuePost = rect.x; } +} diff --git a/tests/auto/declarative/valuetypes/data/staticAssignment.qml b/tests/auto/declarative/valuetypes/data/staticAssignment.qml new file mode 100644 index 0000000..b687f89 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/staticAssignment.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + rect.x: 9 +} diff --git a/tests/auto/declarative/valuetypes/data/valueInterceptors.qml b/tests/auto/declarative/valuetypes/data/valueInterceptors.qml new file mode 100644 index 0000000..026ae83 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/valueInterceptors.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int value: 13; + + rect.x: MyOffsetValueInterceptor {} + rect.x: value +} diff --git a/tests/auto/declarative/valuetypes/data/valueSources.qml b/tests/auto/declarative/valuetypes/data/valueSources.qml new file mode 100644 index 0000000..d4d4391 --- /dev/null +++ b/tests/auto/declarative/valuetypes/data/valueSources.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + rect.x: MyConstantValueSource {} +} diff --git a/tests/auto/declarative/valuetypes/testtypes.cpp b/tests/auto/declarative/valuetypes/testtypes.cpp index d57afaf..565eb1c 100644 --- a/tests/auto/declarative/valuetypes/testtypes.cpp +++ b/tests/auto/declarative/valuetypes/testtypes.cpp @@ -40,4 +40,6 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_TYPE(Test, 1, 0, 0, MyTypeObject, MyTypeObject); +QML_DEFINE_TYPE(Test, 1, 0, MyTypeObject, MyTypeObject); +QML_DEFINE_TYPE(Test, 1, 0, MyConstantValueSource, MyConstantValueSource); +QML_DEFINE_TYPE(Test, 1, 0, MyOffsetValueInterceptor, MyOffsetValueInterceptor); diff --git a/tests/auto/declarative/valuetypes/testtypes.h b/tests/auto/declarative/valuetypes/testtypes.h index cc98d7c..67e32f5 100644 --- a/tests/auto/declarative/valuetypes/testtypes.h +++ b/tests/auto/declarative/valuetypes/testtypes.h @@ -51,6 +51,7 @@ #include <QVector3D> #include <QFont> #include <qml.h> +#include <QmlPropertyValueSource> class MyTypeObject : public QObject { @@ -90,39 +91,62 @@ public: QPoint m_point; QPoint point() const { return m_point; } - void setPoint(const QPoint &v) { m_point = v; } + void setPoint(const QPoint &v) { m_point = v; emit changed(); } QPointF m_pointf; QPointF pointf() const { return m_pointf; } - void setPointf(const QPointF &v) { m_pointf = v; } + void setPointf(const QPointF &v) { m_pointf = v; emit changed(); } QSize m_size; QSize size() const { return m_size; } - void setSize(const QSize &v) { m_size = v; } + void setSize(const QSize &v) { m_size = v; emit changed(); } QSizeF m_sizef; QSizeF sizef() const { return m_sizef; } - void setSizef(const QSizeF &v) { m_sizef = v; } + void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); } QRect m_rect; QRect rect() const { return m_rect; } - void setRect(const QRect &v) { m_rect = v; } + void setRect(const QRect &v) { m_rect = v; emit changed(); } QRectF m_rectf; QRectF rectf() const { return m_rectf; } - void setRectf(const QRectF &v) { m_rectf = v; } + void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } QVector3D m_vector; QVector3D vector() const { return m_vector; } - void setVector(const QVector3D &v) { m_vector = v; } + void setVector(const QVector3D &v) { m_vector = v; emit changed(); } QFont m_font; QFont font() const { return m_font; } - void setFont(const QFont &v) { m_font = v; } + void setFont(const QFont &v) { m_font = v; emit changed(); } + + void emitRunScript() { emit runScript(); } signals: void changed(); + void runScript(); }; QML_DECLARE_TYPE(MyTypeObject); +class MyConstantValueSource : public QObject, public QmlPropertyValueSource +{ + Q_OBJECT +public: + virtual void setTarget(const QmlMetaProperty &p) { p.write(3345); } +}; +QML_DECLARE_TYPE(MyConstantValueSource); + +class MyOffsetValueInterceptor : public QObject, public QmlPropertyValueInterceptor +{ + Q_OBJECT +public: + virtual void setTarget(const QmlMetaProperty &p) { prop = p; } + virtual void write(const QVariant &value) { prop.write(value.toInt() + 13, QmlMetaProperty::BypassInterceptor); } + +private: + QmlMetaProperty prop; +}; +QML_DECLARE_TYPE(MyOffsetValueInterceptor); + #endif // TESTTYPES_H diff --git a/tests/auto/declarative/valuetypes/tst_valuetypes.cpp b/tests/auto/declarative/valuetypes/tst_valuetypes.cpp index a338e47..d09bdf5 100644 --- a/tests/auto/declarative/valuetypes/tst_valuetypes.cpp +++ b/tests/auto/declarative/valuetypes/tst_valuetypes.cpp @@ -43,6 +43,7 @@ #include <QmlEngine> #include <QmlComponent> #include <QDebug> +#include <private/qmlvaluetype_p.h> #include "testtypes.h" class tst_valuetypes : public QObject @@ -61,14 +62,16 @@ private slots: void vector3d(); void font(); - // ### - // Test binding assignment - // Test static assignment - // Test JS assignment - // Test "font.x: blah; font: blah2;" conflict - // Test constant binding removal - // Test value sources - // Test behaviours + void bindingAssignment(); + void bindingRead(); + void staticAssignment(); + void scriptAccess(); + void autoBindingRemoval(); + void valueSources(); + void valueInterceptors(); + void bindingConflict(); + void cppClasses(); + private: QmlEngine engine; }; @@ -312,6 +315,8 @@ void tst_valuetypes::font() QVERIFY(object != 0); QCOMPARE(object->font().pixelSize(), 10); + + delete object; } // Test pixelSize and pointSize @@ -322,9 +327,195 @@ void tst_valuetypes::font() QVERIFY(object != 0); QCOMPARE(object->font().pixelSize(), 10); + + delete object; } } +// Test bindings can write to value types +void tst_valuetypes::bindingAssignment() +{ + QmlComponent component(&engine, TEST_FILE("bindingAssignment.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(92)); + + QCOMPARE(object->rect().x(), 92); + + delete object; +} + +// Test bindings can read from value types +void tst_valuetypes::bindingRead() +{ + QmlComponent component(&engine, TEST_FILE("bindingRead.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 2); + + object->setRect(QRect(19, 3, 88, 2)); + + QCOMPARE(object->property("value").toInt(), 19); + + delete object; +} + +// Test static values can assign to value types +void tst_valuetypes::staticAssignment() +{ + QmlComponent component(&engine, TEST_FILE("staticAssignment.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 9); + + delete object; +} + +// Test scripts can read/write value types +void tst_valuetypes::scriptAccess() +{ + QmlComponent component(&engine, TEST_FILE("scriptAccess.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("valuePre").toInt(), 2); + QCOMPARE(object->rect().x(), 19); + QCOMPARE(object->property("valuePost").toInt(), 19); + + delete object; +} + +// Test that assigning a constant from script removes any binding +void tst_valuetypes::autoBindingRemoval() +{ + { + QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(13)); + + QCOMPARE(object->rect().x(), 13); + + object->emitRunScript(); + + QCOMPARE(object->rect().x(), 42); + + object->setProperty("value", QVariant(92)); + + QCOMPARE(object->rect().x(), 42); + + delete object; + } + + { + QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(13)); + + QCOMPARE(object->rect().x(), 13); + + object->emitRunScript(); + + QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); + + object->setProperty("value", QVariant(92)); + + QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); + + delete object; + } + + { + QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.3.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + object->setProperty("value", QVariant(QRect(9, 22, 33, 44))); + + QCOMPARE(object->rect(), QRect(9, 22, 33, 44)); + + object->emitRunScript(); + + QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); + + object->setProperty("value", QVariant(QRect(19, 3, 4, 8))); + + QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); + + delete object; + } + +} + +// Test that property value sources assign to value types +void tst_valuetypes::valueSources() +{ + QmlComponent component(&engine, TEST_FILE("valueSources.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 3345); + + delete object; +} + +// Test that property value interceptors can be applied to value types +void tst_valuetypes::valueInterceptors() +{ + QmlComponent component(&engine, TEST_FILE("valueInterceptors.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 26); + + object->setProperty("value", 99); + + QCOMPARE(object->rect().x(), 112); + + delete object; +} + +// Test that you can't assign a binding to the "root" value type, and a sub-property +void tst_valuetypes::bindingConflict() +{ + QmlComponent component(&engine, TEST_FILE("bindingConflict.qml")); + QCOMPARE(component.isError(), true); +} + +#define CPP_TEST(type, v) \ +{ \ + type *t = new type; \ + QVariant value(v); \ + t->setValue(value); \ + QCOMPARE(t->value(), value); \ + delete t; \ +} + +// Test that the value type classes can be used manually +void tst_valuetypes::cppClasses() +{ + CPP_TEST(QmlPointValueType, QPoint(19, 33)); + CPP_TEST(QmlPointFValueType, QPointF(33.6, -23)); + CPP_TEST(QmlSizeValueType, QSize(-100, 18)); + CPP_TEST(QmlSizeFValueType, QSizeF(-100.7, 18.2)); + CPP_TEST(QmlRectValueType, QRect(13, 39, 10928, 88)); + CPP_TEST(QmlRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); + CPP_TEST(QmlVector3DValueType, QVector3D(18.2, 19.7, 1002)); + CPP_TEST(QmlFontValueType, QFont("Helvetica")); + +} QTEST_MAIN(tst_valuetypes) #include "tst_valuetypes.moc" diff --git a/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.0.png b/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.0.png Binary files differnew file mode 100644 index 0000000..9c9ceae --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.0.png diff --git a/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.qml b/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.qml new file mode 100644 index 0000000..7ac6f51 --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/data-MAC/fillmode.qml @@ -0,0 +1,279 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 32 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 48 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 64 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 80 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 96 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 112 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 128 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 144 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 160 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 176 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 192 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 208 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 224 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 240 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 256 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 272 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 288 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 304 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 320 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 336 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 352 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 368 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 384 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 400 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 416 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 432 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 448 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 464 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 480 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 496 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 512 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 528 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 544 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 560 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 576 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 592 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 608 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 624 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 640 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 656 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 672 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 688 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 704 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 720 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 736 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 752 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 768 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 784 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 800 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 816 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 832 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 848 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 864 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 880 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 896 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 912 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 928 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 944 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 960 + image: "fillmode.0.png" + } + Frame { + msec: 976 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 992 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1008 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1024 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1040 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1056 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } +} diff --git a/tests/auto/declarative/visual/fillmode/data/fillmode.0.png b/tests/auto/declarative/visual/fillmode/data/fillmode.0.png Binary files differnew file mode 100644 index 0000000..9c9ceae --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/data/fillmode.0.png diff --git a/tests/auto/declarative/visual/fillmode/data/fillmode.qml b/tests/auto/declarative/visual/fillmode/data/fillmode.qml new file mode 100644 index 0000000..58af8e8 --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/data/fillmode.qml @@ -0,0 +1,279 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 32 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 48 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 64 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 80 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 96 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 112 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 128 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 144 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 160 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 176 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 192 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 208 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 224 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 240 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 256 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 272 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 288 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 304 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 320 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 336 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 352 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 368 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 384 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 400 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 416 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 432 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 448 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 464 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 480 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 496 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 512 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 528 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 544 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 560 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 576 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 592 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 608 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 624 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 640 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 656 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 672 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 688 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 704 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 720 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 736 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 752 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 768 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 784 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 800 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 816 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 832 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 848 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 864 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 880 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 896 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 912 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 928 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 944 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 960 + image: "fillmode.0.png" + } + Frame { + msec: 976 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 992 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1008 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1024 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1040 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } + Frame { + msec: 1056 + hash: "c8cb8d51ca04231dc272133faaf2fb6d" + } +} diff --git a/tests/auto/declarative/visual/fillmode/face.png b/tests/auto/declarative/visual/fillmode/face.png Binary files differnew file mode 100644 index 0000000..9623b1a --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/face.png diff --git a/tests/auto/declarative/visual/fillmode/fillmode.qml b/tests/auto/declarative/visual/fillmode/fillmode.qml new file mode 100644 index 0000000..8450bf2 --- /dev/null +++ b/tests/auto/declarative/visual/fillmode/fillmode.qml @@ -0,0 +1,16 @@ +import Qt 4.6 + +Rectangle { + id: screen; width: 750; height: 600; color: "gray" + property string source: "face.png" + + Grid { + columns: 3 + Image { width: 250; height: 300; source: screen.source; fillMode: Image.Stretch } + Image { width: 250; height: 300; source: screen.source; fillMode: Image.PreserveAspectFit; smooth: true } + Image { width: 250; height: 300; source: screen.source; fillMode: Image.PreserveAspectCrop } + Image { width: 250; height: 300; source: screen.source; fillMode: Image.Tile; smooth: true } + Image { width: 250; height: 300; source: screen.source; fillMode: Image.TileHorizontally } + Image { width: 250; height: 300; source: screen.source; fillMode: Image.TileVertically } + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.0.png b/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.0.png Binary files differnew file mode 100644 index 0000000..a54a327 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.0.png diff --git a/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.qml b/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.qml new file mode 100644 index 0000000..266c9a3 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data-MAC/plaintext.qml @@ -0,0 +1,351 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 32 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 48 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 64 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 80 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 96 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 112 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 128 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 144 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 160 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 176 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 192 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 208 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 224 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 240 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 256 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 272 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 288 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 304 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 320 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 336 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 352 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 368 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 384 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 400 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 416 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 432 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 448 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 464 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 480 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 496 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 512 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 528 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 544 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 560 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 576 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 592 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 608 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 624 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 640 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 656 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 672 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 688 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 704 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 720 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 736 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 752 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 768 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 784 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 800 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 816 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 832 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 848 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 864 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 880 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 896 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 912 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 928 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 944 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 960 + image: "plaintext.0.png" + } + Frame { + msec: 976 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 992 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1008 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1024 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1040 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1056 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1072 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1088 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1104 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1120 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1136 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1152 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1168 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1184 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1200 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1216 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1232 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1248 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1264 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1280 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1296 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1312 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1328 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } + Frame { + msec: 1344 + hash: "9f3d0a505dec1982d9b405be72c265f8" + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.0.png b/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.0.png Binary files differnew file mode 100644 index 0000000..c2ddee1 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.0.png diff --git a/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.qml b/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.qml new file mode 100644 index 0000000..e971809 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data-MAC/richtext.qml @@ -0,0 +1,359 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 32 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 48 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 64 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 80 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 96 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 112 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 128 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 144 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 160 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 176 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 192 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 208 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 224 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 240 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 256 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 272 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 288 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 304 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 320 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 336 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 352 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 368 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 384 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 400 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 416 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 432 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 448 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 464 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 480 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 496 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 512 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 528 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 544 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 560 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 576 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 592 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 608 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 624 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 640 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 656 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 672 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 688 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 704 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 720 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 736 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 752 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 768 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 784 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 800 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 816 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 832 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 848 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 864 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 880 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 896 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 912 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 928 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 944 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 960 + image: "richtext.0.png" + } + Frame { + msec: 976 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 992 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1008 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1024 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1040 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1056 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1072 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1088 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1104 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1120 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1136 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1152 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1168 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1184 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1200 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1216 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1232 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1248 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1264 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1280 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1296 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1312 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1328 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1344 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1360 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } + Frame { + msec: 1376 + hash: "259cc9829171ea866dac4ffe8ef6b489" + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/data/plaintext.0.png b/tests/auto/declarative/visual/qfxtext/font/data/plaintext.0.png Binary files differnew file mode 100644 index 0000000..50d56dc --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data/plaintext.0.png diff --git a/tests/auto/declarative/visual/qfxtext/font/data/plaintext.qml b/tests/auto/declarative/visual/qfxtext/font/data/plaintext.qml new file mode 100644 index 0000000..f4cbcbd --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data/plaintext.qml @@ -0,0 +1,351 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 32 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 48 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 64 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 80 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 96 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 112 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 128 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 144 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 160 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 176 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 192 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 208 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 224 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 240 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 256 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 272 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 288 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 304 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 320 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 336 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 352 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 368 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 384 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 400 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 416 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 432 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 448 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 464 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 480 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 496 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 512 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 528 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 544 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 560 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 576 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 592 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 608 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 624 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 640 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 656 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 672 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 688 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 704 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 720 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 736 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 752 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 768 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 784 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 800 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 816 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 832 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 848 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 864 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 880 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 896 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 912 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 928 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 944 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 960 + image: "plaintext.0.png" + } + Frame { + msec: 976 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 992 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1008 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1024 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1040 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1056 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1072 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1088 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1104 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1120 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1136 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1152 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1168 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1184 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1200 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1216 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1232 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1248 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1264 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1280 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1296 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1312 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1328 + hash: "d553014bc56a46787e30459b0f44f57a" + } + Frame { + msec: 1344 + hash: "d553014bc56a46787e30459b0f44f57a" + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/data/richtext.0.png b/tests/auto/declarative/visual/qfxtext/font/data/richtext.0.png Binary files differnew file mode 100644 index 0000000..2910670 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data/richtext.0.png diff --git a/tests/auto/declarative/visual/qfxtext/font/data/richtext.qml b/tests/auto/declarative/visual/qfxtext/font/data/richtext.qml new file mode 100644 index 0000000..9f396c2 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/data/richtext.qml @@ -0,0 +1,359 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 32 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 48 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 64 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 80 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 96 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 112 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 128 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 144 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 160 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 176 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 192 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 208 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 224 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 240 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 256 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 272 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 288 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 304 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 320 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 336 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 352 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 368 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 384 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 400 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 416 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 432 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 448 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 464 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 480 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 496 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 512 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 528 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 544 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 560 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 576 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 592 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 608 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 624 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 640 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 656 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 672 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 688 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 704 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 720 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 736 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 752 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 768 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 784 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 800 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 816 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 832 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 848 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 864 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 880 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 896 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 912 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 928 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 944 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 960 + image: "richtext.0.png" + } + Frame { + msec: 976 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 992 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1008 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1024 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1040 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1056 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1072 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1088 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1104 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1120 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1136 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1152 + hash: "dfea78484b840b8cab690e277b960723" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1168 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1184 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1200 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1216 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1232 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1248 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1264 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1280 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1296 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1312 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1328 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1344 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1360 + hash: "dfea78484b840b8cab690e277b960723" + } + Frame { + msec: 1376 + hash: "dfea78484b840b8cab690e277b960723" + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/plaintext.qml b/tests/auto/declarative/visual/qfxtext/font/plaintext.qml new file mode 100644 index 0000000..f219e09 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/plaintext.qml @@ -0,0 +1,85 @@ +import Qt 4.6 + +Rectangle { + id: s; width: 800; height: 1000; color: "lightsteelblue" + property string text: "The quick brown fox jumps over the lazy dog." + + Column { + spacing: 10 + Text { + text: s.text + } + Text { + text: s.text; font.pixelSize: 18 + } + Text { + text: s.text; font.pointSize: 25 + } + Text { + text: s.text; color: "red"; smooth: true + } + Text { + text: s.text; font.capitalization: "AllUppercase" + } + Text { + text: s.text; font.underline: true + } + Text { + text: s.text; font.overline: true; smooth: true + } + Text { + text: s.text; font.strikeout: true + } + Text { + text: s.text; font.underline: true; font.overline: true; font.strikeout: true + } + Text { + text: s.text; font.letterSpacing: 200 + } + Text { + text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue" + } + Text { + text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Sunken; styleColor: "gray" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Raised; styleColor: "yellow" + } + Text { + text: s.text; horizontalAlignment: Text.AlignLeft; width: 800 + } + Text { + text: s.text; horizontalAlignment: Text.AlignHCenter; width: 800 + } + Text { + text: s.text; horizontalAlignment: Text.AlignRight; width: 800 + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrap: true; width: 200 + } + Text { + text: s.text; elide: Text.ElideLeft; width: 200 + } + Text { + text: s.text; elide: Text.ElideMiddle; width: 200 + } + Text { + text: s.text; elide: Text.ElideRight; width: 200 + } + Text { + text: s.text; elide: Text.ElideLeft; width: 200; wrap: true + } + Text { + text: s.text; elide: Text.ElideMiddle; width: 200; wrap: true + } + Text { + text: s.text; elide: Text.ElideRight; width: 200; wrap: true + } + } +} diff --git a/tests/auto/declarative/visual/qfxtext/font/richtext.qml b/tests/auto/declarative/visual/qfxtext/font/richtext.qml new file mode 100644 index 0000000..00a9749 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/font/richtext.qml @@ -0,0 +1,85 @@ +import Qt 4.6 + +Rectangle { + id: s; width: 800; height: 1000; color: "lightsteelblue" + property string text: "<b>The</b> <i>quick</i> <u>brown</u> <o>fox</o> <big>jumps</big> <small>over</small> <tt>the</tt> <s>lazy</s> <em>dog</em>." + + Column { + spacing: 10 + Text { + text: s.text + } + Text { + text: s.text; font.pixelSize: 18 + } + Text { + text: s.text; font.pointSize: 25 + } + Text { + text: s.text; color: "red"; smooth: true + } + Text { + text: s.text; font.capitalization: "AllUppercase" + } + Text { + text: s.text; font.underline: true + } + Text { + text: s.text; font.overline: true; smooth: true + } + Text { + text: s.text; font.strikeout: true + } + Text { + text: s.text; font.underline: true; font.overline: true; font.strikeout: true + } + Text { + text: s.text; font.letterSpacing: 200 + } + Text { + text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue" + } + Text { + text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Sunken; styleColor: "gray" + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Raised; styleColor: "yellow" + } + Text { + text: s.text; horizontalAlignment: Text.AlignLeft; width: 800 + } + Text { + text: s.text; horizontalAlignment: Text.AlignHCenter; width: 800 + } + Text { + text: s.text; horizontalAlignment: Text.AlignRight; width: 800 + } + Text { + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrap: true; width: 200 + } + Text { + text: s.text; elide: Text.ElideLeft; width: 200 + } + Text { + text: s.text; elide: Text.ElideMiddle; width: 200 + } + Text { + text: s.text; elide: Text.ElideRight; width: 200 + } + Text { + text: s.text; elide: Text.ElideLeft; width: 200; wrap: true + } + Text { + text: s.text; elide: Text.ElideMiddle; width: 200; wrap: true + } + Text { + text: s.text; elide: Text.ElideRight; width: 200; wrap: true + } + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png Binary files differnew file mode 100644 index 0000000..30bdefd --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png Binary files differnew file mode 100644 index 0000000..799e028 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png Binary files differnew file mode 100644 index 0000000..ed267c2 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml new file mode 100644 index 0000000..3199f31 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml @@ -0,0 +1,783 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b4df49cbd7cf972af9879399808f6c53" + } + Frame { + msec: 32 + hash: "1c129b1c4a39412bed2f23d712f2bc90" + } + Frame { + msec: 48 + hash: "fbcc4bc3fea46a43453aa39b032264c6" + } + Frame { + msec: 64 + hash: "2cb13275faca414b7c8ba9d70067fd1f" + } + Frame { + msec: 80 + hash: "b017afb05f96085ee3395d62e62e457b" + } + Frame { + msec: 96 + hash: "642851d10c549c8ae72c057563e99e64" + } + Frame { + msec: 112 + hash: "494c0942f7410d455a4b113fb908e570" + } + Frame { + msec: 128 + hash: "cb0a2f9980f27757c0c1d62ef3dcfde0" + } + Frame { + msec: 144 + hash: "2fb9cf782ea106006af8bcd66c62869c" + } + Frame { + msec: 160 + hash: "bf68518323f03e4f407831e8b34f247b" + } + Frame { + msec: 176 + hash: "c99abe9c0384ae339fdfa0c75dc8047d" + } + Frame { + msec: 192 + hash: "96f2eb402633c1aca8a1a2b0d60af5fb" + } + Frame { + msec: 208 + hash: "6cba51a856f1ba54ee702761f196b915" + } + Frame { + msec: 224 + hash: "9188926caa6c6ba8cb3aee04de635b96" + } + Frame { + msec: 240 + hash: "81132a5e8768de0630311813170f166e" + } + Frame { + msec: 256 + hash: "a638698d7ccb73f20f6eeba3857f417c" + } + Frame { + msec: 272 + hash: "4761ba6847f6f0769b916106c5f3245b" + } + Frame { + msec: 288 + hash: "13bc0c681962bada7fcb3b722895ffaa" + } + Frame { + msec: 304 + hash: "505c5824be16d812b7c339f1f9b8a10b" + } + Frame { + msec: 320 + hash: "d191d502d9c685f8497583669147ee73" + } + Frame { + msec: 336 + hash: "c17f55cc5d7bf541e235791a157aa8b9" + } + Frame { + msec: 352 + hash: "3ef401f87830c53b9b277d4420a9a742" + } + Frame { + msec: 368 + hash: "d04816400e66ebbf797f9985a53f7cfb" + } + Frame { + msec: 384 + hash: "d7a7df7c2a92449f42d61c0572e7dbac" + } + Frame { + msec: 400 + hash: "f49a3bcf3842f554136ff9bd5bb470ef" + } + Frame { + msec: 416 + hash: "27bccc5933d7bfaad6d5f6a10efd283b" + } + Frame { + msec: 432 + hash: "3067ac00a4d58c67bb96d813c344871d" + } + Frame { + msec: 448 + hash: "d38d7192688feecc38fd63285d37ce49" + } + Frame { + msec: 464 + hash: "4172d1b74cdd6ea89be718977775a9e0" + } + Frame { + msec: 480 + hash: "2761a7e58cbfa46fc6d306c8270e4f10" + } + Frame { + msec: 496 + hash: "58a851b9fbcb98afc7c1bc58c2f45e4a" + } + Frame { + msec: 512 + hash: "0f7789f04bf20708d9d6f1e818b6b88a" + } + Frame { + msec: 528 + hash: "8d8b8d109dce4c7b05ecb603b4718859" + } + Frame { + msec: 544 + hash: "0fc6fde589932ac41787e8ebfe3fcbe3" + } + Frame { + msec: 560 + hash: "e08bffd5a56795488f090a475513e5db" + } + Frame { + msec: 576 + hash: "e089ab7c5feefd3d745bb665e2ff49ee" + } + Frame { + msec: 592 + hash: "e7b787fb1b21e991c19ec88b3d985b69" + } + Frame { + msec: 608 + hash: "a6f4f32287bd926e0eeff68717b80512" + } + Frame { + msec: 624 + hash: "3344ca9c97473bd922bd8efd5d6ab212" + } + Frame { + msec: 640 + hash: "a330510a9f62acb4f2163728939d0bb5" + } + Frame { + msec: 656 + hash: "1ec473936f2279f13675b6b5fe2ee392" + } + Frame { + msec: 672 + hash: "b193b7d2917ee00c4cb29bf244186bef" + } + Frame { + msec: 688 + hash: "75137e977941e357bad2ad9af2cbc898" + } + Frame { + msec: 704 + hash: "31773ba8979a31b1691860b7dafe28dc" + } + Frame { + msec: 720 + hash: "d8922452edbba4f1092b83e87c0330ea" + } + Frame { + msec: 736 + hash: "982c80305b54236d1259f5672098652d" + } + Frame { + msec: 752 + hash: "d8b23fb0867fb75558960216c8d0f2aa" + } + Frame { + msec: 768 + hash: "daf7833f93a216d1e025c9129b3a7caa" + } + Frame { + msec: 784 + hash: "bb08e8fe2ce74018fc702e5dad8927fe" + } + Frame { + msec: 800 + hash: "22a30051c87d4de7e734d9de6ce7eed8" + } + Frame { + msec: 816 + hash: "d8625628587feace367fc97c1f11aff8" + } + Frame { + msec: 832 + hash: "e9dbbf715fc094cb22ecd5c6df602f95" + } + Frame { + msec: 848 + hash: "ca69b2b9f8e6b16e3bc6d93598b6c75a" + } + Frame { + msec: 864 + hash: "87e09752e39df5042aef163fe4ed0b47" + } + Frame { + msec: 880 + hash: "80adfaf02838c8bd372e53d0483fbac5" + } + Frame { + msec: 896 + hash: "9934a1aece14ba7369b00cf2620cd207" + } + Frame { + msec: 912 + hash: "954a70a949fdcca4e4412174f30653c3" + } + Frame { + msec: 928 + hash: "850fa936516f8b145465eac39c9a74a6" + } + Frame { + msec: 944 + hash: "1d844e8a7c710ccbf31f47470cc9abf2" + } + Frame { + msec: 960 + image: "particles.0.png" + } + Frame { + msec: 976 + hash: "33f4eee3f6e3fb715463254d727ef898" + } + Frame { + msec: 992 + hash: "68648a3f75f58b34dd9770a9edc2caea" + } + Frame { + msec: 1008 + hash: "ad0d431ab7e6cfbb43053050a1cf5e40" + } + Frame { + msec: 1024 + hash: "d1ae74c9bf3826d30fb461ca2fd8e36a" + } + Frame { + msec: 1040 + hash: "bda9d77c68a30d491abdfbfcf854c5ea" + } + Frame { + msec: 1056 + hash: "386ea303f8102339f8cd5ae88fd5f6bc" + } + Frame { + msec: 1072 + hash: "8c81d3992851ebeb3cb820bc4510af66" + } + Frame { + msec: 1088 + hash: "566813e312ffdde4a7d3af4276bc8cdd" + } + Frame { + msec: 1104 + hash: "d9c8b391b12ee40aa393f4fb39c12a16" + } + Frame { + msec: 1120 + hash: "f2bf70bda626089437f0ab67ad62d8f6" + } + Frame { + msec: 1136 + hash: "88b2d1ecd7d51d0bf8c947a3433b7013" + } + Frame { + msec: 1152 + hash: "e93e0553c5dcc6dcd21dad0932d1e3fa" + } + Frame { + msec: 1168 + hash: "c1ec148772d399ea4934cdfc514f6980" + } + Frame { + msec: 1184 + hash: "14f286793de5452f4677e8b6fd5c1e7e" + } + Frame { + msec: 1200 + hash: "220a7df0af53fc9a2442956128091ad8" + } + Frame { + msec: 1216 + hash: "84c49512f5e9f138901b3833a5adbcab" + } + Frame { + msec: 1232 + hash: "b05410caa120f5a4191a44b84aa17a8c" + } + Frame { + msec: 1248 + hash: "e1f6db204f62394205c1d4d56bbf9f52" + } + Frame { + msec: 1264 + hash: "f45033d1350009e09f62e81aeec297a5" + } + Frame { + msec: 1280 + hash: "dfd88b1dba38ab8260e00b3810b89318" + } + Frame { + msec: 1296 + hash: "17503276f68e365cde03607d66fe4c8e" + } + Frame { + msec: 1312 + hash: "28f03c5c0fe5c4647c5b9d3b72a07c76" + } + Frame { + msec: 1328 + hash: "ea2082529b50543fab22497e01938102" + } + Frame { + msec: 1344 + hash: "a700a2f3721625b1ec68107884d1ce67" + } + Frame { + msec: 1360 + hash: "ce717f1f1d98158aeef1cc6a9485dc80" + } + Frame { + msec: 1376 + hash: "7febe7c67e1c159881de72f62800a505" + } + Frame { + msec: 1392 + hash: "474931cb44a8e18426b9c2cc9f6df482" + } + Frame { + msec: 1408 + hash: "1085b4873b9a4934882a163be72a2710" + } + Frame { + msec: 1424 + hash: "59e7911800e915e6f159cb111ce61a54" + } + Frame { + msec: 1440 + hash: "6d0d780ffc726b04f9885c25b08d1009" + } + Frame { + msec: 1456 + hash: "bf896d6403dc1ad26536cc1165e71e9e" + } + Frame { + msec: 1472 + hash: "86397c7dcf5ed34edbbaa465ae6eab43" + } + Frame { + msec: 1488 + hash: "ed1b4967bf14eead9cb4d2dcfbdb46c2" + } + Frame { + msec: 1504 + hash: "67b7e59c8f945d1f3bdb1944fa736ecf" + } + Frame { + msec: 1520 + hash: "b5f95e89f39d1c4821ba38547b0f2e3b" + } + Frame { + msec: 1536 + hash: "5bc91c9e35afa255a2dda28db9802b1e" + } + Frame { + msec: 1552 + hash: "84fab4042e0ff891ca1998cbfbb60e5a" + } + Frame { + msec: 1568 + hash: "7c5ef5025a06e990171dac3e8fd93977" + } + Frame { + msec: 1584 + hash: "ab4cd0e103d71a35250668ad850a5213" + } + Frame { + msec: 1600 + hash: "aa974c4b2290f7febb121344623de86d" + } + Frame { + msec: 1616 + hash: "ff6ee1b50ca356dc98038a459e318b32" + } + Frame { + msec: 1632 + hash: "022fe9c391514fdd98bc1c38bc383df2" + } + Frame { + msec: 1648 + hash: "b1a33c9c9cbdcc1c8c9c982eef041ccd" + } + Frame { + msec: 1664 + hash: "0945e66ab5aa81beacf662eb82ec39ed" + } + Frame { + msec: 1680 + hash: "ae293f675dbdd88dec8f924140033cc9" + } + Frame { + msec: 1696 + hash: "5ace5013e3d51a8db338f65011dd10f8" + } + Frame { + msec: 1712 + hash: "9466a4e96d647f2bd8845697fce89399" + } + Frame { + msec: 1728 + hash: "73bbbfc57e020c6a0acbd5fdfa711c30" + } + Frame { + msec: 1744 + hash: "d71d7182107c3d6b004a57a321caee96" + } + Frame { + msec: 1760 + hash: "0902867c89e536cffcde69bde2eb1994" + } + Frame { + msec: 1776 + hash: "39fc26943f6077272c36e93b7cbf6994" + } + Frame { + msec: 1792 + hash: "92931d5a6e57fb9df60785a64d3a6f78" + } + Frame { + msec: 1808 + hash: "fffd632552f88f2979ef85de0ce585c2" + } + Frame { + msec: 1824 + hash: "9f97bfcffbb5d127c5eee852b30a13c4" + } + Frame { + msec: 1840 + hash: "ea9ee0293fbc45d3467e29c09e42adcd" + } + Frame { + msec: 1856 + hash: "b5b75c50f8fae3fb3b88efad536c911b" + } + Frame { + msec: 1872 + hash: "25dcd3fa30c057d1a42c19cee1ce444b" + } + Frame { + msec: 1888 + hash: "862d42abe7abd49d4a38e38a8c33a657" + } + Frame { + msec: 1904 + hash: "a335f3c8c797c1bb5537b57f952c19d1" + } + Frame { + msec: 1920 + image: "particles.1.png" + } + Frame { + msec: 1936 + hash: "da1cf98fdfe5acbe30cfbe66389aa240" + } + Frame { + msec: 1952 + hash: "088f3209c0363c06cf0607c58d00ca2d" + } + Frame { + msec: 1968 + hash: "47ba3bf2604b21f331a2e00f05926aaf" + } + Frame { + msec: 1984 + hash: "5ff0de383abdefad76380af144bd9d80" + } + Frame { + msec: 2000 + hash: "b972d1c85d3d8777f84b54dc118172fd" + } + Frame { + msec: 2016 + hash: "37581c3fbef2088b7d14b6c7bbf3cdc3" + } + Frame { + msec: 2032 + hash: "4ad6a06ac6de9dea66e9ce873a6618c1" + } + Frame { + msec: 2048 + hash: "3a0379ad966235044508c144ffbc336b" + } + Frame { + msec: 2064 + hash: "cb5a9510400943d77c9a296066f037e2" + } + Frame { + msec: 2080 + hash: "7bd5673a1d2ad8079df2569149e5811e" + } + Frame { + msec: 2096 + hash: "bd327ff6b8a4081b3a41cb0035403037" + } + Frame { + msec: 2112 + hash: "f0f9f559251f7648cd60e66ac745962d" + } + Frame { + msec: 2128 + hash: "18827630a859b0ce497f682e33558fae" + } + Frame { + msec: 2144 + hash: "e22d8110cbe34acddba799942872645d" + } + Frame { + msec: 2160 + hash: "11564e7221524cc3655c2c5f1d7e42b6" + } + Frame { + msec: 2176 + hash: "6468721ee38209aaf2c82a320bcd122e" + } + Frame { + msec: 2192 + hash: "19772d0f422fd206645ae6cf0be30b59" + } + Frame { + msec: 2208 + hash: "48b6c7e1317b9a66238c17afceb5121f" + } + Frame { + msec: 2224 + hash: "82a1af78709b78cce2d9b4eed7f8477c" + } + Frame { + msec: 2240 + hash: "36e2366eccbdd2d16c19829c34fbff87" + } + Frame { + msec: 2256 + hash: "271db39ca46c59ddc279fb41a9d191af" + } + Frame { + msec: 2272 + hash: "ee279a90e86aa89b1c3d745ab030180d" + } + Frame { + msec: 2288 + hash: "14e8c72d770644f4cec99e65aeff0d75" + } + Frame { + msec: 2304 + hash: "56fa1756eb11a30f07f8f31c22c99973" + } + Frame { + msec: 2320 + hash: "165af677ff3921f06b89b2c8d76a7924" + } + Frame { + msec: 2336 + hash: "d64aa248d9b207b87e5ba14bdabf2f6c" + } + Frame { + msec: 2352 + hash: "33e9716eb9ca62fe5c5cb1b1ee0e9e68" + } + Frame { + msec: 2368 + hash: "cff2316820c469b84c3bacabfcf1a551" + } + Frame { + msec: 2384 + hash: "9f1359c4bab95244602254ca3954e2b7" + } + Frame { + msec: 2400 + hash: "d6246d2aaea895755eab4c839c35ca9d" + } + Frame { + msec: 2416 + hash: "d446e1ac91fec10482b0c6d38ce86d17" + } + Frame { + msec: 2432 + hash: "99f443af76a9e0d2d03638bc9927fda3" + } + Frame { + msec: 2448 + hash: "a9169e293b8154947332d9754fd23af3" + } + Frame { + msec: 2464 + hash: "cc6851cc5864615c000fbc8d552eb593" + } + Frame { + msec: 2480 + hash: "58a3a6edb5842c88cb73b79a8a187717" + } + Frame { + msec: 2496 + hash: "42bcf77c98c9a80508446bd8c66e935b" + } + Frame { + msec: 2512 + hash: "0f99350ae151591fbda95158c046e072" + } + Frame { + msec: 2528 + hash: "9e817e2fd8377b7117f908c4e87d4d57" + } + Frame { + msec: 2544 + hash: "72c105bce75feeeb7a86f823945b4ff9" + } + Frame { + msec: 2560 + hash: "653b858445bdd8afdf8abd27f5e53fb8" + } + Frame { + msec: 2576 + hash: "18bf39154fbf4b42c4d3303e018a2f27" + } + Frame { + msec: 2592 + hash: "5ed5d52ab7da7ae77e97f3ace09b3b8d" + } + Frame { + msec: 2608 + hash: "1d382462e5746ee9b6df980364b1c96b" + } + Frame { + msec: 2624 + hash: "2a0a561f38c113a0f177b1c2b99ee5e1" + } + Frame { + msec: 2640 + hash: "0605d3e2dd9132d9c1d25b75a870d647" + } + Frame { + msec: 2656 + hash: "a1def1576f386c90bb80d46e254bd384" + } + Frame { + msec: 2672 + hash: "cf38d4ae577047048d2bd0a4005abfe2" + } + Frame { + msec: 2688 + hash: "d7cb6715cd89978bbca5ce4c93b488e5" + } + Frame { + msec: 2704 + hash: "9a5075ee794af14d4f17a52bdbc47f1e" + } + Frame { + msec: 2720 + hash: "fd3d803a1e5e9e3eeae7d5edcddd0072" + } + Frame { + msec: 2736 + hash: "445114e7d10581a475989e469323d83d" + } + Frame { + msec: 2752 + hash: "58328c1d4c0ee7fca78b684697f1922c" + } + Frame { + msec: 2768 + hash: "433df4d872b9565b43af5afce1b42e15" + } + Frame { + msec: 2784 + hash: "3b694f15722a087c2c9a860cad8bb6de" + } + Frame { + msec: 2800 + hash: "1986c8036bd548ca06a32aa98ab4fc83" + } + Frame { + msec: 2816 + hash: "7845dbb0e38145f54a9e4e0bfbd608db" + } + Frame { + msec: 2832 + hash: "caed393910ae7467c307a314bdf459ef" + } + Frame { + msec: 2848 + hash: "f3f6b41b7ed04dbc1693c169bdae3b13" + } + Frame { + msec: 2864 + hash: "b9a87d15d48f951b0a1d6962fb1d5995" + } + Frame { + msec: 2880 + image: "particles.2.png" + } + Frame { + msec: 2896 + hash: "954300274b6a5785e03a6cdae67238e9" + } + Frame { + msec: 2912 + hash: "5b7f51afad796107289369c7d3494843" + } + Frame { + msec: 2928 + hash: "41164f28cbb94528eda719d590d1cf75" + } + Frame { + msec: 2944 + hash: "5953d4c9a4b4c83ba1dfd83a57ec2742" + } + Frame { + msec: 2960 + hash: "0be7c6187a26b44f12bf71587372a6c7" + } + Frame { + msec: 2976 + hash: "a7cab1faf0cdd5649c8ea3c26d2e80d0" + } + Frame { + msec: 2992 + hash: "5f91bef1865623030aea20805993319a" + } + Frame { + msec: 3008 + hash: "69d34e2a27c471ad44f8aba8d906a961" + } + Frame { + msec: 3024 + hash: "5a987879aff30d6c6712c0631bc2f43d" + } + Frame { + msec: 3040 + hash: "62b9132c58cd5fdcfe7f1bc5e64885cf" + } + Frame { + msec: 3056 + hash: "d394ef9b504abf94c1d28a9fb7f3c28b" + } + Frame { + msec: 3072 + hash: "a559cc25af950227fa5fdf70be7fd94c" + } + Frame { + msec: 3088 + hash: "318dde40fc72c5f8ee45b865a68922b1" + } + Frame { + msec: 3104 + hash: "3cbfd55773e52f48f01fe66c28c0b992" + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml b/tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml new file mode 100644 index 0000000..8fb793f --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml @@ -0,0 +1,48 @@ +import Qt 4.6 + +Rectangle { + width: 640; height: 480; color: "black" + + Particles { id:particlesA + y:0; width: 260; height:30; source: "star.png"; + lifeSpan:1000; count: 50; angle:70; angleDeviation:36; + velocity:30; velocityDeviation:10; emissionRate: 10 + ParticleMotionWander { xvariance:30; pace:100 } + } + + Particles { id:particlesB + y:280; x:180; width:1; height:1; lifeSpan:1000; source: "star.png" + count: 100; angle:270; angleDeviation:45; velocity:50; velocityDeviation:30; + emissionRate: 0 + ParticleMotionGravity { yattractor: 1000; xattractor:0; acceleration:25 } + } + + Timer { running: true; interval: 1000; repeat: true; onTriggered: particlesB.burst(200, 2000); } + + Column{ + x: 340; + Repeater{ + model: 5 + delegate: Component{ + Item{ + width: 100; height: 100 + Rectangle{ + color: "blue" + width: 2; height: 2; + x: 49; y:49; + } + Particles{ + x: 50; y:50; width: 0; height: 0; + fadeInDuration: 0; fadeOutDuration: 0 + lifeSpan: 1000; lifeSpanDeviation:0; + source: "star.png" + count: -1; emissionRate: 120; + emissionVariance: index/2; + velocity: 250; velocityDeviation: 0; + angle: 0; angleDeviation: 0; + } + } + } + } + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/star.png b/tests/auto/declarative/visual/qmlgraphicsparticles/star.png Binary files differnew file mode 100644 index 0000000..defbde5 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicsparticles/star.png |