summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcompleter/tst_qcompleter.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-20 12:16:58 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 10:46:41 +1000
commite1f221118841f80072f3d2223906a6dc21038148 (patch)
tree50c7dfa7dc9c5b66ed81aafddb8720156fbb2f0a /tests/auto/qcompleter/tst_qcompleter.cpp
parent50fd0092db7b3de82fc017f1885cb0d4fdfed205 (diff)
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 (cherry picked from commit a5bd4abed834ce3670b2f28d4f932d612a033b36)
Diffstat (limited to 'tests/auto/qcompleter/tst_qcompleter.cpp')
-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 1bb21eb788..1a052d59b7 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -1280,10 +1280,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()); }
@@ -1292,6 +1293,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");