Skip to content
Snippets Groups Projects
Commit 6efa62d5 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Testing layoutChanged signal in ComponentProxyModel.

parent 7bf150b0
No related branches found
No related tags found
No related merge requests found
...@@ -171,7 +171,6 @@ void ComponentProxyModel::sourceRowsInserted(const QModelIndex& parent, int star ...@@ -171,7 +171,6 @@ void ComponentProxyModel::sourceRowsInserted(const QModelIndex& parent, int star
qDebug() << "ComponentProxyModel::sourceRowsInserted"; qDebug() << "ComponentProxyModel::sourceRowsInserted";
buildModelMap(); buildModelMap();
layoutChanged();
} }
//! Main method to build the map of persistent indeses. //! Main method to build the map of persistent indeses.
...@@ -197,4 +196,5 @@ void ComponentProxyModel::buildModelMap() ...@@ -197,4 +196,5 @@ void ComponentProxyModel::buildModelMap()
// qDebug() << " "; // qDebug() << " ";
}); });
layoutChanged();
} }
...@@ -19,6 +19,7 @@ private slots: ...@@ -19,6 +19,7 @@ private slots:
void test_setModelWithVector(); void test_setModelWithVector();
void test_displayRole(); void test_displayRole();
void test_setData(); void test_setData();
void test_insertRows();
}; };
//! Empty proxy model. //! Empty proxy model.
...@@ -187,3 +188,24 @@ inline void TestComponentProxyModel::test_setData() ...@@ -187,3 +188,24 @@ inline void TestComponentProxyModel::test_setData()
QCOMPARE(model.data(model.index(0, 1, QModelIndex()), Qt::DisplayRole).toDouble(), 3.0); QCOMPARE(model.data(model.index(0, 1, QModelIndex()), Qt::DisplayRole).toDouble(), 3.0);
QCOMPARE(proxy.data(proxy.index(0, 1, QModelIndex()), Qt::DisplayRole).toDouble(), 3.0); QCOMPARE(proxy.data(proxy.index(0, 1, QModelIndex()), Qt::DisplayRole).toDouble(), 3.0);
} }
//! Checks norification of proxy model then source inserts rows.
inline void TestComponentProxyModel::test_insertRows()
{
SessionModel model("TestModel");
ComponentProxyModel proxy;
proxy.setSessionModel(&model);
QVERIFY(model.hasChildren(QModelIndex()) == false);
QVERIFY(proxy.hasChildren(QModelIndex()) == false);
QSignalSpy spyProxy(&proxy, &ComponentProxyModel::layoutChanged);
// inserting item in the source
model.insertNewItem(Constants::PropertyType);
QCOMPARE(spyProxy.count(), 1);
QCOMPARE(proxy.rowCount(QModelIndex()), 1);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment