56 static uint base_count=0;
60 return cnt == base_count + additional;
72 using LERR_(INVALID_PLACEMENTREF);
73 using LERR_(BOTTOM_MOBJECTREF);
82 ::Local<vault::test::MediaAccessMock>;
115 testClip1.chain (
Time(FSecs(10)));
116 testClip2.chain (
Time(FSecs(20)));
120 CHECK (2 == testClip1.use_count());
121 CHECK (2 == testClip2.use_count());
126 PMO& root = index->getRoot();
129 PMObj::ID clip1ID = index->insert (testClip1, root);
130 PMObj::ID clip2ID = index->insert (testClip2, root);
131 CHECK (2 == index->size());
136 PMObj& pClip1 = index->find(clip1ID);
137 PMObj& pClip2 = index->find(clip2ID);
139 CHECK (3 == pClip1.use_count());
140 CHECK (3 == pClip2.use_count());
141 checkUseCount(pClip1.use_count());
144 PMObj & rP1 (pClip1);
145 PMObj const& rP2 (pClip2);
146 PMObj::ID id1 = pClip1.
getID();
147 PMObj::Id<Clip> id2 = pClip2.recastID<
Clip>();
170 index->remove (pClip1);
171 index->remove (pClip2);
174 CHECK (0 == index->size());
175 CHECK (1 == index.use_count());
176 CHECK (2 == testClip1.use_count());
177 CHECK (2 == testClip2.use_count());
183 template<
typename REF>
191 cout << showSizeof(rMO) << endl;
200 PMedia media = rMO->getMedia();
201 cout << media << endl;
202 Duration mediaLength = media->getLength();
203 CHECK (!isnil (mediaLength));
207 CHECK (checkUseCount(rMO, 1));
216 CHECK (refP.isValid());
217 CHECK (refP.use_count() == rMO.
use_count());
218 CHECK (checkUseCount(refP, 1));
219 CHECK (&refP == placementAdr);
220 cout << refP << endl;
223 CHECK (exPla.
time == start);
224 CHECK (checkUseCount(refP, 2));
225 CHECK (checkUseCount(rMO, 2));
241 CHECK (!(rM == rC) and !(rC == rM));
242 CHECK ( (rM != rC) and (rC != rM));
245 CHECK ( (rM == pRef1) and (pRef1 == rM));
246 CHECK ( (rC == pRef2) and (pRef2 == rC));
247 CHECK (!(rM != pRef1) and !(pRef1 != rM));
248 CHECK (!(rC != pRef2) and !(pRef2 != rC));
249 CHECK ( (rM != pRef2) and (pRef2 != rM));
250 CHECK ( (rC != pRef1) and (pRef1 != rC));
251 CHECK (!(rM == pRef2) and !(pRef2 == rM));
252 CHECK (!(rC == pRef1) and !(pRef1 == rC));
254 CHECK ( (rM == p1.
getID()) );
255 CHECK ( (rC == p2.
getID()) );
256 CHECK (!(rM != p1.
getID()) );
257 CHECK (!(rC != p2.
getID()) );
258 CHECK ( (rM != p2.
getID()) );
259 CHECK ( (rC != p1.
getID()) );
260 CHECK (!(rM == p2.
getID()) );
261 CHECK (!(rC == p1.
getID()) );
265 CHECK ( (rM == rC) and (rC == rM));
266 CHECK (!(rM != rC) and !(rC != rM));
268 CHECK ( (rC == pRef1) and (pRef1 == rC));
269 CHECK (!(rC != pRef1) and !(pRef1 != rC));
270 CHECK ( (rC != pRef2) and (pRef2 != rC));
271 CHECK (!(rC == pRef2) and !(pRef2 == rC));
273 CHECK ( (rC == p1.
getID()) );
274 CHECK (!(rC != p1.
getID()) );
275 CHECK ( (rC != p2.
getID()) );
276 CHECK (!(rC == p2.
getID()) );
281 CHECK (!(rM == rC) and !(rC == rM));
282 CHECK ( (rM != rC) and (rC != rM));
284 CHECK (!(rM == pRef1) and !(pRef1 == rM));
285 CHECK ( (rM != pRef1) and (pRef1 != rM));
286 CHECK ( (rM != pRef2) and (pRef2 != rM));
287 CHECK (!(rM == pRef2) and !(pRef2 == rM));
289 CHECK (!(rM == p1.
getID()) );
290 CHECK ( (rM != p1.
getID()) );
291 CHECK ( (rM != p2.
getID()) );
292 CHECK (!(rM == p2.
getID()) );
299 CHECK (checkUseCount(p1, 0));
300 CHECK (checkUseCount(p2, 0));
308 CHECK (rMO->getMedia()->getFilename() ==
"test-1");
309 CHECK (checkUseCount(rMO, 1));
310 CHECK (checkUseCount(p1, 1));
311 CHECK (checkUseCount(p2, 0));
315 CHECK (rMO->getMedia()->getFilename() ==
"test-2");
316 CHECK (checkUseCount(rMO, 1));
317 CHECK (checkUseCount(p1, 0));
318 CHECK (checkUseCount(p2, 1));
321 CHECK (checkUseCount(rMO, 1));
325 CHECK (checkUseCount(p1, 0));
326 CHECK (checkUseCount(p2, 0));
339 CHECK (not rMObj.use_count());
343 rMObj.activate(luid);
344 CHECK (checkUseCount(rMObj, 1));
349 CHECK (checkUseCount(rMObj, 2));
350 CHECK (checkUseCount(rClip, 2));
357 CHECK (rMObj->isValid());
359 CHECK (rMObj.getPlacement().getID() == rClip.
getPlacement().getID());
365 CHECK (checkUseCount(rMObj, 1));
370 CHECK (checkUseCount(rMObj, 2));
371 CHECK (checkUseCount(rClip, 2));
373 cout << rClip << endl;
374 cout << rClip->getMedia()->ident << endl;
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
void close()
deactivate this handle, so it isn't tied any longer to the associated implementation or service objec...
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Duration is the internal Lumiera time metric.
Lumiera's internal time value datatype.
Special kind of Placement, where the location of the MObject has been nailed down to a fixed position...
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
MORef & activate(Placement< MO > const &placement)
activate an MObject reference, based on an existing placement, which needs to be contained (added to)...
lib::time::Time getStartTime()
resolves the referred placement to an ExplicitPlacement and returns the found start time
Placement< MO > & getPlacement() const
bool isCompatible() const
MObject is the interface class for all "Media Objects".
virtual bool isValid() const =0
MObject self-test (usable for asserting)
Reference tag denoting a placement attached to the session.
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
A user visible/editable Clip is a reference to a contiguous sequence of media data loaded as Asset in...
there is an implicit PlacementIndex available on a global level, by default implemented within the cu...
static PPIdx install()
Re-define the implicit PlacementIndex temporarily, e.g.
TestPlacement< TestSubMO1 > PSub1
void checkBuildMObjectRef(REF &refObj, void *placementAdr)
void checkLifecycle(PMObj const &p1, PMObj const &p2)
Placement< MObject > PMObj
void checkTypeHandling(LumieraUid luid)
void checkComparison(PMO const &p1, PMO const &p2)
Per type specific configuration of instances created as service dependencies.
Core abstraction: completely resolved placement of an MObject Within the session model,...
External MObject/Placement reference.
MObject in the Session to represent a clip on the timeline.
Core abstraction of the Session model: a media object.
string showSizeof(size_t siz, string name)
for printing sizeof().
boost::rational< int64_t > FSecs
rational representation of fractional seconds
std::shared_ptr< PlacementIndex > PPIdx
bool checkUseCount(size_t cnt, uint additional=0)
lib::DependInject< vault::MediaAccessFacade > ::Local< vault::test::MediaAccessMock > MediaAccessMock
MORef< MObject > MObjectRef
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Core of the session implementation datastructure.
A generic reference mechanism for Placements, as added to the current session.
Core abstraction: placement of a media object into session context.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Implementation level session API: PlacementIndex mock for tests.
Subclass-1 is not defined "processible", thus will always be handled as DummyMO...
A hierarchy of simple dummy-Media-Objects for easy unit testing.
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
a family of time value like entities and their relationships.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...