summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-13 00:12:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-13 00:12:35 (GMT)
commit91054842ae3b87b224ea153711cedf7056e4da60 (patch)
tree1de54549136dd2047a9678d77368d4b30e783788 /tests/auto/declarative
parent8979501336a441e585d38b711ee0fe4a284040f3 (diff)
parent5efd577b1aea64f422e08ca8d54e041fa4b20783 (diff)
downloadQt-91054842ae3b87b224ea153711cedf7056e4da60.zip
Qt-91054842ae3b87b224ea153711cedf7056e4da60.tar.gz
Qt-91054842ae3b87b224ea153711cedf7056e4da60.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: Autotest for QTBUG-5491 (Animation in a Behavior doesn't update running) Private variable cleanup. wantsFocus should be based on FocusScope chain, not parent chain.
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml20
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp18
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/chain.qml28
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml4
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test.qml2
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test5.qml2
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp23
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp7
8 files changed, 91 insertions, 13 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml
new file mode 100644
index 0000000..d439875
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml
@@ -0,0 +1,20 @@
+import Qt 4.7
+
+Rectangle {
+ id: root
+ width:200; height:200
+
+ property real myValue: 0
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 100
+ height: 100
+ color: "green"
+ smooth: true
+ rotation: myValue
+ Behavior on rotation {
+ RotationAnimation { id: rotAnim; objectName: "rotAnim"; direction: RotationAnimation.Shortest }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 70739fb..5c2c145 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <qsignalspy.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativeview.h>
@@ -78,6 +79,7 @@ private slots:
void dontStart();
void startup();
void groupedPropertyCrash();
+ void runningTrue();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -366,6 +368,22 @@ void tst_qdeclarativebehaviors::groupedPropertyCrash()
QVERIFY(rect); //don't crash
}
+//QTBUG-5491
+void tst_qdeclarativebehaviors::runningTrue()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrue.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeAbstractAnimation *animation = rect->findChild<QDeclarativeAbstractAnimation*>("rotAnim");
+ QVERIFY(animation);
+
+ QSignalSpy runningSpy(animation, SIGNAL(runningChanged(bool)));
+ rect->setProperty("myValue", 180);
+ QTRY_VERIFY(runningSpy.count() > 0);
+}
+
QTEST_MAIN(tst_qdeclarativebehaviors)
#include "tst_qdeclarativebehaviors.moc"
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml b/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml
new file mode 100644
index 0000000..6c39f20
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml
@@ -0,0 +1,28 @@
+import Qt 4.7
+
+Rectangle {
+ id: root
+ width:300; height:400
+
+ property bool focus1: root.wantsFocus
+ property bool focus2: item1.wantsFocus
+ property bool focus3: fs1.wantsFocus
+ property bool focus4: fs2.wantsFocus
+ property bool focus5: theItem.wantsFocus
+
+ Item {
+ id: item1
+ FocusScope {
+ id: fs1
+ focus: true
+ FocusScope {
+ id: fs2
+ focus: true
+ Item {
+ id: theItem
+ focus: true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
index 5904fd6..af9c420 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
@@ -8,10 +8,10 @@ Rectangle {
FocusScope {
id: firstScope
+ objectName: "item0"
focus: true
Rectangle {
- objectName: "item0"
height: 120; width: 420
color: "transparent"
@@ -44,9 +44,9 @@ Rectangle {
FocusScope {
id: secondScope
+ objectName: "item3"
Rectangle {
- objectName: "item3"
y: 160; height: 120; width: 420
color: "transparent"
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
index 6b09c29..aa43ba8 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
@@ -9,12 +9,12 @@ Rectangle {
FocusScope {
id: myScope
+ objectName: "item0"
focus: true
Keys.onDigit9Pressed: console.log("Error - FocusScope")
Rectangle {
- objectName: "item0"
height: 120
width: 420
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
index d67ec57..cdb5164 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
@@ -9,12 +9,12 @@ Rectangle {
FocusScope {
id: myScope
+ objectName: "item0"
focus: true
Keys.onReturnPressed: console.log("Error - FocusScope")
Rectangle {
- objectName: "item0"
height: 120
width: 420
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index 7732e6d..2559087 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -68,6 +68,7 @@ private slots:
void noFocus();
void textEdit();
void forceFocus();
+ void noParentFocus();
};
/*
@@ -97,7 +98,7 @@ void tst_qdeclarativefocusscope::basic()
QDeclarativeView *view = new QDeclarativeView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test.qml"));
- QDeclarativeRectangle *item0 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item0"));
+ QDeclarativeFocusScope *item0 = findItem<QDeclarativeFocusScope>(view->rootObject(), QLatin1String("item0"));
QDeclarativeRectangle *item1 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item1"));
QDeclarativeRectangle *item2 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item2"));
QDeclarativeRectangle *item3 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item3"));
@@ -228,7 +229,7 @@ void tst_qdeclarativefocusscope::textEdit()
QDeclarativeView *view = new QDeclarativeView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test5.qml"));
- QDeclarativeRectangle *item0 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item0"));
+ QDeclarativeFocusScope *item0 = findItem<QDeclarativeFocusScope>(view->rootObject(), QLatin1String("item0"));
QDeclarativeTextEdit *item1 = findItem<QDeclarativeTextEdit>(view->rootObject(), QLatin1String("item1"));
QDeclarativeRectangle *item2 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item2"));
QDeclarativeTextEdit *item3 = findItem<QDeclarativeTextEdit>(view->rootObject(), QLatin1String("item3"));
@@ -283,10 +284,10 @@ void tst_qdeclarativefocusscope::forceFocus()
QDeclarativeView *view = new QDeclarativeView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forcefocus.qml"));
- QDeclarativeRectangle *item0 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item0"));
+ QDeclarativeFocusScope *item0 = findItem<QDeclarativeFocusScope>(view->rootObject(), QLatin1String("item0"));
QDeclarativeRectangle *item1 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item1"));
QDeclarativeRectangle *item2 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item2"));
- QDeclarativeRectangle *item3 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item3"));
+ QDeclarativeFocusScope *item3 = findItem<QDeclarativeFocusScope>(view->rootObject(), QLatin1String("item3"));
QDeclarativeRectangle *item4 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item4"));
QDeclarativeRectangle *item5 = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("item5"));
QVERIFY(item0 != 0);
@@ -333,6 +334,20 @@ void tst_qdeclarativefocusscope::forceFocus()
delete view;
}
+void tst_qdeclarativefocusscope::noParentFocus()
+{
+ QDeclarativeView *view = new QDeclarativeView;
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml"));
+ QVERIFY(view->rootObject());
+
+ QVERIFY(view->rootObject()->property("focus1") == true);
+ QVERIFY(view->rootObject()->property("focus2") == false);
+ QVERIFY(view->rootObject()->property("focus3") == true);
+ QVERIFY(view->rootObject()->property("focus4") == true);
+ QVERIFY(view->rootObject()->property("focus5") == true);
+
+ delete view;
+}
QTEST_MAIN(tst_qdeclarativefocusscope)
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 4a57def..ffb2105 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -703,11 +703,8 @@ void tst_QDeclarativeItem::propertyChanges()
QCOMPARE(focusArguments.at(0).toBool(), true);
QCOMPARE(parentItem->hasFocus(), false);
- QCOMPARE(parentItem->wantsFocus(), true);
- QCOMPARE(wantsFocusSpy.count(),1);
- QList<QVariant> wantsFocusArguments = wantsFocusSpy.first();
- QVERIFY(wantsFocusArguments.count() == 1);
- QCOMPARE(wantsFocusArguments.at(0).toBool(), true);
+ QCOMPARE(parentItem->wantsFocus(), false);
+ QCOMPARE(wantsFocusSpy.count(),0);
delete canvas;
}