summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-07-21 02:23:15 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-07-21 02:33:18 (GMT)
commit21806ff0921641b4e4d9d39721ab4ebeae74dddc (patch)
tree6f854d6279385c120986f0288eb997373058106a /tests/auto/declarative/qdeclarativetextedit
parent4f6e480acce94d8ae920c3eda4879fc4f9cb2598 (diff)
downloadQt-21806ff0921641b4e4d9d39721ab4ebeae74dddc.zip
Qt-21806ff0921641b4e4d9d39721ab4ebeae74dddc.tar.gz
Qt-21806ff0921641b4e4d9d39721ab4ebeae74dddc.tar.bz2
QML focus API updates.
The wantsFocus property has been renamed to activeFocus, to better reflect its value. Reading and writing the focus property is also now consistent -- this property represents focus within a scope. Other small changes were made to keep things consistent with the new naming. Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp28
1 files changed, 14 insertions, 14 deletions
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);