summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-10-12 04:35:22 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-10-12 04:35:22 (GMT)
commite4dbf0c82b46e7a32e21185c8f633506229be944 (patch)
treee48e2f3aa5ae8f6e1116c3ba8f14f6ea8c0d2921 /tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
parent80979c559d5b6fc677989e077c9890943dac054f (diff)
downloadQt-e4dbf0c82b46e7a32e21185c8f633506229be944.zip
Qt-e4dbf0c82b46e7a32e21185c8f633506229be944.tar.gz
Qt-e4dbf0c82b46e7a32e21185c8f633506229be944.tar.bz2
Bug: TextEdit ignores plain text format when pasting text
Task-number: QTBUG-14003 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 472c5ef..a7971cc 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -56,6 +56,8 @@
#include <QDir>
#include <QStyle>
#include <QInputContext>
+#include <QClipboard>
+#include <QMimeData>
#include <private/qapplication_p.h>
#include <private/qtextcontrol_p.h>
@@ -119,6 +121,8 @@ private slots:
void openInputPanelOnClick();
void openInputPanelOnFocus();
void geometrySignals();
+ void pastingRichText_QTBUG_14003();
+
private:
void simulateKey(QDeclarativeView *, int key);
QDeclarativeView *createView(const QString &filename);
@@ -1174,6 +1178,27 @@ void tst_qdeclarativetextedit::geometrySignals()
delete o;
}
+void tst_qdeclarativetextedit::pastingRichText_QTBUG_14003()
+{
+#ifndef QT_NO_CLIPBOARD
+ QString componentStr = "import QtQuick 1.0\nTextEdit { textFormat: TextEdit.PlainText }";
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeTextEdit *obj = qobject_cast<QDeclarativeTextEdit*>(component.create());
+
+ QTRY_VERIFY(obj != 0);
+ QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText);
+
+ QMimeData *mData = new QMimeData;
+ mData->setHtml("<font color=\"red\">Hello</font>");
+ QApplication::clipboard()->setMimeData(mData);
+
+ obj->paste();
+ QTRY_VERIFY(obj->text() == "");
+ QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText);
+#endif
+}
+
QTEST_MAIN(tst_qdeclarativetextedit)
#include "tst_qdeclarativetextedit.moc"