29 void cleanupTestCase();
32 void testAttachMultipleModels();
33 void testDetachModel();
34 void testEnsureModelsDetached();
35 void testGetModelCount();
36 void testGetObservedModel();
37 void testIsModelAttached();
40 void testOnUpdateFromMultipleModels();
41 void testChangeSetFiltering();
42 void testSetObservedIds();
45 void testAttachSameModelMultipleTimes();
46 void testDetachNonAttachedModel();
47 void testUpdateAfterPartialDetach();
51 class TestDataModel:
public iser::CSerializableBase
56 CF_VALUE_CHANGED = 0x1,
57 CF_STATE_CHANGED = 0x2
60 TestDataModel() : m_value(0), m_state(0) {}
62 void SetValue(
int value)
67 changeSet.Set(CF_VALUE_CHANGED);
68 BeginChanges(changeSet);
70 EndChanges(changeSet);
74 int GetValue()
const {
return m_value; }
76 void SetState(
int state)
81 changeSet.Set(CF_STATE_CHANGED);
82 BeginChanges(changeSet);
84 EndChanges(changeSet);
88 int GetState()
const {
return m_state; }
91 virtual int GetSupportedOperations()
const override
99 TestDataModel* clone =
new TestDataModel();
100 clone->m_value = m_value;
101 clone->m_state = m_state;
108 const TestDataModel* other =
dynamic_cast<const TestDataModel*
>(&object);
111 m_value = other->m_value;
112 m_state = other->m_state;
127 archive.SerializeValue(
"value", m_value);
128 archive.SerializeValue(
"state", m_state);
141 TestObserver() : m_updateCount(0) {}
143 int GetUpdateCount()
const {
return m_updateCount; }
144 imod::IModel* GetLastUpdatedModel()
const {
return m_lastUpdatedModel; }
150 m_lastUpdatedModel =
nullptr;
151 m_lastChangeSet.Clear();
161 const QVector<UpdateRecord>& GetUpdateHistory()
const {
return m_updateHistory; }
165 m_updateHistory.clear();
172 m_lastUpdatedModel = modelPtr;
173 m_lastChangeSet = changeSet;
176 record.model = modelPtr;
177 record.changeSet = changeSet;
178 m_updateHistory.append(record);
185 QVector<UpdateRecord> m_updateHistory;
193 TestObserver* m_observer;