Lumiera  0.pre.03
»edit your freedom«
placement-basic-test.cpp
Go to the documentation of this file.
1 /*
2  PlacementBasic(Test) - basic Placement and MObject handling
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
29 #include "steam/asset/media.hpp"
35 #include "lib/time/timevalue.hpp"
36 //#include "lib/util.hpp"
37 
38 
39 using lib::time::Time;
40 
41 
42 namespace steam {
43 namespace mobject {
44 namespace session {
45 namespace test {
46 
47  using asset::VIDEO;
48 
49 
50 
51  /***************************************************************/
58  class PlacementBasic_test : public Test
59  {
62 
63  virtual void
64  run (Arg)
65  {
66  // create Clip-MObject, which is wrapped into a placement (smart ptr)
67  PM media = asset::Media::create("test-1", VIDEO);
68  PCA clipAsset = Media::create(*media);
69  Placement<Clip> pc = MObject::create (*clipAsset, *media);
70 
71  // use of the Clip-MObject interface by dereferencing the placement
72  PM clip_media = pc->getMedia();
73  CHECK (clip_media->ident.category.hasKind (VIDEO));
74 
75  // using the Placement interface
76  // TODO: how to handle insufficiently determinated Placement? Throw?
77  FixedLocation & fixloc = pc.chain (Time(0,1)); // TODO: the fork??
78  ExplicitPlacement expla = pc.resolve();
79  CHECK (expla.time == Time(0,1));
80  CHECK (!expla.chain.isOverdetermined());
81 // CHECK (*expla == *pc); ////////////////////////////////////////////TICKET #511 define equivalence of locating chains and solutions
82 
83  // now overconstraining with another Placement
84  pc.chain (Time(0,2));
85  ExplicitPlacement expla2 = pc.resolve();
86  CHECK (expla2.time == Time(0,2)); // the latest addition wins
87  CHECK (expla2.chain.isOverdetermined());
88  }
89  };
90 
91 
93  LAUNCHER (PlacementBasic_test, "unit session");
94 
95 
96 
97 }}}} // namespace steam::mobject::session::test
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:49
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...
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:84
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
The most common case of positioning a MObject in the Session: directly specifying a constant position...
Simple test class runner.
A stub implementation of the Clip interface for unit testing.
Core factory to generate media objects for use in the Session model.
represents moving (or still) image data
Primary Interface to the current Session.
static session::MObjectFactory create
Storage for the (single, static) MObject factory object.
Definition: mobject.hpp:98
a family of time value like entities and their relationships.