48 using lib::test::showSizeof;
63 checkUseCount (
size_t cnt, uint additional=0)
65 static uint base_count=0;
69 return cnt == base_count + additional;
74 checkUseCount (REF
const& ref, uint additional)
76 return checkUseCount(ref.use_count(), additional);
81 using LERR_(INVALID_PLACEMENTREF);
82 using LERR_(BOTTOM_MOBJECTREF);
91 ::Local<vault::test::MediaAccessMock>;
116 MediaAccessMock useMockMedia;
124 testClip1.chain (
Time(FSecs(10)));
125 testClip2.chain (
Time(FSecs(20)));
129 CHECK (2 == testClip1.use_count());
130 CHECK (2 == testClip2.use_count());
135 PMO& root = index->getRoot();
138 PMObj::ID clip1ID = index->insert (testClip1, root);
139 PMObj::ID clip2ID = index->insert (testClip2, root);
140 CHECK (2 == index->size());
145 PMObj& pClip1 = index->find(clip1ID);
146 PMObj& pClip2 = index->find(clip2ID);
148 CHECK (3 == pClip1.use_count());
149 CHECK (3 == pClip2.use_count());
150 checkUseCount(pClip1.use_count());
153 PMObj & rP1 (pClip1);
154 PMObj
const& rP2 (pClip2);
155 PMObj::ID id1 = pClip1.getID();
156 PMObj::Id<Clip> id2 = pClip2.recastID<
Clip>();
157 LumieraUid luid = id1.get();
164 checkBuildMObjectRef (rP1, &pClip1);
165 checkBuildMObjectRef (rP2, &pClip2);
166 checkBuildMObjectRef (id1, &pClip1);
167 checkBuildMObjectRef (id2, &pClip2);
168 checkBuildMObjectRef (luid, &pClip1);
170 checkBuildMObjectRef (ref1, &pClip1);
171 checkBuildMObjectRef (ref2, &pClip2);
173 checkComparison(rP1,rP2);
174 checkLifecycle (rP1,rP2);
175 checkTypeHandling (luid);
179 index->remove (pClip1);
180 index->remove (pClip2);
183 CHECK (0 == index->size());
184 CHECK (1 == index.use_count());
185 CHECK (2 == testClip1.use_count());
186 CHECK (2 == testClip2.use_count());
192 template<
typename REF>
194 checkBuildMObjectRef (REF& refObj,
void* placementAdr)
198 CHECK (0==rMO.use_count());
200 cout << showSizeof(rMO) << endl;
209 PMedia media = rMO->getMedia();
210 cout << media << endl;
211 Duration mediaLength = media->getLength();
212 CHECK (!isnil (mediaLength));
213 CHECK (rMO->isValid());
216 CHECK (checkUseCount(rMO, 1));
218 CHECK ( rMO.isCompatible<
MObject>());
219 CHECK ( rMO.isCompatible<
Clip>());
225 CHECK (refP.isValid());
226 CHECK (refP.use_count() == rMO.use_count());
227 CHECK (checkUseCount(refP, 1));
228 CHECK (&refP == placementAdr);
229 cout << refP << endl;
232 CHECK (exPla.time == start);
233 CHECK (checkUseCount(refP, 2));
234 CHECK (checkUseCount(rMO, 2));
239 checkComparison (
PMO const& p1,
PMO const& p2)
250 CHECK (!(rM == rC) && !(rC == rM));
251 CHECK ( (rM != rC) && (rC != rM));
254 CHECK ( (rM == pRef1) && (pRef1 == rM));
255 CHECK ( (rC == pRef2) && (pRef2 == rC));
256 CHECK (!(rM != pRef1) && !(pRef1 != rM));
257 CHECK (!(rC != pRef2) && !(pRef2 != rC));
258 CHECK ( (rM != pRef2) && (pRef2 != rM));
259 CHECK ( (rC != pRef1) && (pRef1 != rC));
260 CHECK (!(rM == pRef2) && !(pRef2 == rM));
261 CHECK (!(rC == pRef1) && !(pRef1 == rC));
263 CHECK ( (rM == p1.
getID()) );
264 CHECK ( (rC == p2.
getID()) );
265 CHECK (!(rM != p1.
getID()) );
266 CHECK (!(rC != p2.
getID()) );
267 CHECK ( (rM != p2.
getID()) );
268 CHECK ( (rC != p1.
getID()) );
269 CHECK (!(rM == p2.
getID()) );
270 CHECK (!(rC == p1.
getID()) );
274 CHECK ( (rM == rC) && (rC == rM));
275 CHECK (!(rM != rC) && !(rC != rM));
277 CHECK ( (rC == pRef1) && (pRef1 == rC));
278 CHECK (!(rC != pRef1) && !(pRef1 != rC));
279 CHECK ( (rC != pRef2) && (pRef2 != rC));
280 CHECK (!(rC == pRef2) && !(pRef2 == rC));
282 CHECK ( (rC == p1.
getID()) );
283 CHECK (!(rC != p1.
getID()) );
284 CHECK ( (rC != p2.
getID()) );
285 CHECK (!(rC == p2.
getID()) );
290 CHECK (!(rM == rC) && !(rC == rM));
291 CHECK ( (rM != rC) && (rC != rM));
293 CHECK (!(rM == pRef1) && !(pRef1 == rM));
294 CHECK ( (rM != pRef1) && (pRef1 != rM));
295 CHECK ( (rM != pRef2) && (pRef2 != rM));
296 CHECK (!(rM == pRef2) && !(pRef2 == rM));
298 CHECK (!(rM == p1.
getID()) );
299 CHECK ( (rM != p1.
getID()) );
300 CHECK ( (rM != p2.
getID()) );
301 CHECK (!(rM == p2.
getID()) );
306 checkLifecycle (PMObj
const& p1, PMObj
const& p2)
308 CHECK (checkUseCount(p1, 0));
309 CHECK (checkUseCount(p2, 0));
313 CHECK (0 == rMO.use_count());
317 CHECK (rMO->getMedia()->getFilename() ==
"test-1");
318 CHECK (checkUseCount(rMO, 1));
319 CHECK (checkUseCount(p1, 1));
320 CHECK (checkUseCount(p2, 0));
324 CHECK (rMO->getMedia()->getFilename() ==
"test-2");
325 CHECK (checkUseCount(rMO, 1));
326 CHECK (checkUseCount(p1, 0));
327 CHECK (checkUseCount(p2, 1));
330 CHECK (checkUseCount(rMO, 1));
334 CHECK (checkUseCount(p1, 0));
335 CHECK (checkUseCount(p2, 0));
342 checkTypeHandling (LumieraUid luid)
348 CHECK ( ! rMObj.use_count());
349 CHECK ( ! rClip.use_count());
350 CHECK ( ! rSub1.use_count());
353 CHECK (checkUseCount(rMObj, 1));
354 CHECK ( ! rClip.use_count());
355 CHECK ( ! rSub1.use_count());
358 CHECK (checkUseCount(rMObj, 2));
359 CHECK (checkUseCount(rClip, 2));
360 CHECK ( ! rSub1.use_count());
366 CHECK (rMObj->isValid());
367 CHECK (rClip->isValid());
368 CHECK (rMObj.getPlacement().getID() == rClip.getPlacement().
getID());
374 CHECK (checkUseCount(rMObj, 1));
375 CHECK ( ! rClip.use_count());
379 CHECK (checkUseCount(rMObj, 2));
380 CHECK (checkUseCount(rClip, 2));
382 cout << rClip << endl;
383 cout << rClip->getMedia()->ident << endl;
Reference tag denoting a placement attached to the session.
Subclass-1 is not defined "processible", thus will always be handled as DummyMO...
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
Core abstraction: completely resolved placement of an MObject Within the session model, all media objects are attached with the help of mobject::Placement elements.
Core abstraction: placement of a media object into session context.
Special kind of Placement, where the location of the MObject has been nailed down to a fixed position...
Per type specific configuration of instances created as service dependencies.
MObject in the Session to represent a clip on the timeline.
lib::time::Time getStartTime()
resolves the referred placement to an ExplicitPlacement and returns the found start time ...
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Core abstraction of the Session model: a media object.
A user visible/editable Clip is a reference to a contiguous sequence of media data loaded as Asset in...
Steam-Layer implementation namespace root.
Lumiera's internal time value datatype.
MObject is the interface class for all "Media Objects".
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
External MObject/Placement reference.
Core of the session implementation datastructure.
Simple test class runner.
there is an implicit PlacementIndex available on a global level, by default implemented within the cu...
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
A collection of frequently used helper functions to support unit testing.
void close()
deactivate this handle, so it isn't tied any longer to the associated implementation or service objec...
A hierarchy of simple dummy-Media-Objects for easy unit testing.
Implementation level session API: PlacementIndex mock for tests.
A generic reference mechanism for Placements, as added to the current session.
Duration is the internal Lumiera time metric.
MORef & activate(Placement< MO > const &placement)
activate an MObject reference, based on an existing placement, which needs to be contained (added to)...
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
virtual bool isValid() const =0
MObject self-test (usable for asserting)
static PPIdx install()
Re-define the implicit PlacementIndex temporarily, e.g.
a family of time value like entities and their relationships.