diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2011-03-07 05:58:17 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2011-03-07 06:16:33 (GMT) |
commit | 88c4bd4d5fc25a58d3b71c540acd6f2484c3a9a3 (patch) | |
tree | 36790c7f5f7c474345f7c694b2ee49b809a8d135 /tests/auto/declarative/qdeclarativetextedit | |
parent | 5ead7e7ddd5430b6a0b5597754f13583b653d67b (diff) | |
download | Qt-88c4bd4d5fc25a58d3b71c540acd6f2484c3a9a3.zip Qt-88c4bd4d5fc25a58d3b71c540acd6f2484c3a9a3.tar.gz Qt-88c4bd4d5fc25a58d3b71c540acd6f2484c3a9a3.tar.bz2 |
Set correct initial value for TextEdit and TextInput canPaste property
Change-Id: Ied5b257305fa68db64fcf270ad2a42f691fbdca2
Task-number: QTBUG-17765
Reviewed-by: Martin Jones
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index dc1063f..e26077c 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -130,6 +130,8 @@ private slots: void navigation(); void readOnly(); void copyAndPaste(); + void canPaste(); + void canPasteEmpty(); void textInput(); void openInputPanelOnClick(); void openInputPanelOnFocus(); @@ -1545,6 +1547,42 @@ void tst_qdeclarativetextedit::copyAndPaste() { #endif } +void tst_qdeclarativetextedit::canPaste() { +#ifndef QT_NO_CLIPBOARD + + QApplication::clipboard()->setText("Some text"); + + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"Hello world!\" }"; + QDeclarativeComponent textEditComponent(&engine); + textEditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEdit = qobject_cast<QDeclarativeTextEdit*>(textEditComponent.create()); + QVERIFY(textEdit != 0); + + // check initial value - QTBUG-17765 + QTextControl tc; + QCOMPARE(textEdit->canPaste(), tc.canPaste()); + +#endif +} + +void tst_qdeclarativetextedit::canPasteEmpty() { +#ifndef QT_NO_CLIPBOARD + + QApplication::clipboard()->clear(); + + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"Hello world!\" }"; + QDeclarativeComponent textEditComponent(&engine); + textEditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEdit = qobject_cast<QDeclarativeTextEdit*>(textEditComponent.create()); + QVERIFY(textEdit != 0); + + // check initial value - QTBUG-17765 + QTextControl tc; + QCOMPARE(textEdit->canPaste(), tc.canPaste()); + +#endif +} + void tst_qdeclarativetextedit::readOnly() { QDeclarativeView *canvas = createView(SRCDIR "/data/readOnly.qml"); |