diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-26 07:31:45 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-26 07:33:18 (GMT) |
commit | 4806174aeff4d7c600f6be20649153bf0e997953 (patch) | |
tree | 649e174728f5324595ad31fb3b5fbb49171c030b /tests/auto | |
parent | 82917af38936d4ea33bc7fd2310c1361ebf2ac73 (diff) | |
download | Qt-4806174aeff4d7c600f6be20649153bf0e997953.zip Qt-4806174aeff4d7c600f6be20649153bf0e997953.tar.gz Qt-4806174aeff4d7c600f6be20649153bf0e997953.tar.bz2 |
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')
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 1616154..93aa64c 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; |