summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextinput
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-03-10 06:38:20 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-03-11 04:44:48 (GMT)
commit27f0c5054e5326bf16f40436ba4e72927ea89cc1 (patch)
treed0658e2ed1632db0561c3413b74240214a34537e /tests/auto/declarative/qdeclarativetextinput
parent68415b0bcc3e531dc16516aa6788aeef8bced6f2 (diff)
downloadQt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.zip
Qt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.tar.gz
Qt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.tar.bz2
Don't reveal TextInput text on refocus in PasswordEchoOnEdit mode.
In PasswordEchoOnEdit mode return the display text instead of the real text from inputMethodQuery() when not editing the password and clear old password if new input is received through an input method event. Change-Id: I7f24f510bf8e356e460900c3b9ff55ea16b32ab3 Task-number: QTBUG-17562 Reviewed-by: Joona Petrell
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextinput')
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 796ac23..45f38a4 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1829,13 +1829,23 @@ void tst_qdeclarativetextinput::echoMode()
QCOMPARE(input->inputMethodHints(), ref);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("QQQQQQQQ"));
QTest::keyPress(canvas, Qt::Key_A);//Clearing previous entry is part of PasswordEchoOnEdit
QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10);
QCOMPARE(input->text(), QLatin1String("a"));
QCOMPARE(input->displayText(), QLatin1String("a"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("a"));
input->setFocus(false);
QVERIFY(input->hasActiveFocus() == false);
QCOMPARE(input->displayText(), QLatin1String("Q"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("Q"));
+ input->setFocus(true);
+ QInputMethodEvent inputEvent;
+ inputEvent.setCommitString(initial);
+ QApplication::sendEvent(canvas, &inputEvent);
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), initial);
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), initial);
delete canvas;
}