Lumiera  0.pre.03
»edit your freedom«
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"
29 #include "lib/time/timevalue.hpp"
30 //#include "steam/mobject/test-dummy-mobject.hpp"
31 //#include "lib/test/test-helper.hpp"
32 
33 
34 
35 namespace steam {
36 namespace mobject {
37 namespace test {
38 
39  using session::Clip;
40 
42 
43 
44 
45  /***********************************************************************/
55  class PlacementObjectIdentity_test : public Test
56  {
57 
58  typedef Placement<MObject> PMObj;
59  typedef Placement<Clip> PClip;
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
89  PPIdx index = SessionServiceMockIndex::install();
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 
146  LAUNCHER (PlacementObjectIdentity_test, "function session");
147 
148 
149 }}} // namespace steam::mobject::test
Reference tag denoting a placement attached to the session.
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
Definition: mobject-ref.hpp:85
Media data represented a specific kind of Asset.
Core abstraction: completely resolved placement of an MObject Within the session model, all media objects are attached with the help of mobject::Placement elements.
Definition: run.hpp:40
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...
MObject in the Session to represent a clip on the timeline.
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...
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:75
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
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...
Implementation level session API: PlacementIndex mock for tests.
A generic reference mechanism for Placements, as added to the current session.
MORef & activate(Placement< MO > const &placement)
activate an MObject reference, based on an existing placement, which needs to be contained (added to)...
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.