QStandardItemModel: extend the test coverage for property bindings

The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I360614a40fe2bacb796051607ed67e7e666b4f22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Ivan Solovev 2023-08-28 13:07:22 +02:00
parent 7d70edd31c
commit ac59fcdab8
2 changed files with 5 additions and 0 deletions

View File

@ -20,4 +20,5 @@ qt_internal_add_test(tst_qstandarditemmodel
Qt::GuiPrivate
Qt::Widgets
Qt::WidgetsPrivate
Qt::TestPrivate
)

View File

@ -10,6 +10,7 @@
#include <QAbstractItemModelTester>
#include <private/qabstractitemmodel_p.h>
#include <private/qpropertytesthelper_p.h>
#include <private/qtreeview_p.h>
#include <algorithm>
@ -902,6 +903,9 @@ void tst_QStandardItemModel::sortRoleBindings()
sortRoleObserver.setBinding([&] { return model.sortRole(); });
model.setSortRole(Qt::EditRole);
QCOMPARE(sortRoleObserver, Qt::EditRole);
QTestPrivate::testReadWritePropertyBasics(model, static_cast<int>(Qt::DisplayRole),
static_cast<int>(Qt::EditRole), "sortRole");
}
void tst_QStandardItemModel::findItems()