summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-08-07 14:23:18 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-07 18:21:23 +0200
commitcffd1633b267d0034627756296e61abcc0ef50be (patch)
tree37112b494d79663afcdd946169201a4793e7e6bd /tests
parente6218ecfb55d67397331213663043e9fb71fcdb8 (diff)
Fix QCompleter::activated(QModelIndex)
When falling back to the completion prefix, make sure to also pass an invalid index to activated(). Change-Id: I6b282a01c95492466890632b77837bcc96eb038a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 0f7993540c..3a6fca7146 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -1305,10 +1305,15 @@ void tst_QCompleter::task246056_setCompletionPrefix()
comboBox.show();
QApplication::setActiveWindow(&comboBox);
QVERIFY(QTest::qWaitForWindowActive(&comboBox));
+ QSignalSpy spy(comboBox.completer(), SIGNAL(activated(QModelIndex)));
QTest::keyPress(&comboBox, 'a');
QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down);
QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down);
QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Enter); // don't crash!
+ QCOMPARE(spy.count(), 1);
+ QList<QVariant> arguments = spy.at(0);
+ QModelIndex index = arguments.at(0).value<QModelIndex>();
+ QVERIFY(!index.isValid());
}
class task250064_TextEdit : public QTextEdit