summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-26 09:31:45 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-26 09:33:18 +0200
commit4806174aeff4d7c600f6be20649153bf0e997953 (patch)
tree649e174728f5324595ad31fb3b5fbb49171c030b /tests/auto/qlineedit
parent82917af38936d4ea33bc7fd2310c1361ebf2ac73 (diff)
QLineEdit: reenable the delete action from the context menu
We now need to connect to the slot in the QLineControl and not to the slot of the QLineEdit (the QLineEdit slot is now also removed). Reviewed-by: Alan Alpert
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 1616154598..93aa64c4cc 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -190,6 +190,7 @@ private slots:
void selectedText();
void hasSelectedText();
+ void deleteSelectedText();
void textChangedAndTextEdited();
void returnPressed();
@@ -2054,6 +2055,32 @@ void tst_QLineEdit::hasSelectedText()
DEPENDS_ON("selectedText");
}
+void tst_QLineEdit::deleteSelectedText()
+{
+ const QString text = QString::fromLatin1("bar");
+ QLineEdit edit( text );
+ QCOMPARE(edit.text(), text);
+
+ edit.selectAll();
+
+ QTest::keyClick(&edit, Qt::Key_Delete, 0);
+ QVERIFY(edit.text().isEmpty());
+
+ edit.setText(text);
+ edit.selectAll();
+
+ QMenu *menu = edit.createStandardContextMenu();
+ for (int i = 0; i < menu->actions().count(); ++i) {
+ QAction *current = menu->actions().at(i);
+ if (current->text() == QLineEdit::tr("Delete")) {
+ current->trigger(); //this will delete the whole text selected
+ QVERIFY(edit.text().isEmpty());
+ }
+ }
+
+}
+
+
void tst_QLineEdit::textChangedAndTextEdited()
{
changed_count = 0;