summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-21 13:48:39 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-21 13:48:39 (GMT)
commit02c83c2adf0513041d9a3866d4e589ad79d61bda (patch)
treec4f55089c85b6cc10cd39c734b34a7b78b544cd6 /tests
parent2fdac06f820f2362d3ca83ab6d73ed874d903098 (diff)
parentb5af8fbbdc26fa50f40dad2c159b6b64827fa431 (diff)
downloadQt-02c83c2adf0513041d9a3866d4e589ad79d61bda.zip
Qt-02c83c2adf0513041d9a3866d4e589ad79d61bda.tar.gz
Qt-02c83c2adf0513041d9a3866d4e589ad79d61bda.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Avoid printing a warning Only steal hover events when enabled, in QtDemo's qml integration Allow things that load SameGame to disable the Quit button Seems to fix the keyboard focus confusion Fix test ListView doc improvements and examples clean up Doc fixes Fix event forwarding in QDeclarativeFlickable. doc: improve Repeater model docs. doc: couple more performance tips. BorderImage is not updated when border values change XmlListModel: Don't lock while doing the slow bit. Auto test for QTBUG-11507 Properly update childrenRect for position changes and shrinking.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml53
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js7
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp14
5 files changed, 110 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml
new file mode 100644
index 0000000..225d8d4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml
@@ -0,0 +1,53 @@
+import Qt 4.7
+
+Rectangle {
+ width:360;
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: header1
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ width: 100; height: 50
+ color: "green"
+ }
+ Rectangle {
+ id: text1
+ anchors.top: header1.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 100; height: 50
+ color: "blue"
+ }
+ }
+
+ states: [
+ State {
+ name: "row"
+ AnchorChanges {
+ target: header1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.top: undefined
+ }
+ AnchorChanges {
+ target: text1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.top: undefined
+ anchors.left: header1.right
+ }
+ PropertyChanges {
+ target: text1
+ anchors.leftMargin: 10
+ anchors.topMargin: 0
+ }
+ }
+ ]
+}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 0a66245..4a57def 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -44,7 +44,8 @@
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qdeclarativeview.h>
-#include <QtDeclarative/qdeclarativeitem.h>
+#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativeitem_p.h>
#include "../../../shared/util.h"
#ifdef Q_OS_SYMBIAN
@@ -73,6 +74,7 @@ private slots:
void transforms_data();
void childrenRect();
void childrenRectBug();
+ void childrenRectBug2();
void childrenProperty();
void resourcesProperty();
@@ -753,6 +755,29 @@ void tst_QDeclarativeItem::childrenRectBug()
delete canvas;
}
+// QTBUG-11465
+void tst_QDeclarativeItem::childrenRectBug2()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml"));
+ canvas->show();
+
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(canvas->rootObject());
+ QVERIFY(rect);
+ QDeclarativeItem *item = rect->findChild<QDeclarativeItem*>("theItem");
+ QCOMPARE(item->width(), qreal(100));
+ QCOMPARE(item->height(), qreal(110));
+ QCOMPARE(item->x(), qreal(130));
+
+ QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
+ rectPrivate->setState("row");
+ QCOMPARE(item->width(), qreal(210));
+ QCOMPARE(item->height(), qreal(50));
+ QCOMPARE(item->x(), qreal(75));
+
+ delete canvas;
+}
+
template<typename T>
T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
{
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
new file mode 100644
index 0000000..c165e29
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
@@ -0,0 +1,7 @@
+.pragma library
+
+function loadComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.status;
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
new file mode 100644
index 0000000..aae7a91
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
@@ -0,0 +1,10 @@
+import Qt 4.7
+import "createComponent_lib.js" as Test
+
+Item {
+ property int status: Component.Null
+
+ Component.onCompleted: {
+ status = Test.loadComponent()
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 06561fa..fb100a5 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -76,6 +76,7 @@ private slots:
void openUrlExternally();
void md5();
void createComponent();
+ void createComponent_pragmaLibrary();
void createQmlObject();
void consoleLog();
void formatting();
@@ -361,6 +362,19 @@ void tst_qdeclarativeqt::createComponent()
delete object;
}
+void tst_qdeclarativeqt::createComponent_pragmaLibrary()
+{
+ // Currently, just loading createComponent_lib.qml causes crash on some platforms
+ /*
+ QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QEXPECT_FAIL("", "QTBUG-11507", Continue);
+ QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready));
+ */
+}
+
void tst_qdeclarativeqt::createQmlObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));