summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-09-09 05:49:57 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-09-09 05:49:57 (GMT)
commitd3bd0567fbc16263fcb181d58529e6d7aeee1bbd (patch)
tree5497595cb93f0cade5a8c13ad9cae0f5bbacacd9
parent539206ac11fc341db6e29ebdc3c838848f822bc5 (diff)
parenta5ed015bc369483206382689b77a4af0aaf0c547 (diff)
downloadQt-d3bd0567fbc16263fcb181d58529e6d7aeee1bbd.zip
Qt-d3bd0567fbc16263fcb181d58529e6d7aeee1bbd.tar.gz
Qt-d3bd0567fbc16263fcb181d58529e6d7aeee1bbd.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--src/declarative/fx/qfxflickable.cpp4
-rw-r--r--src/declarative/fx/qfxflipable.cpp4
-rw-r--r--src/declarative/fx/qfxitem.cpp4
-rw-r--r--src/declarative/fx/qfxitem.h4
-rw-r--r--src/declarative/fx/qfxtextinput.cpp6
-rw-r--r--tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp14
-rw-r--r--tests/auto/declarative/layouts/data/grid-spacing.qml20
-rw-r--r--tests/auto/declarative/layouts/data/grid.qml20
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-spacing.qml12
-rw-r--r--tests/auto/declarative/layouts/data/horizontal.qml12
-rw-r--r--tests/auto/declarative/layouts/data/vertical-spacing.qml12
-rw-r--r--tests/auto/declarative/layouts/data/vertical.qml12
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp76
-rw-r--r--tests/auto/declarative/listview/data/listview.qml4
-rw-r--r--tests/auto/declarative/listview/tst_listview.cpp28
-rw-r--r--tests/auto/declarative/numberformatter/tst_numberformatter.cpp15
-rw-r--r--tests/auto/declarative/pathview/data/pathview.qml10
-rw-r--r--tests/auto/declarative/pathview/tst_pathview.cpp8
-rw-r--r--tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp4
-rw-r--r--tests/auto/declarative/qfxtext/tst_qfxtext.cpp160
-rw-r--r--tests/auto/declarative/qfxtextedit/data/cursorTest.qml6
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp64
-rw-r--r--tests/auto/declarative/repeater/data/repeater.qml6
-rw-r--r--tests/auto/declarative/repeater/tst_repeater.cpp22
24 files changed, 263 insertions, 264 deletions
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index 5fe9617..c227899 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -853,7 +853,7 @@ void QFxFlickablePrivate::data_append(QObject *o)
Q_Q(QFxFlickable);
QFxItem *i = qobject_cast<QFxItem *>(o);
if (i)
- viewport->children()->append(i);
+ viewport->fxChildren()->append(i);
else
o->setParent(q);
}
@@ -884,7 +884,7 @@ QmlList<QObject *> *QFxFlickable::flickableData()
QmlList<QFxItem *> *QFxFlickable::flickableChildren()
{
Q_D(QFxFlickable);
- return d->viewport->children();
+ return d->viewport->fxChildren();
}
/*!
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index 8e56e43..dc5101c 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -146,7 +146,7 @@ void QFxFlipable::setFront(QFxItem *front)
return;
}
d->front = front;
- children()->append(d->front);
+ fxChildren()->append(d->front);
if (Back == d->current)
d->front->setOpacity(0.);
}
@@ -165,7 +165,7 @@ void QFxFlipable::setBack(QFxItem *back)
return;
}
d->back = back;
- children()->append(d->back);
+ fxChildren()->append(d->back);
if (Front == d->current)
d->back->setOpacity(0.);
}
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 3429010..a2c744e 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -1473,7 +1473,7 @@ void QFxItemPrivate::data_append(QObject *o)
Q_Q(QFxItem);
QFxItem *i = qobject_cast<QFxItem *>(o);
if (i)
- q->children()->append(i);
+ q->fxChildren()->append(i);
else
resources_append(o);
}
@@ -2271,7 +2271,7 @@ void QFxItem::focusChanged(bool flag)
emit focusChanged();
}
-QmlList<QFxItem *> *QFxItem::children()
+QmlList<QFxItem *> *QFxItem::fxChildren()
{
Q_D(QFxItem);
return &(d->children);
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 643987d..c6a5311 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -70,7 +70,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(QFxItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
Q_PROPERTY(QmlList<QObject *> *data READ data DESIGNABLE false)
- Q_PROPERTY(QmlList<QFxItem *>* children READ children DESIGNABLE false)
+ Q_PROPERTY(QmlList<QFxItem *>* children READ fxChildren DESIGNABLE false)
Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false)
Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
@@ -112,7 +112,7 @@ public:
void setParent(QFxItem *parent) { setParentItem(parent); }
QmlList<QObject *> *data();
- QmlList<QFxItem *> *children();
+ QmlList<QFxItem *> *fxChildren();
QmlList<QObject *> *resources();
QFxAnchors *anchors();
diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp
index 39a0187..6bd793b 100644
--- a/src/declarative/fx/qfxtextinput.cpp
+++ b/src/declarative/fx/qfxtextinput.cpp
@@ -483,11 +483,11 @@ void QFxTextInput::keyPressEvent(QKeyEvent* ev)
if((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
|| (d->control->cursor() == d->control->text().length()
&& ev->key() == Qt::Key_Right)){
- //ignore moving off the end
+ //ignore when moving off the end
ev->ignore();
- return;
+ }else{
+ d->control->processKeyEvent(ev);
}
- d->control->processKeyEvent(ev);
if (!ev->isAccepted())
QFxPaintedItem::keyPressEvent(ev);
}
diff --git a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp
index 67cff02..556912e 100644
--- a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp
+++ b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp
@@ -2,6 +2,7 @@
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmldatetimeformatter.h>
+#include <QDebug>
class tst_datetimeformatter : public QObject
{
@@ -18,8 +19,11 @@ private slots:
void tst_datetimeformatter::date()
{
QmlEngine engine;
- QmlComponent formatterComponent(&engine, "DateTimeFormatter { date: \"2008-12-24\" }");
+ QmlComponent formatterComponent(&engine, QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"),
+ QUrl("file://"));
QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create());
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
QVERIFY(formatter != 0);
QDate date(2008,12,24);
@@ -38,8 +42,10 @@ void tst_datetimeformatter::date()
void tst_datetimeformatter::time()
{
QmlEngine engine;
- QmlComponent formatterComponent(&engine, "DateTimeFormatter { time: \"14:15:38.200\" }");
+ QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl("file://"));
QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create());
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
QVERIFY(formatter != 0);
QTime time(14,15,38,200);
@@ -64,8 +70,10 @@ void tst_datetimeformatter::time()
void tst_datetimeformatter::dateTime()
{
QmlEngine engine;
- QmlComponent formatterComponent(&engine, "DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }");
+ QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl("file://"));
QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create());
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
QVERIFY(formatter != 0);
QDateTime dateTime(QDate(1978,03,04),QTime(9,13,54));
diff --git a/tests/auto/declarative/layouts/data/grid-spacing.qml b/tests/auto/declarative/layouts/data/grid-spacing.qml
index f9ae204..5b4a30d 100644
--- a/tests/auto/declarative/layouts/data/grid-spacing.qml
+++ b/tests/auto/declarative/layouts/data/grid-spacing.qml
@@ -6,32 +6,32 @@ Item {
Grid {
columns: 3
spacing: 4
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "green"
width: 20
height: 50
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "blue"
width: 50
height: 20
}
- Rect {
- id: four
+ Rectangle {
+ objectName: "four"
color: "cyan"
width: 50
height: 50
}
- Rect {
- id: five
+ Rectangle {
+ objectName: "five"
color: "magenta"
width: 10
height: 10
diff --git a/tests/auto/declarative/layouts/data/grid.qml b/tests/auto/declarative/layouts/data/grid.qml
index 3861f63..830df6a 100644
--- a/tests/auto/declarative/layouts/data/grid.qml
+++ b/tests/auto/declarative/layouts/data/grid.qml
@@ -5,32 +5,32 @@ Item {
height: 480
Grid {
columns: 3
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "green"
width: 20
height: 50
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "blue"
width: 50
height: 20
}
- Rect {
- id: four
+ Rectangle {
+ objectName: "four"
color: "cyan"
width: 50
height: 50
}
- Rect {
- id: five
+ Rectangle {
+ objectName: "five"
color: "magenta"
width: 10
height: 10
diff --git a/tests/auto/declarative/layouts/data/horizontal-spacing.qml b/tests/auto/declarative/layouts/data/horizontal-spacing.qml
index 8594ee6..32bf775 100644
--- a/tests/auto/declarative/layouts/data/horizontal-spacing.qml
+++ b/tests/auto/declarative/layouts/data/horizontal-spacing.qml
@@ -5,20 +5,20 @@ Item {
height: 480
Row {
spacing: 10
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "red"
width: 20
height: 10
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "red"
width: 40
height: 20
diff --git a/tests/auto/declarative/layouts/data/horizontal.qml b/tests/auto/declarative/layouts/data/horizontal.qml
index 673e77e..06ae151 100644
--- a/tests/auto/declarative/layouts/data/horizontal.qml
+++ b/tests/auto/declarative/layouts/data/horizontal.qml
@@ -4,20 +4,20 @@ Item {
width: 640
height: 480
Row {
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "red"
width: 20
height: 10
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "red"
width: 40
height: 20
diff --git a/tests/auto/declarative/layouts/data/vertical-spacing.qml b/tests/auto/declarative/layouts/data/vertical-spacing.qml
index 49bd8c6..69a8256 100644
--- a/tests/auto/declarative/layouts/data/vertical-spacing.qml
+++ b/tests/auto/declarative/layouts/data/vertical-spacing.qml
@@ -5,20 +5,20 @@ Item {
height: 480
Column {
spacing: 10
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "red"
width: 20
height: 10
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "red"
width: 40
height: 20
diff --git a/tests/auto/declarative/layouts/data/vertical.qml b/tests/auto/declarative/layouts/data/vertical.qml
index c8d3a11..856c180 100644
--- a/tests/auto/declarative/layouts/data/vertical.qml
+++ b/tests/auto/declarative/layouts/data/vertical.qml
@@ -4,20 +4,20 @@ Item {
width: 640
height: 480
Column {
- Rect {
- id: one
+ Rectangle {
+ objectName: "one"
color: "red"
width: 50
height: 50
}
- Rect {
- id: two
+ Rectangle {
+ objectName: "two"
color: "red"
width: 20
height: 10
}
- Rect {
- id: three
+ Rectangle {
+ objectName: "three"
color: "red"
width: 40
height: 20
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index cd4678e..3416b2e 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -20,8 +20,6 @@ private slots:
private:
QFxView *createView(const QString &filename);
- template<typename T>
- T *findItem(QFxItem *parent, const QString &id, int index=-1);
};
tst_QFxLayouts::tst_QFxLayouts()
@@ -35,13 +33,13 @@ void tst_QFxLayouts::test_horizontal()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -59,13 +57,13 @@ void tst_QFxLayouts::test_horizontal_spacing()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -83,13 +81,13 @@ void tst_QFxLayouts::test_vertical()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -107,13 +105,13 @@ void tst_QFxLayouts::test_vertical_spacing()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
QCOMPARE(one->x(), 0.0);
@@ -131,15 +129,15 @@ void tst_QFxLayouts::test_grid()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
- QFxRect *four = findItem<QFxRect>(canvas->root(), "four");
+ QFxRect *four = canvas->root()->findChild<QFxRect*>("four");
QVERIFY(four != 0);
- QFxRect *five = findItem<QFxRect>(canvas->root(), "five");
+ QFxRect *five = canvas->root()->findChild<QFxRect*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -161,15 +159,15 @@ void tst_QFxLayouts::test_grid_spacing()
canvas->execute();
qApp->processEvents();
- QFxRect *one = findItem<QFxRect>(canvas->root(), "one");
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
QVERIFY(one != 0);
- QFxRect *two = findItem<QFxRect>(canvas->root(), "two");
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
QVERIFY(two != 0);
- QFxRect *three = findItem<QFxRect>(canvas->root(), "three");
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
QVERIFY(three != 0);
- QFxRect *four = findItem<QFxRect>(canvas->root(), "four");
+ QFxRect *four = canvas->root()->findChild<QFxRect*>("four");
QVERIFY(four != 0);
- QFxRect *five = findItem<QFxRect>(canvas->root(), "five");
+ QFxRect *five = canvas->root()->findChild<QFxRect*>("five");
QVERIFY(five != 0);
QCOMPARE(one->x(), 0.0);
@@ -196,36 +194,6 @@ QFxView *tst_QFxLayouts::createView(const QString &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_QFxLayouts::findItem(QFxItem *parent, const QString &objectName, int index)
-{
- const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
- QFxItem *item = qobject_cast<QFxItem*>(parent->QGraphicsObject::children().at(i));
- if(!item)
- continue;
- //qDebug() << item << item->objectName();
- 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;
-}
QTEST_MAIN(tst_QFxLayouts)
diff --git a/tests/auto/declarative/listview/data/listview.qml b/tests/auto/declarative/listview/data/listview.qml
index 7a3d76f..1a241eb 100644
--- a/tests/auto/declarative/listview/data/listview.qml
+++ b/tests/auto/declarative/listview/data/listview.qml
@@ -9,6 +9,7 @@ Rectangle {
id: Delegate
Item {
id: wrapper
+ objectName: "wrapper"
height: 20
width: 240
Text {
@@ -17,11 +18,13 @@ Rectangle {
Text {
x: 30
id: textName
+ objectName: "textName"
text: name
}
Text {
x: 120
id: textNumber
+ objectName: "textNumber"
text: number
}
Text {
@@ -33,6 +36,7 @@ Rectangle {
]
ListView {
id: list
+ objectName: "list"
width: 240
height: 320
model: testModel
diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp
index 8bf9c8a..ebc3053 100644
--- a/tests/auto/declarative/listview/tst_listview.cpp
+++ b/tests/auto/declarative/listview/tst_listview.cpp
@@ -188,7 +188,7 @@ void tst_QFxListView::items()
QFxItem *viewport = listview->viewport();
QVERIFY(viewport != 0);
- QCOMPARE(viewport->children()->count(), model.count()); // assumes all are visible
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
for (int i = 0; i < model.count(); ++i) {
QFxText *name = findItem<QFxText>(viewport, "textName", i);
@@ -262,7 +262,7 @@ void tst_QFxListView::inserted()
// let transitions settle.
QTest::qWait(1000);
- QCOMPARE(viewport->children()->count(), model.count()); // assumes all are visible
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
QFxText *name = findItem<QFxText>(viewport, "textName", 1);
QVERIFY(name != 0);
@@ -282,7 +282,7 @@ void tst_QFxListView::inserted()
// let transitions settle.
QTest::qWait(1000);
- QCOMPARE(viewport->children()->count(), model.count()); // assumes all are visible
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
name = findItem<QFxText>(viewport, "textName", 0);
QVERIFY(name != 0);
@@ -336,7 +336,7 @@ void tst_QFxListView::removed()
QCOMPARE(number->text(), model.number(1));
// Confirm items positioned correctly
- for (int i = 0; i < model.count() && i < viewport->children()->count(); ++i) {
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
QVERIFY(item->y() == i*20);
}
@@ -355,7 +355,7 @@ void tst_QFxListView::removed()
QCOMPARE(number->text(), model.number(0));
// Confirm items positioned correctly
- for (int i = 0; i < model.count() && i < viewport->children()->count(); ++i) {
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
QCOMPARE(item->y(),i*20.0 + 20.0);
}
@@ -366,13 +366,13 @@ void tst_QFxListView::removed()
QTest::qWait(1000);
// Confirm items positioned correctly
- for (int i = 0; i < model.count() && i < viewport->children()->count(); ++i) {
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
QCOMPARE(item->y(),i*20.0+20.0);
}
// Remove items before visible
- listview->setYPosition(80);
+ listview->setViewportY(80);
listview->setCurrentIndex(10);
model.removeItem(1); // post: top item will be at 40
@@ -385,12 +385,12 @@ void tst_QFxListView::removed()
QCOMPARE(item->y(),40+i*20.0);
}
- listview->setYPosition(40); // That's the top now
+ listview->setViewportY(40); // That's the top now
// let transitions settle.
QTest::qWait(1000);
// Confirm items positioned correctly
- for (int i = 0; i < model.count() && i < viewport->children()->count(); ++i) {
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
QCOMPARE(item->y(),40+i*20.0);
}
@@ -459,10 +459,12 @@ template<typename T>
T *tst_QFxListView::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- qDebug() << parent->children()->count() << "children";
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = parent->children()->at(i);
- qDebug() << "try" << item;
+ //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(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);
diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
index 9a2f4f3..78ec347 100644
--- a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
+++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
@@ -166,11 +166,15 @@ void tst_numberformat::number()
QFETCH(QString, string);
QFETCH(float, number);
- QString componentStr = QString("NumberFormatter { number: \"") + string + QString("\" }");
+ QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\" }");
QmlEngine engine;
- QmlComponent formatterComponent(&engine, componentStr.toAscii());
+ QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://"));
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatterComponent.isReady());
QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create());
+ QVERIFY(formatterComponent.isReady());
QVERIFY(formatter != 0);
QCOMPARE((float)formatter->number(), number);
//qDebug() << formatter->format() << formatter->text();
@@ -201,10 +205,13 @@ void tst_numberformat::text()
QFETCH(QString, format);
QFETCH(QString, text);
- QString componentStr = QString("NumberFormatter { number: \"") + string + QString("\"; format: \"") + format + QString("\" }");
+ QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\"; format: \"") + format + QString("\" }");
QmlEngine engine;
- QmlComponent formatterComponent(&engine, componentStr.toAscii());
+ QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://"));
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatterComponent.isReady());
QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create());
QVERIFY(formatter != 0);
diff --git a/tests/auto/declarative/pathview/data/pathview.qml b/tests/auto/declarative/pathview/data/pathview.qml
index 7040e4c..be5673c 100644
--- a/tests/auto/declarative/pathview/data/pathview.qml
+++ b/tests/auto/declarative/pathview/data/pathview.qml
@@ -1,14 +1,15 @@
import Qt 4.6
-Rect {
+Rectangle {
width: 240
height: 320
color: "#ffffff"
resources: [
Component {
id: Delegate
- Rect {
+ Rectangle {
id: wrapper
+ objectName: "wrapper"
height: 20
width: 60
color: "white"
@@ -19,11 +20,13 @@ Rect {
Text {
x: 20
id: textName
+ objectName: "textName"
text: name
}
Text {
x: 40
id: textNumber
+ objectName: "textNumber"
text: number
}
}
@@ -31,11 +34,12 @@ Rect {
]
PathView {
id: view
+ objectName: "view"
width: 240
height: 320
model: testModel
delegate: Delegate
- snapPos: 0.01
+ snapPosition: 0.01
path: Path {
startY: 120
startX: 160
diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp
index 9cae961..2933323 100644
--- a/tests/auto/declarative/pathview/tst_pathview.cpp
+++ b/tests/auto/declarative/pathview/tst_pathview.cpp
@@ -117,7 +117,7 @@ void tst_QFxPathView::items()
QFxPathView *pathview = findItem<QFxPathView>(canvas->root(), "view");
QVERIFY(pathview != 0);
- QCOMPARE(pathview->children()->count(), model.count()); // assumes all are visible
+ QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible
for (int i = 0; i < model.count(); ++i) {
QFxText *name = findItem<QFxText>(pathview, "textName", i);
@@ -234,8 +234,10 @@ template<typename T>
T *tst_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = parent->children()->at(i);
+ for (int i = 0; i < parent->children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->children().at(i));
+ if(!item)
+ continue;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
diff --git a/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
index a8046e6..c9c37ab 100644
--- a/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
+++ b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
@@ -59,7 +59,9 @@ void tst_QBindableMap::changed()
QmlEngine engine;
QmlContext *ctxt = engine.rootContext();
ctxt->setContextProperty(QLatin1String("data"), &map);
- QmlComponent component(&engine, "Script { script: \"data.key1 = 'Hello World';\" }");
+ QmlComponent component(&engine, "import Qt 4.6\nScript { script: \"data.key1 = 'Hello World';\" }",
+ QUrl("file://"));
+ QVERIFY(component.isReady());
component.create();
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
diff --git a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
index 0eb9f97..cae85a4 100644
--- a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
+++ b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
@@ -19,8 +19,8 @@ private slots:
void elide();
// ### these tests may be trivial
- void hAlign();
- void vAlign();
+ void horizontalAlignment();
+ void verticalAlignment();
void font();
void style();
void color();
@@ -29,11 +29,11 @@ private:
QStringList standard;
QStringList richText;
- QStringList hAlignmentStrings;
- QStringList vAlignmentStrings;
+ QStringList horizontalAlignmentmentStrings;
+ QStringList verticalAlignmentmentStrings;
- QList<Qt::Alignment> vAlignments;
- QList<Qt::Alignment> hAlignments;
+ QList<Qt::Alignment> verticalAlignmentments;
+ QList<Qt::Alignment> horizontalAlignmentments;
QStringList styleStrings;
QList<QFxText::TextStyle> styles;
@@ -51,19 +51,19 @@ tst_qfxtext::tst_qfxtext()
richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>"
<< "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>";
- hAlignmentStrings << "AlignLeft"
+ horizontalAlignmentmentStrings << "AlignLeft"
<< "AlignRight"
<< "AlignHCenter";
- vAlignmentStrings << "AlignTop"
+ verticalAlignmentmentStrings << "AlignTop"
<< "AlignBottom"
<< "AlignVCenter";
- hAlignments << Qt::AlignLeft
+ horizontalAlignmentments << Qt::AlignLeft
<< Qt::AlignRight
<< Qt::AlignHCenter;
- vAlignments << Qt::AlignTop
+ verticalAlignmentments << Qt::AlignTop
<< Qt::AlignBottom
<< Qt::AlignVCenter;
@@ -99,7 +99,7 @@ tst_qfxtext::tst_qfxtext()
void tst_qfxtext::text()
{
{
- QmlComponent textComponent(&engine, "Text { text: \"\" }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -108,8 +108,8 @@ void tst_qfxtext::text()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -118,8 +118,8 @@ void tst_qfxtext::text()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -132,7 +132,7 @@ void tst_qfxtext::width()
{
// uses Font metrics to find the width for standard and document to find the width for rich
{
- QmlComponent textComponent(&engine, "Text { text: \"\" }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 0.);
@@ -144,8 +144,8 @@ void tst_qfxtext::width()
QFontMetrics fm(f);
int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- QString componentStr = "Text { text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), qreal(metricWidth));
@@ -159,8 +159,8 @@ void tst_qfxtext::width()
int documentWidth = document.idealWidth();
- QString componentStr = "Text { text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), qreal(documentWidth));
@@ -173,7 +173,7 @@ void tst_qfxtext::wrap()
// for specified width and wrap set true
{
- QmlComponent textComponent(&engine, "Text { text: \"\"; wrap: true; width: 300 }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\"; wrap: true; width: 300 }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -181,8 +181,8 @@ void tst_qfxtext::wrap()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -190,8 +190,8 @@ void tst_qfxtext::wrap()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -208,7 +208,7 @@ void tst_qfxtext::elide()
// XXX Poor coverage.
{
- QmlComponent textComponent(&engine, ("Text { text: \"\"; "+elide+" width: 300 }").toLatin1());
+ QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 300 }").toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -216,8 +216,8 @@ void tst_qfxtext::elide()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -226,8 +226,8 @@ void tst_qfxtext::elide()
// richtext - does nothing
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -236,61 +236,61 @@ void tst_qfxtext::elide()
}
//the alignment tests may be trivial o.oa
-void tst_qfxtext::hAlign()
+void tst_qfxtext::horizontalAlignment()
{
//test one align each, and then test if two align fails.
for (int i = 0; i < standard.size(); i++)
{
- for (int j=0; j < hAlignmentStrings.size(); j++)
+ for (int j=0; j < horizontalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->hAlign(), (int)hAlignments.at(j));
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
}
}
for (int i = 0; i < richText.size(); i++)
{
- for (int j=0; j < hAlignmentStrings.size(); j++)
+ for (int j=0; j < horizontalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->hAlign(), (int)hAlignments.at(j));
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
}
}
}
-void tst_qfxtext::vAlign()
+void tst_qfxtext::verticalAlignment()
{
//test one align each, and then test if two align fails.
for (int i = 0; i < standard.size(); i++)
{
- for (int j=0; j < vAlignmentStrings.size(); j++)
+ for (int j=0; j < verticalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->vAlign(), (int)vAlignments.at(j));
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
for (int i = 0; i < richText.size(); i++)
{
- for (int j=0; j < vAlignmentStrings.size(); j++)
+ for (int j=0; j < verticalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->vAlign(), (int)vAlignments.at(j));
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -300,49 +300,49 @@ void tst_qfxtext::font()
{
//test size, then bold, then italic, then family
{
- QString componentStr = "Text { font.size: 40; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->size(), qreal(40));
- QCOMPARE(textObject->font()->bold(), false);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().pointSize(), 40);
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.bold: true; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->bold(), true);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().bold(), true);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.italic: true; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->italic(), true);
- QCOMPARE(textObject->font()->bold(), false);
+ QCOMPARE(textObject->font().italic(), true);
+ QCOMPARE(textObject->font().bold(), false);
}
-
+
{
- QString componentStr = "Text { font.family: \"Helvetica\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->family(), QString("Helvetica"));
- QCOMPARE(textObject->font()->bold(), false);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.family: \"\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->family(), QString(""));
+ QCOMPARE(textObject->font().family(), QString(""));
}
}
@@ -351,8 +351,8 @@ void tst_qfxtext::style()
//test style
for (int i = 0; i < styles.size(); i++)
{
- QString componentStr = "Text { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE((int)textObject->style(), (int)styles.at(i));
@@ -365,8 +365,8 @@ void tst_qfxtext::color()
//test style
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "Text { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
@@ -375,8 +375,8 @@ void tst_qfxtext::color()
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "Text { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i)));
@@ -388,8 +388,8 @@ void tst_qfxtext::color()
{
for (int j = 0; j < colorStrings.size(); j++)
{
- QString componentStr = "Text { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
@@ -401,8 +401,8 @@ void tst_qfxtext::color()
QColor testColor("#001234");
testColor.setAlpha(170);
- QString componentStr = "Text { color: \"" + colorStr + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), testColor);
diff --git a/tests/auto/declarative/qfxtextedit/data/cursorTest.qml b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
index 25e53d0..e5df8f1 100644
--- a/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
+++ b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
@@ -1,8 +1,8 @@
import Qt 4.6
-Rect { width: 300; height: 300; color: "white"
- TextEdit { text: "Hello world!"; focusable: true; id: textEditObject
- resources: [ Component { id:cursor; Item { id:cursorInstance } } ]
+Rectangle { width: 300; height: 300; color: "white"
+ TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject"
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance" } } ]
cursorDelegate: cursor
}
}
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
index 241dbad..c4fc506 100644
--- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
+++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
@@ -89,7 +89,7 @@ tst_qfxtextedit::tst_qfxtextedit()
void tst_qfxtextedit::text()
{
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\" }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -98,7 +98,7 @@ void tst_qfxtextedit::text()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "TextEdit { text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -108,7 +108,7 @@ void tst_qfxtextedit::text()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "TextEdit { text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -126,7 +126,7 @@ void tst_qfxtextedit::width()
{
// uses Font metrics to find the width for standard and document to find the width for rich
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\" }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -139,7 +139,7 @@ void tst_qfxtextedit::width()
QFontMetrics fm(f);
int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- QString componentStr = "TextEdit { text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -155,7 +155,7 @@ void tst_qfxtextedit::width()
int documentWidth = document.idealWidth();
- QString componentStr = "TextEdit { text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -168,7 +168,7 @@ void tst_qfxtextedit::wrap()
{
// for specified width and wrap set true
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\"; wrap: true; width: 300 }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -177,7 +177,7 @@ void tst_qfxtextedit::wrap()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "TextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -187,7 +187,7 @@ void tst_qfxtextedit::wrap()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "TextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -206,7 +206,7 @@ void tst_qfxtextedit::hAlign()
{
for (int j=0; j < hAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -219,7 +219,7 @@ void tst_qfxtextedit::hAlign()
{
for (int j=0; j < hAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -238,7 +238,7 @@ void tst_qfxtextedit::vAlign()
{
for (int j=0; j < vAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -251,7 +251,7 @@ void tst_qfxtextedit::vAlign()
{
for (int j=0; j < vAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -266,54 +266,54 @@ void tst_qfxtextedit::font()
{
//test size, then bold, then italic, then family
{
- QString componentStr = "TextEdit { font.size: 40; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->size(), qreal(40));
- QCOMPARE(textEditObject->font()->bold(), false);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().pointSize(), 40);
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.bold: true; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->bold(), true);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().bold(), true);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.italic: true; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->italic(), true);
- QCOMPARE(textEditObject->font()->bold(), false);
+ QCOMPARE(textEditObject->font().italic(), true);
+ QCOMPARE(textEditObject->font().bold(), false);
}
{
- QString componentStr = "TextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->family(), QString("Helvetica"));
- QCOMPARE(textEditObject->font()->bold(), false);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.family: \"\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->family(), QString(""));
+ QCOMPARE(textEditObject->font().family(), QString(""));
}
}
@@ -322,7 +322,7 @@ void tst_qfxtextedit::color()
//test style
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "TextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
//qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i));
@@ -335,7 +335,7 @@ void tst_qfxtextedit::color()
QColor testColor("#001234");
testColor.setAlpha(170);
- QString componentStr = "TextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -347,7 +347,7 @@ void tst_qfxtextedit::color()
void tst_qfxtextedit::selection()
{
QString testStr = standard[0];//TODO: What should happen for multiline/rich text?
- QString componentStr = "TextEdit { text: \""+ testStr +"\"; }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
diff --git a/tests/auto/declarative/repeater/data/repeater.qml b/tests/auto/declarative/repeater/data/repeater.qml
index 57b1183..57ba9dc 100644
--- a/tests/auto/declarative/repeater/data/repeater.qml
+++ b/tests/auto/declarative/repeater/data/repeater.qml
@@ -1,15 +1,17 @@
import Qt 4.6
-Rect {
+Rectangle {
id: container
+ objectName: "container"
width: 240
height: 320
color: "white"
Repeater {
id: repeater
+ objectName: "repeater"
width: 240
height: 320
- dataSource: testData
+ model: testData
Component {
Text {
y: index*20
diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp
index 0e7c187..08f9154 100644
--- a/tests/auto/declarative/repeater/tst_repeater.cpp
+++ b/tests/auto/declarative/repeater/tst_repeater.cpp
@@ -17,7 +17,7 @@ private slots:
private:
QFxView *createView(const QString &filename);
template<typename T>
- T *findItem(QFxItem *parent, const QString &id);
+ T *findItem(QObject *parent, const QString &id);
};
tst_QFxRepeater::tst_QFxRepeater()
@@ -26,7 +26,7 @@ tst_QFxRepeater::tst_QFxRepeater()
void tst_QFxRepeater::stringList()
{
- QFxView *canvas = createView(SRCDIR "/data/repeater.xml");
+ QFxView *canvas = createView(SRCDIR "/data/repeater.qml");
QStringList data;
data << "One";
@@ -35,7 +35,7 @@ void tst_QFxRepeater::stringList()
data << "Four";
QmlContext *ctxt = canvas->rootContext();
- ctxt->setProperty("testData", data);
+ ctxt->setContextProperty("testData", data);
canvas->execute();
qApp->processEvents();
@@ -46,10 +46,10 @@ void tst_QFxRepeater::stringList()
QFxItem *container = findItem<QFxItem>(canvas->root(), "container");
QVERIFY(container != 0);
- QCOMPARE(container->children()->count(), data.count() + 1);
+ QCOMPARE(container->childItems().count(), data.count() + 1);
- for (int i = 1; i < container->children()->count(); ++i) {
- QFxText *name = qobject_cast<QFxText*>(container->children()->at(i));
+ for (int i = 1; i < container->childItems().count(); ++i) {
+ QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i));
QVERIFY(name != 0);
QCOMPARE(name->text(), data.at(i-1));
}
@@ -65,20 +65,20 @@ QFxView *tst_QFxRepeater::createView(const QString &filename)
QFile file(filename);
file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ QString qml = file.readAll();
+ canvas->setQml(qml, filename);
return canvas;
}
template<typename T>
-T *tst_QFxRepeater::findItem(QFxItem *parent, const QString &objectName)
+T *tst_QFxRepeater::findItem(QObject *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName))
return static_cast<T*>(parent);
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = findItem<T>(parent->children()->at(i), objectName);
+ for (int i = 0; i < parent->children().count(); ++i) {
+ QFxItem *item = findItem<T>(parent->children().at(i), objectName);
if (item)
return static_cast<T*>(item);
}