summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-04 18:06:04 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-04 18:17:16 (GMT)
commit8e01aa83880bf9cc669106f1e219abd3b3fca186 (patch)
treef37dc8353e6a90f18446b793436caad18079dd29 /tests/auto
parenta22f422b20299a501c307b21a6095ece87749124 (diff)
downloadQt-8e01aa83880bf9cc669106f1e219abd3b3fca186.zip
Qt-8e01aa83880bf9cc669106f1e219abd3b3fca186.tar.gz
Qt-8e01aa83880bf9cc669106f1e219abd3b3fca186.tar.bz2
Fixed bug where Q[Styled]ItemDelegate edition wouldn't terminate when
the item lost focus to an unrelated dialog. The tests against the active modal window was unnecessary. Task-number: 257859 Reviewed-by: olivier
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
index 65dd86f..6714de3 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -61,6 +61,7 @@
#include <QAbstractItemDelegate>
#include <QTextEdit>
#include <QPlainTextEdit>
+#include <QDialog>
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
@@ -230,6 +231,8 @@ private slots:
void editorEvent();
void enterKey_data();
void enterKey();
+
+ void task257859_finalizeEdit();
};
@@ -1124,6 +1127,36 @@ void tst_QItemDelegate::enterKey()
QCOMPARE(editor && editor->hasFocus(), expectedFocus);
}
+void tst_QItemDelegate::task257859_finalizeEdit()
+{
+ QStandardItemModel model;
+ model.appendRow(new QStandardItem());
+
+ QListView view;
+ view.setModel(&model);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ view.setFocus();
+ QTest::qWait(30);
+
+ QModelIndex index = model.index(0, 0);
+ view.edit(index);
+ QTest::qWait(30);
+
+ QList<QWidget*> lineEditors = qFindChildren<QWidget *>(view.viewport());
+ QCOMPARE(lineEditors.count(), 1);
+
+ QPointer<QWidget> editor = lineEditors.at(0);
+ QCOMPARE(editor->hasFocus(), true);
+
+ QDialog dialog;
+ QTimer::singleShot(100, &dialog, SLOT(close()));
+ dialog.exec();
+
+ QTest::qWait(10);
+
+ QVERIFY(!editor);
+}
// ### _not_ covered: