summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp26
-rw-r--r--tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp2
-rw-r--r--tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp102
-rw-r--r--tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp38
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp22
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp60
-rw-r--r--tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp13
-rw-r--r--tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp13
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp23
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp77
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp35
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp45
-rw-r--r--tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp35
13 files changed, 230 insertions, 261 deletions
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index 0f832bf..54ca761 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -69,10 +69,10 @@ void tst_QmlGraphicsLayouts::test_qml()
canvas->execute();
qApp->processEvents();
- QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("left"));
+ QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("left"));
QVERIFY(left != 0);
- QmlGraphicsLayoutItem *right = static_cast<QmlGraphicsLayoutItem*>(canvas->root()->findChild<QmlGraphicsItem*>("right"));
+ QmlGraphicsLayoutItem *right = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("right"));
QVERIFY(right != 0);
qreal l = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
@@ -81,9 +81,13 @@ void tst_QmlGraphicsLayouts::test_qml()
qreal b = QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin);
QVERIFY2(l == r && r == t && t == b, "Test assumes equal margins.");
qreal gvMargin = l;
+
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(canvas->rootObject());
+ QVERIFY(rootItem != 0);
+
//Preferred Size
- canvas->root()->setWidth(300 + 2*gvMargin);
- canvas->root()->setHeight(300 + 2*gvMargin);
+ rootItem->setWidth(300 + 2*gvMargin);
+ rootItem->setHeight(300 + 2*gvMargin);
QCOMPARE(left->x(), gvMargin);
QCOMPARE(left->y(), gvMargin);
@@ -96,8 +100,8 @@ void tst_QmlGraphicsLayouts::test_qml()
QCOMPARE(right->height(), 300.0);
//Minimum Size
- canvas->root()->setWidth(10+2*gvMargin);
- canvas->root()->setHeight(10+2*gvMargin);
+ rootItem->setWidth(10+2*gvMargin);
+ rootItem->setHeight(10+2*gvMargin);
QCOMPARE(left->x(), gvMargin);
QCOMPARE(left->width(), 100.0);
@@ -111,8 +115,8 @@ void tst_QmlGraphicsLayouts::test_qml()
/*Note that if set to maximum size (or above) GraphicsLinearLayout behavior
is to shrink them down to preferred size. So the exact maximum size can't
be used*/
- canvas->root()->setWidth(670 + 2*gvMargin);
- canvas->root()->setHeight(300 + 2*gvMargin);
+ rootItem->setWidth(670 + 2*gvMargin);
+ rootItem->setHeight(300 + 2*gvMargin);
QCOMPARE(left->x(), gvMargin);
QCOMPARE(left->width(), 270.0);
@@ -133,11 +137,7 @@ void tst_QmlGraphicsLayouts::test_cpp()
QmlView *tst_QmlGraphicsLayouts::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);
-
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString qml = file.readAll();
- canvas->setQml(qml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
index 92b0bf2..39d4326 100644
--- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
+++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
@@ -258,7 +258,7 @@ void tst_qmlanimations::badTypes()
//don't crash
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml"));
view->execute();
qApp->processEvents();
diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
index b8e54c0..1d2d12f 100644
--- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
+++ b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
@@ -58,7 +58,7 @@ public:
tst_qmlgraphicsanchors() {}
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &id);
+ T *findItem(QGraphicsObject *parent, const QString &id);
private slots:
void basicAnchors();
@@ -80,7 +80,7 @@ private slots:
Find an item with the specified id.
*/
template<typename T>
-T *tst_qmlgraphicsanchors::findItem(QmlGraphicsItem *parent, const QString &objectName)
+T *tst_qmlgraphicsanchors::findItem(QGraphicsObject *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
QList<QGraphicsItem *> children = parent->childItems();
@@ -102,66 +102,66 @@ T *tst_qmlgraphicsanchors::findItem(QmlGraphicsItem *parent, const QString &obje
void tst_qmlgraphicsanchors::basicAnchors()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml"));
view->execute();
qApp->processEvents();
//sibling horizontal
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect1"))->x(), 26.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect2"))->x(), 122.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect3"))->x(), 74.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect4"))->x(), 16.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect5"))->x(), 112.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect6"))->x(), 64.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect1"))->x(), 26.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect2"))->x(), 122.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect3"))->x(), 74.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect4"))->x(), 16.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect5"))->x(), 112.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect6"))->x(), 64.0);
//parent horizontal
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect7"))->x(), 0.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect8"))->x(), 240.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect9"))->x(), 120.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect10"))->x(), -10.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect11"))->x(), 230.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect12"))->x(), 110.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect7"))->x(), 0.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect8"))->x(), 240.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect9"))->x(), 120.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect10"))->x(), -10.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect11"))->x(), 230.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect12"))->x(), 110.0);
//vertical
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect13"))->y(), 20.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect14"))->y(), 155.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect13"))->y(), 20.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect14"))->y(), 155.0);
//stretch
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect15"))->x(), 26.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect15"))->width(), 96.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect16"))->x(), 26.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect16"))->width(), 192.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect17"))->x(), -70.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect17"))->width(), 192.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect15"))->x(), 26.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect15"))->width(), 96.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect16"))->x(), 26.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect16"))->width(), 192.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect17"))->x(), -70.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect17"))->width(), 192.0);
//vertical stretch
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect18"))->y(), 20.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect18"))->height(), 40.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect18"))->y(), 20.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect18"))->height(), 40.0);
//more parent horizontal
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect19"))->x(), 115.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect20"))->x(), 235.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect21"))->x(), -5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect19"))->x(), 115.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect20"))->x(), 235.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect21"))->x(), -5.0);
//centerIn
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect22"))->x(), 69.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect22"))->y(), 5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect22"))->x(), 69.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect22"))->y(), 5.0);
//margins
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->x(), 31.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->y(), 5.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->width(), 86.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->height(), 10.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->x(), 31.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->y(), 5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->width(), 86.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->height(), 10.0);
// offsets
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect24"))->x(), 26.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect25"))->y(), 60.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect26"))->y(), 5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect24"))->x(), 26.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect25"))->y(), 60.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect26"))->y(), 5.0);
//baseline
- QmlGraphicsText *text1 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text1"));
- QmlGraphicsText *text2 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text2"));
+ QmlGraphicsText *text1 = findItem<QmlGraphicsText>(view->rootObject(), QLatin1String("text1"));
+ QmlGraphicsText *text2 = findItem<QmlGraphicsText>(view->rootObject(), QLatin1String("text2"));
QCOMPARE(text1->y(), text2->y());
delete view;
@@ -173,9 +173,9 @@ void tst_qmlgraphicsanchors::loops()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml"));
- QString expect = "QML Text (" + view->url().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = "QML Text (" + view->source().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
@@ -188,9 +188,9 @@ void tst_qmlgraphicsanchors::loops()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml"));
- QString expect = "QML Image (" + view->url().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = "QML Image (" + view->source().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
qApp->processEvents();
@@ -372,9 +372,9 @@ void tst_qmlgraphicsanchors::crash1()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml"));
- QString expect = "QML Text (" + view->url().toString() + ":4:5" + ") Possible anchor loop detected on fill.";
+ QString expect = "QML Text (" + view->source().toString() + ":4:5" + ") Possible anchor loop detected on fill.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message
view->execute();
@@ -387,11 +387,11 @@ void tst_qmlgraphicsanchors::fill()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/fill.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/fill.qml"));
view->execute();
qApp->processEvents();
- QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("filler"));
+ QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler"));
QCOMPARE(rect->x(), 0.0 + 10.0);
QCOMPARE(rect->y(), 0.0 + 30.0);
QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0);
@@ -413,11 +413,11 @@ void tst_qmlgraphicsanchors::centerIn()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml"));
view->execute();
qApp->processEvents();
- QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("centered"));
+ QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("centered"));
QCOMPARE(rect->x(), 75.0 + 10);
QCOMPARE(rect->y(), 75.0 + 30);
//Alter Offsets (QTBUG-6631)
@@ -433,11 +433,11 @@ void tst_qmlgraphicsanchors::margins()
{
QmlView *view = new QmlView;
- view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
view->execute();
qApp->processEvents();
- QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("filler"));
+ QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler"));
QCOMPARE(rect->x(), 5.0);
QCOMPARE(rect->y(), 6.0);
QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0);
diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
index c157e62..b161b01 100644
--- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
+++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
@@ -70,9 +70,9 @@ private slots:
private:
QmlView *createView(const QString &filename);
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &id, int index=-1);
+ T *findItem(QGraphicsObject *parent, const QString &id, int index=-1);
template<typename T>
- QList<T*> findItems(QmlGraphicsItem *parent, const QString &objectName);
+ QList<T*> findItems(QGraphicsObject *parent, const QString &objectName);
void dumpTree(QmlGraphicsItem *parent, int depth = 0);
};
@@ -160,7 +160,7 @@ void tst_QmlGraphicsGridView::items()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -208,7 +208,7 @@ void tst_QmlGraphicsGridView::changed()
canvas->execute();
qApp->processEvents();
- QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->root(), "grid");
+ QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -241,7 +241,7 @@ void tst_QmlGraphicsGridView::inserted()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -322,7 +322,7 @@ void tst_QmlGraphicsGridView::removed()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -482,7 +482,7 @@ void tst_QmlGraphicsGridView::moved()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -578,15 +578,12 @@ void tst_QmlGraphicsGridView::currentIndex()
ctxt->setContextProperty("testModel", &model);
QString filename(SRCDIR "/data/gridview-initCurrent.qml");
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString qml = file.readAll();
- canvas->setQml(qml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -722,7 +719,7 @@ void tst_QmlGraphicsGridView::changeFlow()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -827,7 +824,7 @@ void tst_QmlGraphicsGridView::positionViewAtIndex()
canvas->execute();
qApp->processEvents();
- QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->root(), "grid");
+ QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
QVERIFY(gridview != 0);
QmlGraphicsItem *viewport = gridview->viewport();
@@ -907,10 +904,7 @@ 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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
@@ -920,10 +914,10 @@ QmlView *tst_QmlGraphicsGridView::createView(const QString &filename)
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QmlGraphicsGridView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index)
+T *tst_QmlGraphicsGridView::findItem(QGraphicsObject *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ //qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
if(!item)
@@ -950,11 +944,11 @@ T *tst_QmlGraphicsGridView::findItem(QmlGraphicsItem *parent, const QString &obj
}
template<typename T>
-QList<T*> tst_QmlGraphicsGridView::findItems(QmlGraphicsItem *parent, const QString &objectName)
+QList<T*> tst_QmlGraphicsGridView::findItems(QGraphicsObject *parent, const QString &objectName)
{
QList<T*> items;
const QMetaObject &mo = T::staticMetaObject;
- //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ //qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
if(!item)
diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
index 639f64c..dd0687c 100644
--- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
+++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
@@ -61,7 +61,7 @@ private slots:
private:
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &objectName);
+ T *findItem(QGraphicsObject *parent, const QString &objectName);
QmlEngine engine;
};
@@ -112,7 +112,7 @@ void tst_QmlGraphicsItem::keys()
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setUrl(QUrl::fromLocalFile(SRCDIR "/data/keys.qml"));
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml"));
KeysTestObject *testObject = new KeysTestObject;
canvas->rootContext()->setContextProperty("keysTestObject", testObject);
@@ -194,7 +194,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setUrl(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml"));
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml"));
canvas->execute();
canvas->show();
qApp->processEvents();
@@ -204,7 +204,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QFocusEvent fe(QEvent::FocusIn);
QApplication::sendEvent(canvas, &fe);
- QmlGraphicsItem *item = findItem<QmlGraphicsItem>(canvas->root(), "item1");
+ QmlGraphicsItem *item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item1");
QVERIFY(item);
QVERIFY(item->hasFocus());
@@ -213,7 +213,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
- item = findItem<QmlGraphicsItem>(canvas->root(), "item2");
+ item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item2");
QVERIFY(item);
QVERIFY(item->hasFocus());
@@ -222,7 +222,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
- item = findItem<QmlGraphicsItem>(canvas->root(), "item4");
+ item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item4");
QVERIFY(item);
QVERIFY(item->hasFocus());
@@ -231,7 +231,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
- item = findItem<QmlGraphicsItem>(canvas->root(), "item3");
+ item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item3");
QVERIFY(item);
QVERIFY(item->hasFocus());
@@ -240,7 +240,7 @@ void tst_QmlGraphicsItem::keyNavigation()
QApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
- item = findItem<QmlGraphicsItem>(canvas->root(), "item1");
+ item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item1");
QVERIFY(item);
QVERIFY(item->hasFocus());
}
@@ -292,15 +292,15 @@ void tst_QmlGraphicsItem::clip()
}
template<typename T>
-T *tst_QmlGraphicsItem::findItem(QmlGraphicsItem *parent, const QString &objectName)
+T *tst_QmlGraphicsItem::findItem(QGraphicsObject *parent, const QString &objectName)
{
if (!parent)
return 0;
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));
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
if(!item)
continue;
//qDebug() << "try" << item;
diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
index 6f97030..faa19eb 100644
--- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
+++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
@@ -90,9 +90,9 @@ private:
template <class T> void clear();
QmlView *createView(const QString &filename);
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &id, int index=-1);
+ T *findItem(QGraphicsObject *parent, const QString &id, int index=-1);
template<typename T>
- QList<T*> findItems(QmlGraphicsItem *parent, const QString &objectName);
+ QList<T*> findItems(QGraphicsObject *parent, const QString &objectName);
void dumpTree(QmlGraphicsItem *parent, int depth = 0);
};
@@ -316,13 +316,13 @@ void tst_QmlGraphicsListView::items()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
QVERIFY(viewport != 0);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QVERIFY(listview->highlightItem() != 0);
@@ -343,20 +343,20 @@ void tst_QmlGraphicsListView::items()
// switch to other delegate
testObject->setAnimate(true);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QVERIFY(listview->currentItem());
// set invalid highlight
testObject->setInvalidHighlight(true);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QVERIFY(listview->currentItem());
QVERIFY(listview->highlightItem() == 0);
// back to normal highlight
testObject->setInvalidHighlight(false);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QVERIFY(listview->currentItem());
QVERIFY(listview->highlightItem() != 0);
@@ -396,7 +396,7 @@ void tst_QmlGraphicsListView::changed()
canvas->execute();
qApp->processEvents();
- QmlGraphicsFlickable *listview = findItem<QmlGraphicsFlickable>(canvas->root(), "list");
+ QmlGraphicsFlickable *listview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -432,7 +432,7 @@ void tst_QmlGraphicsListView::inserted()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -501,6 +501,8 @@ void tst_QmlGraphicsListView::inserted()
QCOMPARE(item->y(), i*20.0 - 20.0);
}
+// QCOMPARE(listview->viewportHeight(), model.count() * 20.0);
+
delete canvas;
}
@@ -523,7 +525,7 @@ void tst_QmlGraphicsListView::removed(bool animated)
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -665,7 +667,7 @@ void tst_QmlGraphicsListView::clear()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -702,7 +704,7 @@ void tst_QmlGraphicsListView::moved()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -795,7 +797,7 @@ void tst_QmlGraphicsListView::enforceRange()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QCOMPARE(listview->preferredHighlightBegin(), 100.0);
@@ -843,7 +845,7 @@ void tst_QmlGraphicsListView::spacing()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -898,7 +900,7 @@ void tst_QmlGraphicsListView::sections()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -971,15 +973,12 @@ void tst_QmlGraphicsListView::currentIndex()
ctxt->setContextProperty("testWrap", QVariant(false));
QString filename(SRCDIR "/data/listview-initCurrent.qml");
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString qml = file.readAll();
- canvas->setQml(qml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -1061,13 +1060,13 @@ void tst_QmlGraphicsListView::itemList()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "view");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "view");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
QVERIFY(viewport != 0);
- QmlGraphicsVisualItemModel *model = canvas->root()->findChild<QmlGraphicsVisualItemModel*>("itemModel");
+ QmlGraphicsVisualItemModel *model = canvas->rootObject()->findChild<QmlGraphicsVisualItemModel*>("itemModel");
QVERIFY(model != 0);
QVERIFY(model->count() == 3);
@@ -1112,7 +1111,7 @@ void tst_QmlGraphicsListView::cacheBuffer()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -1164,7 +1163,7 @@ void tst_QmlGraphicsListView::positionViewAtIndex()
canvas->execute();
qApp->processEvents();
- QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->root(), "list");
+ QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
QVERIFY(listview != 0);
QmlGraphicsItem *viewport = listview->viewport();
@@ -1301,10 +1300,7 @@ QmlView *tst_QmlGraphicsListView::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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
@@ -1314,10 +1310,10 @@ QmlView *tst_QmlGraphicsListView::createView(const QString &filename)
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QmlGraphicsListView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index)
+T *tst_QmlGraphicsListView::findItem(QGraphicsObject *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ //qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
if(!item)
@@ -1342,11 +1338,11 @@ T *tst_QmlGraphicsListView::findItem(QmlGraphicsItem *parent, const QString &obj
}
template<typename T>
-QList<T*> tst_QmlGraphicsListView::findItems(QmlGraphicsItem *parent, const QString &objectName)
+QList<T*> tst_QmlGraphicsListView::findItems(QGraphicsObject *parent, const QString &objectName)
{
QList<T*> items;
const QMetaObject &mo = T::staticMetaObject;
- //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ //qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i));
if(!item)
diff --git a/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp b/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp
index 7ba076c..82da9c8 100644
--- a/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp
+++ b/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp
@@ -59,18 +59,18 @@ void tst_QmlGraphicsMouseRegion::dragProperties()
canvas->execute();
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsMouseRegion *mouseRegion = canvas->root()->findChild<QmlGraphicsMouseRegion*>("mouseregion");
+ QmlGraphicsMouseRegion *mouseRegion = canvas->rootObject()->findChild<QmlGraphicsMouseRegion*>("mouseregion");
QmlGraphicsDrag *drag = mouseRegion->drag();
QVERIFY(mouseRegion != 0);
QVERIFY(drag != 0);
// target
- QmlGraphicsItem *blackRect = canvas->root()->findChild<QmlGraphicsItem*>("blackrect");
+ QmlGraphicsItem *blackRect = canvas->rootObject()->findChild<QmlGraphicsItem*>("blackrect");
QVERIFY(blackRect != 0);
QVERIFY(blackRect == drag->target());
- QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(canvas->root());
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(canvas->rootObject());
QVERIFY(rootItem != 0);
QSignalSpy targetSpy(drag, SIGNAL(targetChanged()));
drag->setTarget(rootItem);
@@ -129,10 +129,7 @@ QmlView *tst_QmlGraphicsMouseRegion::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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
index 5458d68..5b75b32 100644
--- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
+++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
@@ -63,8 +63,8 @@ tst_QmlGraphicsParticles::tst_QmlGraphicsParticles()
void tst_QmlGraphicsParticles::properties()
{
QmlView *canvas = createView(SRCDIR "/data/particles.qml");
- QVERIFY(canvas->root());
- QmlGraphicsParticles* particles = canvas->root()->findChild<QmlGraphicsParticles*>("particles");
+ QVERIFY(canvas->rootObject());
+ QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles");
QVERIFY(particles);
particles->setSource(QUrl::fromLocalFile(SRCDIR "/data/particle.png"));
@@ -101,8 +101,8 @@ void tst_QmlGraphicsParticles::properties()
void tst_QmlGraphicsParticles::runs()
{
QmlView *canvas = createView(SRCDIR "/data/particles.qml");
- QVERIFY(canvas->root());
- QmlGraphicsParticles* particles = canvas->root()->findChild<QmlGraphicsParticles*>("particles");
+ QVERIFY(canvas->rootObject());
+ QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles");
QVERIFY(particles);
QTest::qWait(1000);//Run for one second. Test passes if it doesn't crash.
}
@@ -112,10 +112,7 @@ QmlView *tst_QmlGraphicsParticles::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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
canvas->execute();
return canvas;
diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
index 4c2ecbd..9f67962 100644
--- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
+++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
@@ -71,9 +71,9 @@ private slots:
private:
QmlView *createView(const QString &filename);
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &objectName, int index=-1);
+ T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1);
template<typename T>
- QList<T*> findItems(QmlGraphicsItem *parent, const QString &objectName);
+ QList<T*> findItems(QGraphicsObject *parent, const QString &objectName);
};
class TestObject : public QObject
@@ -204,7 +204,7 @@ void tst_QmlGraphicsPathView::items()
canvas->execute();
qApp->processEvents();
- QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->root(), "view");
+ QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view");
QVERIFY(pathview != 0);
QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible
@@ -326,10 +326,10 @@ void tst_QmlGraphicsPathView::dataModel()
canvas->execute();
qApp->processEvents();
- QmlGraphicsPathView *pathview = qobject_cast<QmlGraphicsPathView*>(canvas->root());
+ QmlGraphicsPathView *pathview = qobject_cast<QmlGraphicsPathView*>(canvas->rootObject());
QVERIFY(pathview != 0);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QmlGraphicsItem *item = findItem<QmlGraphicsItem>(pathview, "wrapper", 0);
@@ -352,7 +352,7 @@ void tst_QmlGraphicsPathView::dataModel()
QCOMPARE(text->text(), model.name(2));
testObject->setPathItemCount(5);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
itemCount = findItems<QmlGraphicsItem>(pathview, "wrapper").count();
@@ -398,7 +398,7 @@ void tst_QmlGraphicsPathView::pathMoved()
canvas->execute();
qApp->processEvents();
- QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->root(), "view");
+ QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view");
QVERIFY(pathview != 0);
QmlGraphicsRectangle *firstItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 0);
@@ -430,10 +430,7 @@ QmlView *tst_QmlGraphicsPathView::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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
@@ -443,7 +440,7 @@ QmlView *tst_QmlGraphicsPathView::createView(const QString &filename)
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QmlGraphicsPathView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index)
+T *tst_QmlGraphicsPathView::findItem(QGraphicsObject *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
//qDebug() << parent->childItems().count() << "children";
@@ -471,7 +468,7 @@ T *tst_QmlGraphicsPathView::findItem(QmlGraphicsItem *parent, const QString &obj
}
template<typename T>
-QList<T*> tst_QmlGraphicsPathView::findItems(QmlGraphicsItem *parent, const QString &objectName)
+QList<T*> tst_QmlGraphicsPathView::findItems(QGraphicsObject *parent, const QString &objectName)
{
QList<T*> items;
const QMetaObject &mo = T::staticMetaObject;
diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
index 42d6da9..924ce58 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
+++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
@@ -77,13 +77,13 @@ void tst_QmlGraphicsPositioners::test_horizontal()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -100,13 +100,13 @@ void tst_QmlGraphicsPositioners::test_horizontal_spacing()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -123,13 +123,13 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
//Note that they animate in
@@ -165,13 +165,13 @@ void tst_QmlGraphicsPositioners::test_vertical()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -188,13 +188,13 @@ void tst_QmlGraphicsPositioners::test_vertical_spacing()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -212,15 +212,15 @@ void tst_QmlGraphicsPositioners::test_vertical_animated()
canvas->execute();
//Note that they animate in
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->y(), -100.0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->y(), -100.0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->y(), -100.0);
@@ -253,15 +253,15 @@ void tst_QmlGraphicsPositioners::test_grid()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -282,15 +282,15 @@ void tst_QmlGraphicsPositioners::test_grid_spacing()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -311,27 +311,27 @@ void tst_QmlGraphicsPositioners::test_grid_animated()
canvas->execute();
//Note that all animate in
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QCOMPARE(one->x(), -100.0);
QCOMPARE(one->y(), -100.0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
QCOMPARE(two->x(), -100.0);
QCOMPARE(two->y(), -100.0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(three->x(), -100.0);
QCOMPARE(three->y(), -100.0);
- QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four");
+ QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four");
QVERIFY(four != 0);
QCOMPARE(four->x(), -100.0);
QCOMPARE(four->y(), -100.0);
- QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five");
+ QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five");
QVERIFY(five != 0);
QCOMPARE(five->x(), -100.0);
QCOMPARE(five->y(), -100.0);
@@ -385,13 +385,13 @@ void tst_QmlGraphicsPositioners::test_repeater()
canvas->execute();
- QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one");
+ QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
- QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two");
+ QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
QVERIFY(two != 0);
- QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three");
+ QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -406,10 +406,7 @@ QmlView *tst_QmlGraphicsPositioners::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
index ef0ca1d..b759ef5 100644
--- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
+++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
@@ -70,7 +70,7 @@ private slots:
private:
QmlView *createView(const QString &filename);
template<typename T>
- T *findItem(QmlGraphicsItem *parent, const QString &id);
+ T *findItem(QGraphicsObject *parent, const QString &id);
};
class TestObject : public QObject
@@ -174,11 +174,11 @@ void tst_QmlGraphicsRepeater::numberModel()
canvas->execute();
qApp->processEvents();
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->root(), "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
QVERIFY(repeater != 0);
QCOMPARE(repeater->parentItem()->childItems().count(), 5+1);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
delete canvas;
@@ -200,7 +200,7 @@ void tst_QmlGraphicsRepeater::objectList()
canvas->execute();
qApp->processEvents();
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->root(), "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
QVERIFY(repeater != 0);
QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data
QCOMPARE(repeater->property("instantiated").toInt(), 100);
@@ -227,10 +227,10 @@ void tst_QmlGraphicsRepeater::stringList()
canvas->execute();
qApp->processEvents();
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->root(), "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
QVERIFY(repeater != 0);
- QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->root(), "container");
+ QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container");
QVERIFY(container != 0);
QCOMPARE(container->childItems().count(), data.count() + 3);
@@ -280,10 +280,10 @@ void tst_QmlGraphicsRepeater::dataModel()
canvas->execute();
qApp->processEvents();
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->root(), "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
QVERIFY(repeater != 0);
- QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->root(), "container");
+ QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container");
QVERIFY(container != 0);
QCOMPARE(container->childItems().count(), 4);
@@ -305,16 +305,16 @@ void tst_QmlGraphicsRepeater::itemModel()
canvas->execute();
qApp->processEvents();
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->root(), "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
QVERIFY(repeater != 0);
- QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->root(), "container");
+ QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container");
QVERIFY(container != 0);
QCOMPARE(container->childItems().count(), 1);
testObject->setUseModel(true);
- QMetaObject::invokeMethod(canvas->root(), "checkProperties");
+ QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties");
QVERIFY(testObject->error() == false);
QCOMPARE(container->childItems().count(), 4);
@@ -331,10 +331,10 @@ void tst_QmlGraphicsRepeater::properties()
QmlEngine engine;
QmlComponent component(&engine, TEST_FILE("/properties.qml"));
- QmlGraphicsItem *root = qobject_cast<QmlGraphicsItem*>(component.create());
- QVERIFY(root);
+ QmlGraphicsItem *rootObject = qobject_cast<QmlGraphicsItem*>(component.create());
+ QVERIFY(rootObject);
- QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(root, "repeater");
+ QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(rootObject, "repeater");
QVERIFY(repeater);
QSignalSpy modelSpy(repeater, SIGNAL(modelChanged()));
@@ -359,16 +359,13 @@ QmlView *tst_QmlGraphicsRepeater::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);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
template<typename T>
-T *tst_QmlGraphicsRepeater::findItem(QmlGraphicsItem *parent, const QString &objectName)
+T *tst_QmlGraphicsRepeater::findItem(QGraphicsObject *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName))
diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
index a197ced..2b0131b 100644
--- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
+++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
@@ -608,8 +608,8 @@ void tst_qmlgraphicstextedit::inputMethodHints()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
- QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit *>(canvas->root());
+ QVERIFY(canvas->rootObject() != 0);
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit *>(canvas->rootObject());
QVERIFY(textEditObject != 0);
QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText);
textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly);
@@ -622,7 +622,7 @@ void tst_qmlgraphicstextedit::cursorDelegate()
view->execute();
view->show();
view->setFocus();
- QmlGraphicsTextEdit *textEditObject = view->root()->findChild<QmlGraphicsTextEdit*>("textEditObject");
+ QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject");
QVERIFY(textEditObject != 0);
QVERIFY(textEditObject->findChild<QmlGraphicsItem*>("cursorInstance"));
//Test Delegate gets created
@@ -650,40 +650,40 @@ void tst_qmlgraphicstextedit::delegateLoading()
server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay);
server.serveDirectory(SRCDIR "/data/http");
QmlView* view = new QmlView(0);
- view->setUrl(QUrl("http://localhost:42332/cursorHttpTestPass.qml"));
+ view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml"));
view->execute();
view->show();
view->setFocus();
- QTRY_VERIFY(view->root());//Wait for loading to finish.
- QmlGraphicsTextEdit *textEditObject = view->root()->findChild<QmlGraphicsTextEdit*>("textEditObject");
- // view->root()->dumpObjectTree();
+ QTRY_VERIFY(view->rootObject());//Wait for loading to finish.
+ QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject");
+ // view->rootObject()->dumpObjectTree();
QVERIFY(textEditObject != 0);
textEditObject->setFocus(true);
QmlGraphicsItem *delegate;
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateOkay");
QVERIFY(delegate);
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateSlow");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateSlow");
QVERIFY(delegate);
- view->setUrl(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
+ view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
view->execute();
view->show();
view->setFocus();
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateOkay");
QVERIFY(delegate);
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateFail");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateFail");
QVERIFY(!delegate);
- view->setUrl(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
+ view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
view->execute();
view->show();
view->setFocus();
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateOkay");
QVERIFY(delegate);
- delegate = view->root()->findChild<QmlGraphicsItem*>("delegateErrorA");
+ delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateErrorA");
QVERIFY(!delegate);
//ErrorB should get a component which is ready but component.create() returns null
//Not sure how to accomplish this with QmlGraphicsTextEdits cursor delegate
//###This could be a case of overzealous defensive programming
- //delegate = view->root()->findChild<QmlGraphicsItem*>("delegateErrorB");
+ //delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateErrorB");
//QVERIFY(!delegate);
}
@@ -698,9 +698,9 @@ void tst_qmlgraphicstextedit::navigation()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsItem *input = qobject_cast<QmlGraphicsItem *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+ QmlGraphicsItem *input = qobject_cast<QmlGraphicsItem *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
QTRY_VERIFY(input->hasFocus() == true);
@@ -721,9 +721,9 @@ void tst_qmlgraphicstextedit::readOnly()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsTextEdit *edit = qobject_cast<QmlGraphicsTextEdit *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+ QmlGraphicsTextEdit *edit = qobject_cast<QmlGraphicsTextEdit *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(edit != 0);
QTRY_VERIFY(edit->hasFocus() == true);
@@ -750,10 +750,7 @@ QmlView *tst_qmlgraphicstextedit::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
index b7ae4a2..d68964b 100644
--- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
+++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
@@ -352,8 +352,8 @@ void tst_qmlgraphicstextinput::maxLength()
canvas->execute();
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
- QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->root());
+ QVERIFY(canvas->rootObject() != 0);
+ QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject());
QVERIFY(textinputObject != 0);
QVERIFY(textinputObject->text().isEmpty());
QVERIFY(textinputObject->maxLength() == 10);
@@ -381,8 +381,8 @@ void tst_qmlgraphicstextinput::masks()
canvas->execute();
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
- QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->root());
+ QVERIFY(canvas->rootObject() != 0);
+ QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject());
QVERIFY(textinputObject != 0);
QTRY_VERIFY(textinputObject->hasFocus() == true);
QVERIFY(textinputObject->text().length() == 0);
@@ -407,9 +407,9 @@ void tst_qmlgraphicstextinput::validators()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsTextInput *intInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->root()->property("intInput")));
+ QmlGraphicsTextInput *intInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("intInput")));
QVERIFY(intInput);
intInput->setFocus(true);
QTRY_VERIFY(intInput->hasFocus());
@@ -430,7 +430,7 @@ void tst_qmlgraphicstextinput::validators()
QCOMPARE(intInput->text(), QLatin1String("11"));
QCOMPARE(intInput->hasAcceptableInput(), true);
- QmlGraphicsTextInput *dblInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->root()->property("dblInput")));
+ QmlGraphicsTextInput *dblInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("dblInput")));
QTRY_VERIFY(dblInput);
dblInput->setFocus(true);
QVERIFY(dblInput->hasFocus() == true);
@@ -459,7 +459,7 @@ void tst_qmlgraphicstextinput::validators()
QCOMPARE(dblInput->text(), QLatin1String("12.11"));
QCOMPARE(dblInput->hasAcceptableInput(), true);
- QmlGraphicsTextInput *strInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->root()->property("strInput")));
+ QmlGraphicsTextInput *strInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("strInput")));
QTRY_VERIFY(strInput);
strInput->setFocus(true);
QVERIFY(strInput->hasFocus() == true);
@@ -497,8 +497,8 @@ void tst_qmlgraphicstextinput::inputMethodHints()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
- QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->root());
+ QVERIFY(canvas->rootObject() != 0);
+ QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject());
QVERIFY(textinputObject != 0);
QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText);
textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly);
@@ -517,9 +517,9 @@ void tst_qmlgraphicstextinput::navigation()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+ QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
input->setCursorPosition(0);
@@ -549,7 +549,7 @@ void tst_qmlgraphicstextinput::cursorDelegate()
view->execute();
view->show();
view->setFocus();
- QmlGraphicsTextInput *textInputObject = view->root()->findChild<QmlGraphicsTextInput*>("textInputObject");
+ QmlGraphicsTextInput *textInputObject = view->rootObject()->findChild<QmlGraphicsTextInput*>("textInputObject");
QVERIFY(textInputObject != 0);
QVERIFY(textInputObject->findChild<QmlGraphicsItem*>("cursorInstance"));
//Test Delegate gets created
@@ -578,9 +578,9 @@ void tst_qmlgraphicstextinput::readOnly()
canvas->show();
canvas->setFocus();
- QVERIFY(canvas->root() != 0);
+ QVERIFY(canvas->rootObject() != 0);
- QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+ QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
QTRY_VERIFY(input->hasFocus() == true);
@@ -607,10 +607,7 @@ QmlView *tst_qmlgraphicstextinput::createView(const QString &filename)
{
QmlView *canvas = new QmlView(0);
- QFile file(filename);
- file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ canvas->setSource(QUrl::fromLocalFile(filename));
return canvas;
}