Skip to content

Commit

Permalink
tst_qitemmodel: do not pass illegal indices to QAbstractItemModel APIs
Browse files Browse the repository at this point in the history
That's undefined behavior, so don't test it.

Change-Id: I468637ff1835f4f50859ac3d9876463221a3285a
Reviewed-by: David Faure <[email protected]>
  • Loading branch information
dangelog committed Nov 24, 2017
1 parent bd72950 commit 77a7b5c
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,6 @@ void tst_QItemModel::data()
// A valid index should have a valid qvariant data
QVERIFY(currentModel->index(0,0).isValid());

// shouldn't be able to set data on an invalid index
QCOMPARE(currentModel->setData(QModelIndex(), "foo", Qt::DisplayRole), false);

// General Purpose roles
QVariant variant = currentModel->data(currentModel->index(0,0), Qt::ToolTipRole);
if (variant.isValid()) {
Expand Down Expand Up @@ -605,7 +602,6 @@ void tst_QItemModel::setData()
QVERIFY(currentModel);
QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged);
QVERIFY(spy.isValid());
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
QCOMPARE(spy.count(), 0);

QFETCH(bool, isEmpty);
Expand Down

0 comments on commit 77a7b5c

Please sign in to comment.