summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-11-27 09:00:05 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-11-27 09:00:05 (GMT)
commit137828d220a219fe0061afc56f2522e9e3d1ee79 (patch)
tree88ecd1e8c101c2ba19aea00075e3a123baf6a894 /tests/auto/qlineedit
parentbc2b222148648354fe15a6f8da9e01743a1e3e3f (diff)
parent19d0a365dd99dc1a108e58949f7d0f49bac72623 (diff)
downloadQt-137828d220a219fe0061afc56f2522e9e3d1ee79.zip
Qt-137828d220a219fe0061afc56f2522e9e3d1ee79.tar.gz
Qt-137828d220a219fe0061afc56f2522e9e3d1ee79.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 26294ac..9fe8e49 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -51,6 +51,10 @@
#include "qcompleter.h"
#include "qstandarditemmodel.h"
+#ifndef QT_NO_CLIPBOARD
+#include "qclipboard.h"
+#endif
+
#ifdef Q_WS_MAC
#include <Carbon/Carbon.h> // For the random function.
#include <cstdlib> // For the random function.
@@ -157,6 +161,10 @@ private slots:
void undo_keypressevents_data();
void undo_keypressevents();
+#ifndef QT_NO_CLIPBOARD
+ void QTBUG5786_undoPaste();
+#endif
+
void clear();
void text_data();
@@ -1408,6 +1416,36 @@ void tst_QLineEdit::undo_keypressevents()
QVERIFY(testWidget->text().isEmpty());
}
+#ifndef QT_NO_CLIPBOARD
+void tst_QLineEdit::QTBUG5786_undoPaste()
+{
+ QString initial("initial");
+ QString string("test");
+ QString additional("add");
+ QApplication::clipboard()->setText(string);
+ QLineEdit edit(initial);
+ QCOMPARE(edit.text(), initial);
+ edit.paste();
+ QCOMPARE(edit.text(), initial + string);
+ edit.paste();
+ QCOMPARE(edit.text(), initial + string + string);
+ edit.insert(additional);
+ QCOMPARE(edit.text(), initial + string + string + additional);
+ edit.undo();
+ QCOMPARE(edit.text(), initial + string + string);
+ edit.undo();
+ QCOMPARE(edit.text(), initial + string);
+ edit.undo();
+ QCOMPARE(edit.text(), initial);
+ edit.selectAll();
+ QApplication::clipboard()->setText(QString());
+ edit.paste();
+ QVERIFY(edit.text().isEmpty());
+
+}
+#endif
+
+
void tst_QLineEdit::clear()
{
// checking that clear of empty/nullstring doesn't add to undo history