Q(Persistent)ModelIndex: use new test framework for op==
All good, except missing noexcept. Can't test ordered relational operators because the classes provide only op<, not the full set, so this has to wait until we port Q*ModelIndex to the new comparison framework. Change-Id: I05e26c88f0bd8c035ef0461c7c50b218c513da08 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
bfb237d19a
commit
9bccfb56c2
@ -19,4 +19,5 @@ qt_internal_add_test(tst_qabstractitemmodel
|
||||
../../../other/qabstractitemmodelutils
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::TestPrivate
|
||||
)
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <QTest>
|
||||
|
||||
#include <QtTest/private/qcomparisontesthelper_p.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <QtCore/QStringListModel>
|
||||
@ -56,6 +58,7 @@ private slots:
|
||||
void reset();
|
||||
|
||||
void complexChangesWithPersistent();
|
||||
void modelIndexComparisons();
|
||||
|
||||
void testMoveSameParentUp_data();
|
||||
void testMoveSameParentUp();
|
||||
@ -984,6 +987,33 @@ void tst_QAbstractItemModel::complexChangesWithPersistent()
|
||||
QVERIFY(e[i] == model.index(2, i-2 , QModelIndex()));
|
||||
}
|
||||
|
||||
void tst_QAbstractItemModel::modelIndexComparisons()
|
||||
{
|
||||
QTestPrivate::testEqualityOperatorsCompile<QModelIndex>();
|
||||
QTestPrivate::testEqualityOperatorsCompile<QPersistentModelIndex>();
|
||||
QTestPrivate::testEqualityOperatorsCompile<QPersistentModelIndex, QModelIndex>();
|
||||
|
||||
QtTestModel model(3, 3);
|
||||
|
||||
QModelIndex mi11 = model.index(1, 1);
|
||||
QModelIndex mi22 = model.index(2, 2);
|
||||
QPersistentModelIndex pmi11 = mi11;
|
||||
QPersistentModelIndex pmi22 = mi22;
|
||||
|
||||
QTestPrivate::testEqualityOperators(mi11, mi11, true);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
QTestPrivate::testEqualityOperators(mi11, mi22, false);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
QTestPrivate::testEqualityOperators(pmi11, pmi11, true);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
QTestPrivate::testEqualityOperators(pmi11, pmi22, false);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
QTestPrivate::testEqualityOperators(pmi11, mi11, true);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
QTestPrivate::testEqualityOperators(pmi11, mi22, false);
|
||||
if (QTest::currentTestFailed()) return;
|
||||
}
|
||||
|
||||
void tst_QAbstractItemModel::testMoveSameParentDown_data()
|
||||
{
|
||||
QTest::addColumn<int>("startRow");
|
||||
|
Loading…
x
Reference in New Issue
Block a user