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)bb10
parent
50fd0092db
commit
e1f2211188
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue