39 using lib::test::showSizeof;
54 checkUseCount (
size_t cnt, uint additional=0)
56 static uint base_count=0;
60 return cnt == base_count + additional;
65 checkUseCount (REF
const& ref, uint additional)
67 return checkUseCount(ref.use_count(), additional);
72 using LERR_(INVALID_PLACEMENTREF);
73 using LERR_(BOTTOM_MOBJECTREF);
82 ::Local<vault::test::MediaAccessMock>;
107 MediaAccessMock useMockMedia;
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>();
148 LumieraUid luid = id1.get();
155 checkBuildMObjectRef (rP1, &pClip1);
156 checkBuildMObjectRef (rP2, &pClip2);
157 checkBuildMObjectRef (id1, &pClip1);
158 checkBuildMObjectRef (id2, &pClip2);
159 checkBuildMObjectRef (luid, &pClip1);
161 checkBuildMObjectRef (ref1, &pClip1);
162 checkBuildMObjectRef (ref2, &pClip2);
164 checkComparison(rP1,rP2);
165 checkLifecycle (rP1,rP2);
166 checkTypeHandling (luid);
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>
185 checkBuildMObjectRef (REF& refObj,
void* placementAdr)
189 CHECK (0==rMO.use_count());
191 cout << showSizeof(rMO) << endl;
200 PMedia media = rMO->getMedia();
201 cout << media << endl;
202 Duration mediaLength = media->getLength();
203 CHECK (!isnil (mediaLength));
204 CHECK (rMO->isValid());
207 CHECK (checkUseCount(rMO, 1));
209 CHECK ( rMO.isCompatible<
MObject>());
210 CHECK ( rMO.isCompatible<
Clip>());
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));
230 checkComparison (
PMO const& p1,
PMO const& p2)
241 CHECK (!(rM == rC) && !(rC == rM));
242 CHECK ( (rM != rC) && (rC != rM));
245 CHECK ( (rM == pRef1) && (pRef1 == rM));
246 CHECK ( (rC == pRef2) && (pRef2 == rC));
247 CHECK (!(rM != pRef1) && !(pRef1 != rM));
248 CHECK (!(rC != pRef2) && !(pRef2 != rC));
249 CHECK ( (rM != pRef2) && (pRef2 != rM));
250 CHECK ( (rC != pRef1) && (pRef1 != rC));
251 CHECK (!(rM == pRef2) && !(pRef2 == rM));
252 CHECK (!(rC == pRef1) && !(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) && (rC == rM));
266 CHECK (!(rM != rC) && !(rC != rM));
268 CHECK ( (rC == pRef1) && (pRef1 == rC));
269 CHECK (!(rC != pRef1) && !(pRef1 != rC));
270 CHECK ( (rC != pRef2) && (pRef2 != rC));
271 CHECK (!(rC == pRef2) && !(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) && !(rC == rM));
282 CHECK ( (rM != rC) && (rC != rM));
284 CHECK (!(rM == pRef1) && !(pRef1 == rM));
285 CHECK ( (rM != pRef1) && (pRef1 != rM));
286 CHECK ( (rM != pRef2) && (pRef2 != rM));
287 CHECK (!(rM == pRef2) && !(pRef2 == rM));
289 CHECK (!(rM == p1.
getID()) );
290 CHECK ( (rM != p1.
getID()) );
291 CHECK ( (rM != p2.
getID()) );
292 CHECK (!(rM == p2.
getID()) );
297 checkLifecycle (PMObj
const& p1, PMObj
const& p2)
299 CHECK (checkUseCount(p1, 0));
300 CHECK (checkUseCount(p2, 0));
304 CHECK (0 == rMO.use_count());
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));
333 checkTypeHandling (LumieraUid luid)
339 CHECK ( ! rMObj.use_count());
340 CHECK ( ! rClip.use_count());
341 CHECK ( ! rSub1.use_count());
344 CHECK (checkUseCount(rMObj, 1));
345 CHECK ( ! rClip.use_count());
346 CHECK ( ! rSub1.use_count());
349 CHECK (checkUseCount(rMObj, 2));
350 CHECK (checkUseCount(rClip, 2));
351 CHECK ( ! rSub1.use_count());
357 CHECK (rMObj->isValid());
358 CHECK (rClip->isValid());
359 CHECK (rMObj.getPlacement().getID() == rClip.getPlacement().
getID());
365 CHECK (checkUseCount(rMObj, 1));
366 CHECK ( ! rClip.use_count());
370 CHECK (checkUseCount(rMObj, 2));
371 CHECK (checkUseCount(rClip, 2));
373 cout << rClip << endl;
374 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.
Simplistic 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.