Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
placement-object-identity-test.cpp
Go to the documentation of this file.
1/*
2 PlacementObjectIdentity(Test) - object identity for placements into the session
3
4 Copyright (C)
5 2010, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
19#include "lib/test/run.hpp"
20#include "steam/asset/media.hpp"
30//#include "steam/mobject/test-dummy-mobject.hpp"
31//#include "lib/test/test-helper.hpp"
32
33
34
35namespace steam {
36namespace mobject {
37namespace test {
38
39 using session::Clip;
40
42
43
44
45 /***********************************************************************/
55 class PlacementObjectIdentity_test : public Test
56 {
57
60
61 typedef PlacementMO::ID PMObjID;
62 typedef PlacementMO::Id<Clip> PClipID;
63
64
65 virtual void
66 run (Arg)
67 {
68
69 // create data simulating a "Session"
70 PMObj pClip1 = asset::Media::create("test-1", asset::VIDEO)->createClip();
71 PMObj pClip2 = asset::Media::create("test-2", asset::VIDEO)->createClip();
72
73 // set up a tie to fixed start positions
74 pClip1.chain (lib::time::Time(0,10));
75 pClip2.chain (lib::time::Time(0,20));
76
77 CHECK (pClip1->isValid());
78 CHECK (pClip2->isValid());
79 CHECK (2 == pClip1.use_count()); // one by the placement and one by the clip-Asset
80 CHECK (2 == pClip2.use_count());
81
84
85 UNIMPLEMENTED ("verify proper handling of object identity");
86
87#if false
88 // Prepare an (test)Index
90 PMO& root = index->getRoot();
91
92 // Add the Clips to "session"
93 PMObjID clip1ID = index->insert (pClip1, root);
94 PMObjID clip2ID = index->insert (pClip2, root);
95
98
99
100 // extract various kinds of IDs and refs
101 PMObj & rP1 (pClip1);
102 PMObj const& rP2 (pClip2);
103 PMObj::ID id1 = pClip1.getID();
104 PMObj::Id<Clip> id2 = pClip2.getID();
105 LumieraUid luid = id1.get();
106
107 PlacementRef<Clip> ref1 (id1);
108 PlacementRef<MObject> ref2 (pClip2);
109
110 MORef<Clip> rMO;
111 CHECK (!rMO); // still empty (not bound)
112
113 // activate by binding to provided ref
114 rMO.activate(refObj);
115 CHECK (rMO); // now bound
116
118
119 // re-link to the Placement (note we get the Clip API!)
120 Placement<Clip> & refP = rMO.getPlacement();
121 CHECK (refP);
122 CHECK (3 == refP.use_count());
123 CHECK (&refP == placementAdr); // actually denotes the address of the original Placement in the "session"
124
125 ExplicitPlacement exPla = refP.resolve();
126 CHECK (exPla.time == start); // recovered Placement resolves to the same time as provided by the proxied API
127 CHECK (4 == refP.use_count()); // but now we've indeed created an additional owner (exPla)
128 CHECK (4 == rMO.use_count());
129
130
133
134
136 index.reset();
137
138#endif
139 }
140
141
142 };
143
144
147
148
149}}} // namespace steam::mobject::test
Lumiera's internal time value datatype.
static MediaFactory create
storage for the static MediaFactory instance
Definition media.hpp:75
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)...
Placement< MO > & getPlacement() const
size_t use_count() const
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.
Core abstraction: completely resolved placement of an MObject Within the session model,...
lumiera_uid * LumieraUid
Definition hash-value.h:41
Media data represented a specific kind of Asset.
External MObject/Placement reference.
MObject in the Session to represent a clip on the timeline.
Core abstraction of the Session model: a media object.
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
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_)
Definition run.hpp:116
Implementation level session API: PlacementIndex mock for tests.
a family of time value like entities and their relationships.