summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-08 06:05:29 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-08 06:05:29 (GMT)
commitd3ccca2c493ea8149c93cb1f548a676d2d298939 (patch)
treefcd1558e95d0b7fe87adfd209a11215a4ad0b3af /tests/auto
parent15c31bb195d02e1bb489c1aff5f93f1cb829f51f (diff)
downloadQt-d3ccca2c493ea8149c93cb1f548a676d2d298939.zip
Qt-d3ccca2c493ea8149c93cb1f548a676d2d298939.tar.gz
Qt-d3ccca2c493ea8149c93cb1f548a676d2d298939.tar.bz2
Update.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/anchors/data/anchors.qml88
-rw-r--r--tests/auto/declarative/anchors/data/illegal1.qml6
-rw-r--r--tests/auto/declarative/anchors/data/illegal2.qml2
-rw-r--r--tests/auto/declarative/anchors/data/illegal3.qml6
-rw-r--r--tests/auto/declarative/anchors/data/loop1.qml2
-rw-r--r--tests/auto/declarative/anchors/data/loop2.qml2
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp36
7 files changed, 77 insertions, 65 deletions
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml
index 122d440..377dd2d 100644
--- a/tests/auto/declarative/anchors/data/anchors.qml
+++ b/tests/auto/declarative/anchors/data/anchors.qml
@@ -1,116 +1,116 @@
import Qt 4.6
-Rect {
+Rectangle {
color: "white"
width: 240
height: 320
- Rect { id: MasterRect; x: 26; width: 96; height: 20; color: "red" }
- Rect {
- id: Rect1
+ Rectangle { id: MasterRect; objectName: "MasterRect"; x: 26; width: 96; height: 20; color: "red" }
+ Rectangle {
+ id: Rect1; objectName: "Rect1"
y: 20; width: 10; height: 10
anchors.left: MasterRect.left
}
- Rect {
- id: Rect2
+ Rectangle {
+ id: Rect2; objectName: "Rect2"
y: 20; width: 10; height: 10
anchors.left: MasterRect.right
}
- Rect {
- id: Rect3
+ Rectangle {
+ id: Rect3; objectName: "Rect3"
y: 20; width: 10; height: 10
anchors.left: MasterRect.horizontalCenter
}
- Rect {
- id: Rect4
+ Rectangle {
+ id: Rect4; objectName: "Rect4"
y: 30; width: 10; height: 10
anchors.right: MasterRect.left
}
- Rect {
- id: Rect5
+ Rectangle {
+ id: Rect5; objectName: "Rect5"
y: 30; width: 10; height: 10
anchors.right: MasterRect.right
}
- Rect {
- id: Rect6
+ Rectangle {
+ id: Rect6; objectName: "Rect6"
y: 30; width: 10; height: 10
anchors.right: MasterRect.horizontalCenter
}
- Rect {
- id: Rect7
+ Rectangle {
+ id: Rect7; objectName: "Rect7"
y: 50; width: 10; height: 10
anchors.left: parent.left
}
- Rect {
- id: Rect8
+ Rectangle {
+ id: Rect8; objectName: "Rect8"
y: 50; width: 10; height: 10
anchors.left: parent.right
}
- Rect {
- id: Rect9
+ Rectangle {
+ id: Rect9; objectName: "Rect9"
y: 50; width: 10; height: 10
anchors.left: parent.horizontalCenter
}
- Rect {
- id: Rect10
+ Rectangle {
+ id: Rect10; objectName: "Rect10"
y: 60; width: 10; height: 10
anchors.right: parent.left
}
- Rect {
- id: Rect11
+ Rectangle {
+ id: Rect11; objectName: "Rect11"
y: 60; width: 10; height: 10
anchors.right: parent.right
}
- Rect {
- id: Rect12
+ Rectangle {
+ id: Rect12; objectName: "Rect12"
y: 60; width: 10; height: 10
anchors.right: parent.horizontalCenter
}
- Rect {
- id: Rect13
+ Rectangle {
+ id: Rect13; objectName: "Rect13"
x: 200; width: 10; height: 10
anchors.top: MasterRect.bottom
}
- Rect {
- id: Rect14
+ Rectangle {
+ id: Rect14; objectName: "Rect14"
width: 10; height: 10; color: "steelblue"
anchors.verticalCenter: parent.verticalCenter
}
- Rect {
- id: Rect15
+ Rectangle {
+ id: Rect15; objectName: "Rect15"
y: 200; height: 10
anchors.left: MasterRect.left
anchors.right: MasterRect.right
}
- Rect {
- id: Rect16
+ Rectangle {
+ id: Rect16; objectName: "Rect16"
y: 220; height: 10
anchors.left: MasterRect.left
anchors.horizontalCenter: MasterRect.right
}
- Rect {
- id: Rect17
+ Rectangle {
+ id: Rect17; objectName: "Rect17"
y: 240; height: 10
anchors.right: MasterRect.right
anchors.horizontalCenter: MasterRect.left
}
- Rect {
- id: Rect18
+ Rectangle {
+ id: Rect18; objectName: "Rect18"
x: 180; width: 10
anchors.top: MasterRect.bottom
anchors.bottom: Rect12.top
}
- Rect {
- id: Rect19
+ Rectangle {
+ id: Rect19; objectName: "Rect19"
y: 70; width: 10; height: 10
anchors.horizontalCenter: parent.horizontalCenter
}
- Rect {
- id: Rect20
+ Rectangle {
+ id: Rect20; objectName: "Rect20"
y: 70; width: 10; height: 10
anchors.horizontalCenter: parent.right
}
- Rect {
- id: Rect21
+ Rectangle {
+ id: Rect21; objectName: "Rect21"
y: 70; width: 10; height: 10
anchors.horizontalCenter: parent.left
}
diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml
index 1d23110..0a960d0 100644
--- a/tests/auto/declarative/anchors/data/illegal1.qml
+++ b/tests/auto/declarative/anchors/data/illegal1.qml
@@ -1,10 +1,10 @@
import Qt 4.6
-Rect {
+Rectangle {
id: rect
width: 120; height: 200; color: "white"
- Rect { id: TheRect; width: 100; height: 100 }
- Rect {
+ Rectangle { id: TheRect; width: 100; height: 100 }
+ Rectangle {
anchors.left: TheRect.left
anchors.right: TheRect.right
anchors.horizontalCenter: TheRect.horizontalCenter
diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml
index 9f81b91..2497738 100644
--- a/tests/auto/declarative/anchors/data/illegal2.qml
+++ b/tests/auto/declarative/anchors/data/illegal2.qml
@@ -1,6 +1,6 @@
import Qt 4.6
-Rect {
+Rectangle {
id: rect
width: 120; height: 200; color: "white"
Text { id: Text1; text: "Hello" }
diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml
index 4f07456..27b2e4d 100644
--- a/tests/auto/declarative/anchors/data/illegal3.qml
+++ b/tests/auto/declarative/anchors/data/illegal3.qml
@@ -1,12 +1,12 @@
import Qt 4.6
-Rect {
+Rectangle {
id: rect
width: 120; height: 200; color: "white"
Item {
- Rect { id: TheRect; width: 100; height: 100 }
+ Rectangle { id: TheRect; width: 100; height: 100 }
}
- Rect {
+ Rectangle {
anchors.left: TheRect.left
}
}
diff --git a/tests/auto/declarative/anchors/data/loop1.qml b/tests/auto/declarative/anchors/data/loop1.qml
index adc5a10..ef6b63d 100644
--- a/tests/auto/declarative/anchors/data/loop1.qml
+++ b/tests/auto/declarative/anchors/data/loop1.qml
@@ -1,6 +1,6 @@
import Qt 4.6
-Rect {
+Rectangle {
id: rect
width: 120; height: 200; color: "white"
Text { id: Text1; anchors.right: Text2.right; text: "Hello" }
diff --git a/tests/auto/declarative/anchors/data/loop2.qml b/tests/auto/declarative/anchors/data/loop2.qml
index a6856f8..2445a15 100644
--- a/tests/auto/declarative/anchors/data/loop2.qml
+++ b/tests/auto/declarative/anchors/data/loop2.qml
@@ -1,6 +1,6 @@
import Qt 4.6
-Rect {
+Rectangle {
id: container;
width: 600;
height: 600;
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index a8b119c..38b7fe8 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -3,6 +3,8 @@
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmlview.h>
#include <QtDeclarative/qfxrect.h>
+#include <QtDeclarative/private/qfxanchors_p.h>
+
class tst_anchors : public QObject
{
@@ -28,14 +30,17 @@ template<typename T>
T *tst_anchors::findItem(QFxItem *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->QSimpleCanvasItem::children().count(); ++i) {
- QFxItem *item = qobject_cast<QFxItem*>(parent->QSimpleCanvasItem::children().at(i));
- if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
- return static_cast<T*>(item);
+ QList<QGraphicsItem *> children = parent->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem *>(children.at(i)->toGraphicsObject());
+ if (item) {
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
+ return static_cast<T*>(item);
+ }
+ item = findItem<T>(item, objectName);
+ if (item)
+ return static_cast<T*>(item);
}
- item = findItem<T>(item, objectName);
- if (item)
- return static_cast<T*>(item);
}
return 0;
@@ -97,7 +102,10 @@ void tst_anchors::loops()
view->setUrl(QUrl("file://" SRCDIR "/data/loop1.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Possible anchor loop detected on horizontal anchor. "); //x5
+ QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Possible anchor loop detected on horizontal anchor. ";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
qApp->processEvents();
@@ -109,7 +117,8 @@ void tst_anchors::loops()
view->setUrl(QUrl("file://" SRCDIR "/data/loop2.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QML QFxImage (unknown location): Possible anchor loop detected on horizontal anchor. "); //x3
+ QString expect = "QML QFxImage (" + view->url().toString() + ":14:3" + ") Possible anchor loop detected on horizontal anchor. ";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
qApp->processEvents();
@@ -124,7 +133,8 @@ void tst_anchors::illegalSets()
view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors. ");
+ QString expect = "QML QFxRect (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors. ";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
qApp->processEvents();
@@ -136,7 +146,8 @@ void tst_anchors::illegalSets()
view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors. ");
+ QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors. ";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
//qApp->processEvents();
@@ -148,7 +159,8 @@ void tst_anchors::illegalSets()
view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't anchor to an item that isn't a parent or sibling. ");
+ QString expect = "QML QFxRect (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling. ";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
view->execute();
//qApp->processEvents();