summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcompleter
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-20 02:16:58 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-04-20 05:09:34 (GMT)
commita5bd4abed834ce3670b2f28d4f932d612a033b36 (patch)
tree121736f39ee84c9ea7b5c98c8aaa2f343cbe107d /tests/auto/qcompleter
parent67bc4990f7541cca089882a8c3be1b2b8d98cd4c (diff)
downloadQt-a5bd4abed834ce3670b2f28d4f932d612a033b36.zip
Qt-a5bd4abed834ce3670b2f28d4f932d612a033b36.tar.gz
Qt-a5bd4abed834ce3670b2f28d4f932d612a033b36.tar.bz2
Remove Q_ASSERT from QCompleter autotest
If a combobox had no completer, this test would assert in a debug build and crash in a release build. This commit makes the test report a test failure and avoid terminating in all builds. Change-Id: Ib2924412e3d55f10875675cb65079259cd4ef552 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qcompleter')
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index 9cb2468..b0d40d0 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -1278,10 +1278,11 @@ public:
{
setEditable(true);
setInsertPolicy(NoInsert);
- Q_ASSERT(completer());
- completer()->setCompletionMode(QCompleter::PopupCompletion);
- completer()->setCompletionRole(Qt::DisplayRole);
- connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
+ if (completer()) {
+ completer()->setCompletionMode(QCompleter::PopupCompletion);
+ completer()->setCompletionRole(Qt::DisplayRole);
+ connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
+ }
}
private slots:
void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); }
@@ -1290,6 +1291,7 @@ private slots:
void tst_QCompleter::task246056_setCompletionPrefix()
{
task246056_ComboBox *comboBox = new task246056_ComboBox;
+ QVERIFY(comboBox->completer());
comboBox->addItem("");
comboBox->addItem("a1");
comboBox->addItem("a2");