summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-01-17 04:07:33 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2011-01-17 04:07:33 (GMT)
commit8b6674e55118896dfecbcdc1960418dc2064f632 (patch)
tree243889d8c43b7a0bd294866e904b079e0a0b90c0 /tests
parent62087b2ec0afad240d61a61c7a2972d021e01695 (diff)
downloadQt-8b6674e55118896dfecbcdc1960418dc2064f632.zip
Qt-8b6674e55118896dfecbcdc1960418dc2064f632.tar.gz
Qt-8b6674e55118896dfecbcdc1960418dc2064f632.tar.bz2
Add canPaste property to TextInput and TextEdit
Task-number: QTBUG-16190 Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp9
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 649d34f..7578042 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -1111,10 +1111,18 @@ void tst_qdeclarativetextedit::copyAndPaste() {
QCOMPARE(textEdit->selectedText(), QString("Hello world!"));
QCOMPARE(textEdit->selectedText().length(), 12);
textEdit->setCursorPosition(0);
+ QVERIFY(textEdit->canPaste());
textEdit->paste();
QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
QCOMPARE(textEdit->text().length(), 24);
+ // canPaste
+ QVERIFY(textEdit->canPaste());
+ textEdit->setReadOnly(true);
+ QVERIFY(!textEdit->canPaste());
+ textEdit->setReadOnly(false);
+ QVERIFY(textEdit->canPaste());
+
// QTBUG-12339
// test that document and internal text attribute are in sync
QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(textEdit);
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 964125f..d7e6a60 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -952,10 +952,18 @@ void tst_qdeclarativetextinput::copyAndPaste() {
QCOMPARE(textInput->selectedText(), QString("Hello world!"));
QCOMPARE(textInput->selectedText().length(), 12);
textInput->setCursorPosition(0);
+ QVERIFY(textInput->canPaste());
textInput->paste();
QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
QCOMPARE(textInput->text().length(), 24);
+ // can paste
+ QVERIFY(textInput->canPaste());
+ textInput->setReadOnly(true);
+ QVERIFY(!textInput->canPaste());
+ textInput->setReadOnly(false);
+ QVERIFY(textInput->canPaste());
+
// select word
textInput->setCursorPosition(0);
textInput->selectWord();
@@ -973,6 +981,7 @@ void tst_qdeclarativetextinput::copyAndPaste() {
QClipboard *clipboard = QApplication::clipboard();
QVERIFY(clipboard);
clipboard->clear();
+ QVERIFY(!textInput->canPaste());
// test that copy functionality is disabled
// when echo mode is set to hide text/password mode