6#include <QtCore/QObject>
7#include <QtTest/QtTest>
13#include <iser/CSerializableBase.h>
30 void cleanupTestCase();
33 void testProxyCreation();
34 void testSetModelPtr();
35 void testResetModel();
36 void testObserverAttachment();
39 void testModelSwitching();
40 void testNotificationForwarding();
41 void testObserverPersistenceAcrossSwitches();
42 void testDetachObserverFromProxy();
45 void testSwitchToNullModel();
46 void testMultipleObservers();
47 void testResetWithObservers();
51 class TestDataModel:
public iser::CSerializableBase
56 CF_VALUE_CHANGED = 0x1
59 TestDataModel(
int initialValue = 0) : m_value(initialValue) {}
61 void SetValue(
int value)
66 changeSet.Set(CF_VALUE_CHANGED);
67 BeginChanges(changeSet);
69 EndChanges(changeSet);
73 int GetValue()
const {
return m_value; }
76 virtual int GetSupportedOperations()
const override
84 TestDataModel* clone =
new TestDataModel(m_value);
91 const TestDataModel* other =
dynamic_cast<const TestDataModel*
>(&object);
94 m_value = other->m_value;
108 archive.SerializeValue(
"value", m_value);
120 TestObserver() : m_updateCount(0) {}
122 int GetUpdateCount()
const {
return m_updateCount; }
128 m_lastChangeSet.Clear();
134 m_lastChangeSet = changeSet;
147 TestObserver* m_observer;
Test class for CModelProxy functionality.
Implementation of the model proxy.
Basic implementation for a single model observer.
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Represents an input/output persistence archive for object serialization.
Set of change flags (its IDs).
Common interface for data model objects, which can be changed.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
@ SO_COPY
Copying from other object.
@ SO_RESET
Resetting of object state.
@ SO_CLONE
Creating of copy of this object.
Unique ownership smart pointer for interface types.