summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-08-13 07:09:27 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-08-13 07:10:23 (GMT)
commitade18bab3a2c4c877baa9be2a0012d670dafb64a (patch)
treee0eb3277304e631b4a144c2d00fef281c14efa26
parent7a2d6086b41aa4877f253dff4d412028506ae38e (diff)
downloadQt-ade18bab3a2c4c877baa9be2a0012d670dafb64a.zip
Qt-ade18bab3a2c4c877baa9be2a0012d670dafb64a.tar.gz
Qt-ade18bab3a2c4c877baa9be2a0012d670dafb64a.tar.bz2
Add autotest that checks that copy and cut don't work when echomode is set to hide text/password mode
Task-number: QTBUG-12086 Reviewed-by: Michael Brasser
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 6e15a4a..ca9009d 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -741,6 +741,30 @@ void tst_qdeclarativetextinput::copyAndPaste() {
textInput->paste();
QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
QCOMPARE(textInput->text().length(), 24);
+
+ // clear copy buffer
+ QClipboard *clipboard = QApplication::clipboard();
+ QVERIFY(clipboard);
+ clipboard->clear();
+
+ // test that copy functionality is disabled
+ // when echo mode is set to hide text/password mode
+ int index = 0;
+ while (index < 4) {
+ QDeclarativeTextInput::EchoMode echoMode = QDeclarativeTextInput::EchoMode(index);
+ textInput->setEchoMode(echoMode);
+ textInput->setText("My password");
+ textInput->select(0, textInput->text().length());;
+ textInput->copy();
+ if (echoMode == QDeclarativeTextInput::Normal) {
+ QVERIFY(!clipboard->text().isEmpty());
+ QCOMPARE(clipboard->text(), QString("My password"));
+ clipboard->clear();
+ } else {
+ QVERIFY(clipboard->text().isEmpty());
+ }
+ index++;
+ }
#endif
}