summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-21 21:40:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-21 21:40:46 (GMT)
commit91215b48022b3b3980960f1b5f301ac84f14d49d (patch)
treec71963ebb5270b0f8a85177c22377b7e625fb994 /tests
parent07f131927faa09402589da7b4bfb516482f59e46 (diff)
parentb05e07835c376857da0a0f9cb85bbab001f145dd (diff)
downloadQt-91215b48022b3b3980960f1b5f301ac84f14d49d.zip
Qt-91215b48022b3b3980960f1b5f301ac84f14d49d.tar.gz
Qt-91215b48022b3b3980960f1b5f301ac84f14d49d.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: (26 commits) Expand QDeclarativeExtensionPlugin docs Add missing snippet files Expand QtObject doc Indicate default values Use snippets instead to avoid quoting license headers Rename remaining 'wantsFocus'. Bounding rect of text was not always calculated correctly. Add QML tutorials to the tutorials page QML focus API updates. Do not show copyright header in documentation. Ensure redirects (and indeed all reply process) is done in the right thread. Only ignore the same target value for a Behavior when it is running. Fix clock example: make sure hands always moves forward. font.letterSpacing used percentage rather than absolute values. Rewinding AnchorChanges should not make target item's implicit width and height explicit Compile: include <float.h> for usage of FLT_MAX. Restore the FLT_MAX define. Make Item::transformOriginPoint read-only Ensure the boundingRect() of Text is correctly calculated. Better defaults for MouseArea's drag. ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml17
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/chain.qml10
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml22
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test.qml14
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test2.qml10
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test3.qml2
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test4.qml14
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/test5.qml10
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp131
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml29
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp9
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml37
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml2
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp37
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/rotated.qml18
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp40
-rw-r--r--tests/auto/declarative/qmlvisual/focusscope/test.qml8
-rw-r--r--tests/auto/declarative/qmlvisual/focusscope/test2.qml10
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml4
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml4
25 files changed, 361 insertions, 180 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml
new file mode 100644
index 0000000..804559c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml
@@ -0,0 +1,17 @@
+import Qt 4.7
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+
+ Rectangle {
+ id: myRect
+ objectName: "myRect"
+ width: 100
+ height: 100
+ Behavior on x {
+ NumberAnimation {}
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 5c2c145..bb7fc7b 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -80,6 +80,7 @@ private slots:
void startup();
void groupedPropertyCrash();
void runningTrue();
+ void sameValue();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -384,6 +385,32 @@ void tst_qdeclarativebehaviors::runningTrue()
QTRY_VERIFY(runningSpy.count() > 0);
}
+//QTBUG-12295
+void tst_qdeclarativebehaviors::sameValue()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug12295.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *target = rect->findChild<QDeclarativeRectangle*>("myRect");
+ QVERIFY(target);
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ //this is the main point of the test -- the behavior needs to be triggered again
+ //even though we set 0 twice in a row.
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+}
+
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
index 6c39f20..42b50cf 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml
@@ -4,11 +4,11 @@ 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
+ property bool focus1: root.activeFocus
+ property bool focus2: item1.activeFocus
+ property bool focus3: fs1.activeFocus
+ property bool focus4: fs2.activeFocus
+ property bool focus5: theItem.activeFocus
Item {
id: item1
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
index af9c420..9144854 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
@@ -15,28 +15,28 @@ Rectangle {
height: 120; width: 420
color: "transparent"
- border.width: 5; border.color: firstScope.wantsFocus?"blue":"black"
+ border.width: 5; border.color: firstScope.activeFocus?"blue":"black"
Rectangle {
id: item1; objectName: "item1"
x: 10; y: 10; width: 100; height: 100; color: "green"
- border.width: 5; border.color: wantsFocus?"blue":"black"
+ border.width: 5; border.color: activeFocus?"blue":"black"
focus: true
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
Rectangle {
id: item2; objectName: "item2"
x: 310; y: 10; width: 100; height: 100; color: "green"
- border.width: 5; border.color: wantsFocus?"blue":"black"
+ border.width: 5; border.color: activeFocus?"blue":"black"
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
}
@@ -50,32 +50,32 @@ Rectangle {
y: 160; height: 120; width: 420
color: "transparent"
- border.width: 5; border.color: secondScope.wantsFocus?"blue":"black"
+ border.width: 5; border.color: secondScope.activeFocus?"blue":"black"
Rectangle {
id: item4; objectName: "item4"
x: 10; y: 10; width: 100; height: 100; color: "green"
- border.width: 5; border.color: wantsFocus?"blue":"black"
+ border.width: 5; border.color: activeFocus?"blue":"black"
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
Rectangle {
id: item5; objectName: "item5"
x: 310; y: 10; width: 100; height: 100; color: "green"
- border.width: 5; border.color: wantsFocus?"blue":"black"
+ border.width: 5; border.color: activeFocus?"blue":"black"
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
}
}
}
Keys.onDigit4Pressed: item4.focus = true
- Keys.onDigit5Pressed: item5.forceFocus()
+ Keys.onDigit5Pressed: item5.forceActiveFocus()
}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
index aa43ba8..55be103 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml
@@ -20,21 +20,21 @@ Rectangle {
color: "transparent"
border.width: 5
- border.color: myScope.wantsFocus?"blue":"black"
+ border.color: myScope.activeFocus?"blue":"black"
Rectangle {
id: item1; objectName: "item1"
x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.debug("Top Left");
KeyNavigation.right: item2
focus: true
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
@@ -43,13 +43,13 @@ Rectangle {
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
KeyNavigation.left: item1
Keys.onDigit9Pressed: console.log("Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
}
@@ -63,14 +63,14 @@ Rectangle {
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.log("Bottom Left");
KeyNavigation.up: myScope
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml
index 216277e..5ed701d 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml
@@ -10,27 +10,27 @@ Rectangle {
FocusScope {
y: 100
focus: true; objectName: "item1"
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true; objectName: "item2"
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true; objectName: "item3"
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true; objectName: "item4"
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true; objectName: "item5"
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
}
}
}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml
index 2ac0d18..c6d112f 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml
@@ -13,7 +13,7 @@ Rectangle {
ListElement { name: "4" }
ListElement { name: "5" }
ListElement { name: "6" }
- ListElement { name: "6" }
+ ListElement { name: "7" }
ListElement { name: "8" }
ListElement { name: "9" }
}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml
index 8862b39..3c6d3bd 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml
@@ -19,21 +19,21 @@ Rectangle {
color: "transparent"
border.width: 5
- border.color: myScope.wantsFocus?"blue":"black"
+ border.color: myScope.activeFocus?"blue":"black"
Rectangle {
id: item1; objectName: "item1"
x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.log("Error - Top Left");
KeyNavigation.right: item2
focus: true
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
@@ -42,13 +42,13 @@ Rectangle {
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
KeyNavigation.left: item1
Keys.onDigit9Pressed: console.log("Error - Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
}
@@ -62,14 +62,14 @@ Rectangle {
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.log("Error - Bottom Left");
KeyNavigation.up: myScope
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
index cdb5164..4417d5f 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml
@@ -20,13 +20,13 @@ Rectangle {
color: "transparent"
border.width: 5
- border.color: myScope.wantsFocus?"blue":"black"
+ border.color: myScope.activeFocus?"blue":"black"
Rectangle {
x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: item1.wantsFocus?"blue":"black"
+ border.color: item1.activeFocus?"blue":"black"
}
TextEdit {
@@ -47,13 +47,13 @@ Rectangle {
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
KeyNavigation.left: item1
Keys.onReturnPressed: console.log("Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
- color: parent.focus?"red":"transparent"
+ color: parent.activeFocus?"red":"transparent"
}
}
}
@@ -66,7 +66,7 @@ Rectangle {
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
- border.color: item3.wantsFocus?"blue":"black"
+ border.color: item3.activeFocus?"blue":"black"
}
TextEdit {
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index 2559087..b0c9c03 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -118,22 +118,22 @@ void tst_qdeclarativefocusscope::basic()
QVERIFY(view->hasFocus());
QVERIFY(view->scene()->hasFocus());
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Right);
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == true);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Down);
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == true);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
delete view;
}
@@ -166,16 +166,11 @@ void tst_qdeclarativefocusscope::nested()
QVERIFY(view->hasFocus());
QVERIFY(view->scene()->hasFocus());
- QVERIFY(item1->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->wantsFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->wantsFocus() == true);
- QVERIFY(item3->hasFocus() == false);
- QVERIFY(item4->wantsFocus() == true);
- QVERIFY(item4->hasFocus() == false);
- QVERIFY(item5->wantsFocus() == true);
- QVERIFY(item5->hasFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == true);
+ QVERIFY(item4->hasActiveFocus() == true);
+ QVERIFY(item5->hasActiveFocus() == true);
delete view;
}
@@ -204,22 +199,22 @@ void tst_qdeclarativefocusscope::noFocus()
QVERIFY(view->hasFocus());
QVERIFY(view->scene()->hasFocus());
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Right);
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Down);
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
delete view;
}
@@ -249,32 +244,32 @@ void tst_qdeclarativefocusscope::textEdit()
QVERIFY(view->hasFocus());
QVERIFY(view->scene()->hasFocus());
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Right);
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Right);
QTest::keyClick(view, Qt::Key_Right);
QTest::keyClick(view, Qt::Key_Right);
QTest::keyClick(view, Qt::Key_Right);
QTest::keyClick(view, Qt::Key_Right);
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == true);
- QVERIFY(item3->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Down);
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->hasFocus() == true);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
delete view;
}
@@ -308,28 +303,28 @@ void tst_qdeclarativefocusscope::forceFocus()
QVERIFY(view->hasFocus());
QVERIFY(view->scene()->hasFocus());
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->wantsFocus() == false);
- QVERIFY(item4->hasFocus() == false);
- QVERIFY(item5->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_4);
- QVERIFY(item0->wantsFocus() == true);
- QVERIFY(item1->hasFocus() == true);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->wantsFocus() == false);
- QVERIFY(item4->hasFocus() == false);
- QVERIFY(item5->hasFocus() == false);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_5);
- QVERIFY(item0->wantsFocus() == false);
- QVERIFY(item1->hasFocus() == false);
- QVERIFY(item2->hasFocus() == false);
- QVERIFY(item3->wantsFocus() == true);
- QVERIFY(item4->hasFocus() == false);
- QVERIFY(item5->hasFocus() == true);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == true);
delete view;
}
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 38fd458..b8d2828 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -136,6 +136,7 @@ void tst_qdeclarativeimage::imageSource_data()
QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false
<< true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << "";
+ QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << "";
QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << "";
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true
<< false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
@@ -155,6 +156,7 @@ void tst_qdeclarativeimage::imageSource()
if (remote) {
QVERIFY(server.isValid());
server.serveDirectory(SRCDIR "/data");
+ server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
}
if (!error.isEmpty())
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index ffb2105..345ce38 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -371,7 +371,7 @@ void tst_QDeclarativeItem::keyNavigation()
QDeclarativeItem *item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
@@ -380,7 +380,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item2");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// down
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
@@ -389,7 +389,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item4");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// left
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
@@ -398,7 +398,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item3");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// up
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
@@ -407,7 +407,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// tab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
@@ -416,7 +416,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item2");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// backtab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
@@ -425,7 +425,7 @@ void tst_QDeclarativeItem::keyNavigation()
item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1");
QVERIFY(item);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
delete canvas;
}
@@ -618,21 +618,21 @@ void tst_QDeclarativeItem::mouseFocus()
QDeclarativeItem *item = findItem<QDeclarativeItem>(canvas->rootObject(), "declarativeItem");
QVERIFY(item);
- QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool)));
+ QSignalSpy focusSpy(item, SIGNAL(activeFocusChanged(bool)));
QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos()));
QApplication::processEvents();
QCOMPARE(focusSpy.count(), 1);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
// make sure focusable graphics widget underneath does not steal focus
QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos()));
QApplication::processEvents();
QCOMPARE(focusSpy.count(), 1);
- QVERIFY(item->hasFocus());
+ QVERIFY(item->hasActiveFocus());
item->setFocus(false);
- QVERIFY(!item->hasFocus());
+ QVERIFY(!item->hasActiveFocus());
QCOMPARE(focusSpy.count(), 2);
item->setFocus(true);
QCOMPARE(focusSpy.count(), 3);
@@ -664,7 +664,7 @@ void tst_QDeclarativeItem::propertyChanges()
QSignalSpy baselineOffsetSpy(item, SIGNAL(baselineOffsetChanged(qreal)));
QSignalSpy childrenRectSpy(parentItem, SIGNAL(childrenRectChanged(QRectF)));
QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool)));
- QSignalSpy wantsFocusSpy(parentItem, SIGNAL(wantsFocusChanged(bool)));
+ QSignalSpy wantsFocusSpy(parentItem, SIGNAL(activeFocusChanged(bool)));
item->setParentItem(parentItem);
item->setWidth(100.0);
@@ -696,14 +696,14 @@ void tst_QDeclarativeItem::propertyChanges()
QVERIFY(childrenRectArguments.count() == 1);
QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF());
- QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
QCOMPARE(focusSpy.count(),1);
QList<QVariant> focusArguments = focusSpy.first();
QVERIFY(focusArguments.count() == 1);
QCOMPARE(focusArguments.at(0).toBool(), true);
+ QCOMPARE(parentItem->hasActiveFocus(), false);
QCOMPARE(parentItem->hasFocus(), false);
- QCOMPARE(parentItem->wantsFocus(), false);
QCOMPARE(wantsFocusSpy.count(),0);
delete canvas;
diff --git a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml
index e8dd8cc..4810736 100644
--- a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml
+++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml
@@ -4,21 +4,27 @@
import Qt 4.7
Rectangle {
+ id: root
color: "lightgray"
width: 240
height: 320
+ property variant itemModel: itemModel1
function checkProperties() {
testObject.error = false;
- if (testObject.useModel && view.model != itemModel) {
+ if (testObject.useModel && view.model != root.itemModel) {
console.log("model property incorrect");
testObject.error = true;
}
}
+ function switchModel() {
+ root.itemModel = itemModel2
+ }
+
VisualItemModel {
- id: itemModel
- objectName: "itemModel"
+ id: itemModel1
+ objectName: "itemModel1"
Rectangle {
objectName: "item1"
height: 50; width: 100; color: "#FFFEF0"
@@ -36,12 +42,27 @@ Rectangle {
}
}
+ VisualItemModel {
+ id: itemModel2
+ objectName: "itemModel2"
+ Rectangle {
+ objectName: "item4"
+ height: 50; width: 100; color: "#FFFEF0"
+ Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item5"
+ height: 50; width: 100; color: "#F0FFF7"
+ Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
Column {
objectName: "container"
Repeater {
id: view
objectName: "repeater"
- model: testObject.useModel ? itemModel : 0
+ model: testObject.useModel ? root.itemModel : 0
}
}
}
diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
index 7299a43..623b3d7 100644
--- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
+++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
@@ -361,6 +361,15 @@ void tst_QDeclarativeRepeater::itemModel()
QVERIFY(qobject_cast<QObject*>(container->childItems().at(2))->objectName() == "item3");
QVERIFY(container->childItems().at(3) == repeater);
+ QMetaObject::invokeMethod(canvas->rootObject(), "switchModel");
+ QCOMPARE(container->childItems().count(), 3);
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(0))->objectName() == "item4");
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(1))->objectName() == "item5");
+ QVERIFY(container->childItems().at(2) == repeater);
+
+ testObject->setUseModel(false);
+ QCOMPARE(container->childItems().count(), 1);
+
delete testObject;
delete canvas;
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
new file mode 100644
index 0000000..e6b6020
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
@@ -0,0 +1,37 @@
+import Qt 4.7
+Rectangle {
+ id: container
+ color: "red"
+ height: 200
+ width: 200
+ Column {
+ id: column
+ objectName: "column"
+ anchors.left: container.right
+ anchors.bottom: container.bottom
+
+ Rectangle {
+ id: rectangle
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ Rectangle {
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: column
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ PropertyChanges {
+ target: rectangle
+ opacity: 0
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml
index 807eec9..8f9a7f2 100644
--- a/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml
@@ -5,6 +5,6 @@ Rectangle {
color: "red"
states: State {
name: "blue"
- PropertyChanges { target: myRectangle; colr: "blue"; wantsFocus: true }
+ PropertyChanges { target: myRectangle; colr: "blue"; activeFocus: true }
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 639b2f3..3b6a420 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -121,6 +121,7 @@ private slots:
void anchorChanges4();
void anchorChanges5();
void anchorChangesCrash();
+ void anchorRewindBug();
void script();
void restoreEntryValues();
void explicitChanges();
@@ -807,6 +808,40 @@ void tst_qdeclarativestates::anchorChangesCrash()
delete rect;
}
+// QTBUG-12273
+void tst_qdeclarativestates::anchorRewindBug()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QDeclarativeItem * column = rect->findChild<QDeclarativeItem*>("column");
+
+ QVERIFY(column != 0);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 200.0);
+ QDeclarativeItemPrivate::get(rect)->setState("reanchored");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 100.0);
+
+ QDeclarativeItemPrivate::get(rect)->setState("");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
+ QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 200.0);
+
+ delete rect;
+}
+
void tst_qdeclarativestates::script()
{
QDeclarativeEngine engine;
@@ -887,7 +922,7 @@ void tst_qdeclarativestates::propertyErrors()
QCOMPARE(rect->color(),QColor("red"));
QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"wantsFocus\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\"");
QDeclarativeItemPrivate::get(rect)->setState("blue");
}
diff --git a/tests/auto/declarative/qdeclarativetext/data/rotated.qml b/tests/auto/declarative/qdeclarativetext/data/rotated.qml
new file mode 100644
index 0000000..01eec44
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetext/data/rotated.qml
@@ -0,0 +1,18 @@
+import Qt 4.7
+
+Rectangle {
+ width : 200
+ height : 100
+
+ Text {
+ objectName: "text"
+ x: 20
+ y: 20
+ height : 20
+ width : 80
+ text : "Something"
+ rotation : 30
+ transformOrigin : Item.TopLeft
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 80198eb..658f381 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -97,6 +97,8 @@ private slots:
void clickLink();
+ void QTBUG_12291();
+
private:
QStringList standard;
QStringList richText;
@@ -246,6 +248,7 @@ void tst_qdeclarativetext::width()
QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
QVERIFY(textObject != 0);
+ QVERIFY(textObject->boundingRect().width() > 0);
QCOMPARE(textObject->width(), qreal(metricWidth));
QVERIFY(textObject->textFormat() == QDeclarativeText::AutoText); // setting text doesn't change format
}
@@ -847,22 +850,22 @@ void tst_qdeclarativetext::letterSpacing()
QCOMPARE(textObject->font().letterSpacing(), 0.0);
}
{
- QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -50 }";
+ QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -2 }";
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
QVERIFY(textObject != 0);
- QCOMPARE(textObject->font().letterSpacing(), -50.);
+ QCOMPARE(textObject->font().letterSpacing(), -2.);
}
{
- QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 200 }";
+ QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 3 }";
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
QVERIFY(textObject != 0);
- QCOMPARE(textObject->font().letterSpacing(), 200.);
+ QCOMPARE(textObject->font().letterSpacing(), 3.);
}
}
@@ -897,6 +900,23 @@ void tst_qdeclarativetext::wordSpacing()
}
}
+void tst_qdeclarativetext::QTBUG_12291()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/rotated.qml");
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QObject *ob = canvas->rootObject();
+ QVERIFY(ob != 0);
+
+ QDeclarativeText *text = ob->findChild<QDeclarativeText*>("text");
+ QVERIFY(text);
+ QVERIFY(text->boundingRect().isValid());
+}
+
class EventSender : public QGraphicsItem
{
public:
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 4783bc7..93351a8 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -604,7 +604,7 @@ void tst_qdeclarativetextedit::persistentSelection()
void tst_qdeclarativetextedit::focusOnPress()
{
{
- QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: true; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.7\nTextEdit { activeFocusOnPress: true; text: \"Hello World\" }";
QDeclarativeComponent texteditComponent(&engine);
texteditComponent.setData(componentStr.toLatin1(), QUrl());
QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
@@ -613,7 +613,7 @@ void tst_qdeclarativetextedit::focusOnPress()
}
{
- QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: false; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.7\nTextEdit { activeFocusOnPress: false; text: \"Hello World\" }";
QDeclarativeComponent texteditComponent(&engine);
texteditComponent.setData(componentStr.toLatin1(), QUrl());
QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
@@ -840,15 +840,15 @@ void tst_qdeclarativetextedit::navigation()
QDeclarativeItem *input = qobject_cast<QDeclarativeItem *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
- QTRY_VERIFY(input->hasFocus() == true);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
simulateKey(canvas, Qt::Key_Left);
- QVERIFY(input->hasFocus() == false);
+ QVERIFY(input->hasActiveFocus() == false);
simulateKey(canvas, Qt::Key_Right);
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
simulateKey(canvas, Qt::Key_Right);
- QVERIFY(input->hasFocus() == false);
+ QVERIFY(input->hasActiveFocus() == false);
simulateKey(canvas, Qt::Key_Left);
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
}
void tst_qdeclarativetextedit::copyAndPaste() {
@@ -908,7 +908,7 @@ void tst_qdeclarativetextedit::readOnly()
QDeclarativeTextEdit *edit = qobject_cast<QDeclarativeTextEdit *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(edit != 0);
- QTRY_VERIFY(edit->hasFocus() == true);
+ QTRY_VERIFY(edit->hasActiveFocus() == true);
QVERIFY(edit->isReadOnly() == true);
QString initial = edit->text();
for(int k=Qt::Key_0; k<=Qt::Key_Z; k++)
@@ -968,7 +968,7 @@ void tst_qdeclarativetextedit::openInputPanelOnClick()
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextEdit edit;
- QSignalSpy focusOnPressSpy(&edit, SIGNAL(focusOnPressChanged(bool)));
+ QSignalSpy focusOnPressSpy(&edit, SIGNAL(activeFocusOnPressChanged(bool)));
edit.setText("Hello world");
edit.setPos(0, 0);
scene.addItem(&edit);
@@ -1016,7 +1016,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus()
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextEdit edit;
- QSignalSpy focusOnPressSpy(&edit, SIGNAL(focusOnPressChanged(bool)));
+ QSignalSpy focusOnPressSpy(&edit, SIGNAL(activeFocusOnPressChanged(bool)));
edit.setText("Hello world");
edit.setPos(0, 0);
scene.addItem(&edit);
@@ -1038,7 +1038,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus()
// focus on press, input panel on focus
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
QApplication::processEvents();
- QVERIFY(edit.hasFocus());
+ QVERIFY(edit.hasActiveFocus());
QCOMPARE(ic.openInputPanelReceived, true);
ic.openInputPanelReceived = false;
@@ -1048,7 +1048,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus()
ic.openInputPanelReceived = false;
// if already focused, input panel can be opened on press
- QVERIFY(edit.hasFocus());
+ QVERIFY(edit.hasActiveFocus());
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
QApplication::processEvents();
QCOMPARE(ic.openInputPanelReceived, true);
@@ -1076,7 +1076,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus()
QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled));
// no automatic input panel events should
- // be sent if focusOnPress is false
+ // be sent if activeFocusOnPress is false
edit.setFocusOnPress(false);
QCOMPARE(focusOnPressSpy.count(),1);
edit.setFocusOnPress(false);
@@ -1103,7 +1103,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
- // set focusOnPress back to true
+ // set activeFocusOnPress back to true
edit.setFocusOnPress(true);
QCOMPARE(focusOnPressSpy.count(),2);
edit.setFocusOnPress(true);
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index a48bc39..e5e495e 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -494,7 +494,7 @@ void tst_qdeclarativetextinput::maxLength()
}
textinputObject->setText("");
- QTRY_VERIFY(textinputObject->hasFocus() == true);
+ QTRY_VERIFY(textinputObject->hasActiveFocus() == true);
for(int i=0; i<20; i++){
QCOMPARE(textinputObject->text().length(), qMin(i,10));
//simulateKey(canvas, Qt::Key_A);
@@ -515,7 +515,7 @@ void tst_qdeclarativetextinput::masks()
QVERIFY(canvas->rootObject() != 0);
QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
QVERIFY(textinputObject != 0);
- QTRY_VERIFY(textinputObject->hasFocus() == true);
+ QTRY_VERIFY(textinputObject->hasActiveFocus() == true);
QVERIFY(textinputObject->text().length() == 0);
QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; "));
for(int i=0; i<10; i++){
@@ -544,7 +544,7 @@ void tst_qdeclarativetextinput::validators()
QDeclarativeTextInput *intInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("intInput")));
QVERIFY(intInput);
intInput->setFocus(true);
- QTRY_VERIFY(intInput->hasFocus());
+ QTRY_VERIFY(intInput->hasActiveFocus());
QTest::keyPress(canvas, Qt::Key_1);
QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10);
QCOMPARE(intInput->text(), QLatin1String("1"));
@@ -565,7 +565,7 @@ void tst_qdeclarativetextinput::validators()
QDeclarativeTextInput *dblInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("dblInput")));
QTRY_VERIFY(dblInput);
dblInput->setFocus(true);
- QVERIFY(dblInput->hasFocus() == true);
+ QVERIFY(dblInput->hasActiveFocus() == true);
QTest::keyPress(canvas, Qt::Key_1);
QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10);
QCOMPARE(dblInput->text(), QLatin1String("1"));
@@ -594,7 +594,7 @@ void tst_qdeclarativetextinput::validators()
QDeclarativeTextInput *strInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("strInput")));
QTRY_VERIFY(strInput);
strInput->setFocus(true);
- QVERIFY(strInput->hasFocus() == true);
+ QVERIFY(strInput->hasActiveFocus() == true);
QTest::keyPress(canvas, Qt::Key_1);
QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10);
QCOMPARE(strInput->text(), QLatin1String(""));
@@ -642,7 +642,7 @@ void tst_qdeclarativetextinput::inputMethods()
QVERIFY(canvas->rootObject() != 0);
input->setFocus(true);
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
// test that input method event is committed
QInputMethodEvent event;
event.setCommitString( "My ", -12, 0);
@@ -669,11 +669,11 @@ void tst_qdeclarativetextinput::navigation()
QVERIFY(input != 0);
input->setCursorPosition(0);
- QTRY_VERIFY(input->hasFocus() == true);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
simulateKey(canvas, Qt::Key_Left);
- QVERIFY(input->hasFocus() == false);
+ QVERIFY(input->hasActiveFocus() == false);
simulateKey(canvas, Qt::Key_Right);
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
//QT-2944: If text is selected, ensure we deselect upon cursor motion
input->setCursorPosition(input->text().length());
input->select(0,input->text().length());
@@ -681,11 +681,11 @@ void tst_qdeclarativetextinput::navigation()
simulateKey(canvas, Qt::Key_Right);
QVERIFY(input->selectionStart() == input->selectionEnd());
QVERIFY(input->selectionStart() == input->text().length());
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
simulateKey(canvas, Qt::Key_Right);
- QVERIFY(input->hasFocus() == false);
+ QVERIFY(input->hasActiveFocus() == false);
simulateKey(canvas, Qt::Key_Left);
- QVERIFY(input->hasFocus() == true);
+ QVERIFY(input->hasActiveFocus() == true);
// Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438).
input->setCursorPosition(2);
@@ -784,7 +784,7 @@ void tst_qdeclarativetextinput::readOnly()
QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
- QTRY_VERIFY(input->hasFocus() == true);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
QVERIFY(input->isReadOnly() == true);
QString initial = input->text();
for(int k=Qt::Key_0; k<=Qt::Key_Z; k++)
@@ -808,7 +808,7 @@ void tst_qdeclarativetextinput::echoMode()
QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
QVERIFY(input != 0);
- QTRY_VERIFY(input->hasFocus() == true);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
QString initial = input->text();
Qt::InputMethodHints ref;
QCOMPARE(initial, QLatin1String("ABCDefgh"));
@@ -901,7 +901,7 @@ void tst_qdeclarativetextinput::openInputPanelOnClick()
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextInput input;
- QSignalSpy focusOnPressSpy(&input, SIGNAL(focusOnPressChanged(bool)));
+ QSignalSpy focusOnPressSpy(&input, SIGNAL(activeFocusOnPressChanged(bool)));
input.setText("Hello world");
input.setPos(0, 0);
scene.addItem(&input);
@@ -948,7 +948,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextInput input;
- QSignalSpy focusOnPressSpy(&input, SIGNAL(focusOnPressChanged(bool)));
+ QSignalSpy focusOnPressSpy(&input, SIGNAL(activeFocusOnPressChanged(bool)));
input.setText("Hello world");
input.setPos(0, 0);
scene.addItem(&input);
@@ -970,7 +970,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
// focus on press, input panel on focus
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
QApplication::processEvents();
- QVERIFY(input.hasFocus());
+ QVERIFY(input.hasActiveFocus());
QCOMPARE(ic.openInputPanelReceived, true);
ic.openInputPanelReceived = false;
@@ -980,7 +980,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
ic.openInputPanelReceived = false;
// if already focused, input panel can be opened on press
- QVERIFY(input.hasFocus());
+ QVERIFY(input.hasActiveFocus());
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
QApplication::processEvents();
QCOMPARE(ic.openInputPanelReceived, true);
@@ -1008,7 +1008,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled));
// no automatic input panel events should
- // be sent if focusOnPress is false
+ // be sent if activeFocusOnPress is false
input.setFocusOnPress(false);
QCOMPARE(focusOnPressSpy.count(),1);
input.setFocusOnPress(false);
@@ -1035,7 +1035,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
- // set focusOnPress back to true
+ // set activeFocusOnPress back to true
input.setFocusOnPress(true);
QCOMPARE(focusOnPressSpy.count(),2);
input.setFocusOnPress(true);
diff --git a/tests/auto/declarative/qmlvisual/focusscope/test.qml b/tests/auto/declarative/qmlvisual/focusscope/test.qml
index d83bad4..24b4b99 100644
--- a/tests/auto/declarative/qmlvisual/focusscope/test.qml
+++ b/tests/auto/declarative/qmlvisual/focusscope/test.qml
@@ -19,14 +19,14 @@ Rectangle {
color: "transparent"
border.width: 5
- border.color: myScope.wantsFocus?"blue":"black"
+ border.color: myScope.activeFocus?"blue":"black"
Rectangle {
id: item1
x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.log("Top Left");
KeyNavigation.right: item2
focus: true
@@ -42,7 +42,7 @@ Rectangle {
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
KeyNavigation.left: item1
Keys.onDigit9Pressed: console.log("Top Right");
@@ -62,7 +62,7 @@ Rectangle {
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
- border.color: wantsFocus?"blue":"black"
+ border.color: activeFocus?"blue":"black"
Keys.onDigit9Pressed: console.log("Bottom Left");
KeyNavigation.up: myScope
diff --git a/tests/auto/declarative/qmlvisual/focusscope/test2.qml b/tests/auto/declarative/qmlvisual/focusscope/test2.qml
index 7a6ed83..19c8bed 100644
--- a/tests/auto/declarative/qmlvisual/focusscope/test2.qml
+++ b/tests/auto/declarative/qmlvisual/focusscope/test2.qml
@@ -10,27 +10,27 @@ Rectangle {
FocusScope {
y: 100
focus: true
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
FocusScope {
y: 100
focus: true
- Rectangle { width: 50; height: 50; color: parent.wantsFocus?"red":"blue" }
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
}
}
}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
index 73dd4d7..e268a60 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml
@@ -34,10 +34,10 @@ Rectangle {
text: s.text; font.underline: true; font.overline: true; font.strikeout: true
}
Text {
- text: s.text; font.letterSpacing: 200
+ text: s.text; font.letterSpacing: 2
}
Text {
- text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue"
+ text: s.text; font.underline: true; font.letterSpacing: 2; font.capitalization: "AllUppercase"; color: "blue"
}
Text {
text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green"
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
index b41b93a..a883b9c 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml
@@ -34,10 +34,10 @@ Rectangle {
text: s.text; font.underline: true; font.overline: true; font.strikeout: true
}
Text {
- text: s.text; font.letterSpacing: 200
+ text: s.text; font.letterSpacing: 2
}
Text {
- text: s.text; font.underline: true; font.letterSpacing: 200; font.capitalization: "AllUppercase"; color: "blue"
+ text: s.text; font.underline: true; font.letterSpacing: 2; font.capitalization: "AllUppercase"; color: "blue"
}
Text {
text: s.text; font.overline: true; font.wordSpacing: 25; font.capitalization: "Capitalize"; color: "green"