// public void setSourceModel(QAbstractItemModel* sourceModel) void tst_QAbstractProxyModel::setSourceModel() { //QFETCH(int, sourceModelCount); SubQAbstractProxyModel model; QStandardItemModel *sourceModel = new QStandardItemModel(&model); model.setSourceModel(sourceModel); QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(sourceModel)); QStandardItemModel *sourceModel2 = new QStandardItemModel(&model); model.setSourceModel(sourceModel2); QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(sourceModel2)); delete sourceModel2; QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(0)); }
// public void setSourceModel(QAbstractItemModel* sourceModel) void tst_QAbstractProxyModel::setSourceModel() { qRegisterMetaType<QAbstractItemModel*>(); SubQAbstractProxyModel model; QCOMPARE(model.property("sourceModel"), QVariant::fromValue<QAbstractItemModel*>(0)); QStandardItemModel *sourceModel = new QStandardItemModel(&model); model.setSourceModel(sourceModel); QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(sourceModel)); QCOMPARE(model.property("sourceModel").value<QObject*>(), static_cast<QObject*>(sourceModel)); QCOMPARE(model.property("sourceModel").value<QAbstractItemModel*>(), sourceModel); QStandardItemModel *sourceModel2 = new QStandardItemModel(&model); model.setSourceModel(sourceModel2); QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(sourceModel2)); QCOMPARE(model.property("sourceModel").value<QObject*>(), static_cast<QObject*>(sourceModel2)); QCOMPARE(model.property("sourceModel").value<QAbstractItemModel*>(), sourceModel2); delete sourceModel2; QCOMPARE(model.sourceModel(), static_cast<QAbstractItemModel*>(0)); }
void tst_QAbstractProxyModel::qabstractproxymodel() { SubQAbstractProxyModel model; model.data(QModelIndex()); model.flags(QModelIndex()); model.headerData(0, Qt::Vertical, 0); model.itemData(QModelIndex()); model.mapFromSource(QModelIndex()); model.mapSelectionFromSource(QItemSelection()); model.mapSelectionToSource(QItemSelection()); model.mapToSource(QModelIndex()); model.revert(); model.setSourceModel(0); QCOMPARE(model.sourceModel(), (QAbstractItemModel*)0); model.submit(); }