Lumiera  0.pre.03
»edit your freedom«
mobject-interface-test.cpp
Go to the documentation of this file.
1 /*
2  MObjectInterface(Test) - covers behaviour common to all MObjects
3 
4  Copyright (C) Lumiera.org
5  2010, 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 "lib/symbol.hpp"
30 
31 #include "steam/asset/media.hpp"
34 //#include "steam/mobject/mobject-ref.hpp"
36 //#include "steam/mobject/placement-ref.hpp"
37 //#include "steam/mobject/session/placement-index.hpp"
38 //#include "steam/mobject/session/session-service-mock-index.hpp"
39 //#include "steam/mobject/session/clip.hpp"
40 //#include "steam/mobject/explicitplacement.hpp"
43 #include "lib/depend-inject.hpp"
44 #include "lib/time/timevalue.hpp"
45 #include "lib/format-cout.hpp"
46 
47 
48 
49 
50 
51 namespace steam {
52 namespace mobject {
53 namespace test {
54 
55 // using lib::test::showSizeof;
56 
57  using lib::Symbol;
58  using lib::time::Duration;
59  using lib::time::FSecs;
60  using lib::time::Time;
61 
62 
63 // using session::Clip;
64 // using session::PMedia;
65 
66  using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
67  ::Local<vault::test::MediaAccessMock>;
68 
69 
70  using namespace mobject::test;
71  typedef TestPlacement<DummyMO> PDummy;
72 
73 
74  /*****************************************************************************/
82  class MObjectInterface_test : public Test
83  {
84 
85 
86 
87  virtual void
88  run (Arg)
89  {
90  MediaAccessMock useMockMedia;
91 
92 
93  PMO testClip1 = asset::Media::create("test-1", asset::VIDEO)->createClip();
94  PMO testClip2 = asset::Media::create("test-2", asset::VIDEO)->createClip();
95 
96  // set up a tie to fixed start positions (i.e. "properties of placement")
97  testClip1.chain(Time(FSecs(10)));
98  testClip2.chain(Time(FSecs(20)));
99 
100  Symbol labelType ("dummyLabel");
101  PMO testLabel1 = MObject::create (labelType);
102 
103  testLabel1.chain(Time(FSecs(30)));
104 
105  PDummy testDummy1(*new DummyMO);
106  PDummy testDummy2(*new TestSubMO1);
107 
108  CHECK (testClip1->isValid());
109  CHECK (testClip2->isValid());
110  CHECK (testLabel1->isValid());
111  CHECK (testDummy1->isValid());
112  CHECK (testDummy2->isValid());
113 
114  Duration lenC1 = testClip1->getLength();
115  Duration lenC2 = testClip2->getLength();
116  Duration lenL1 = testLabel1->getLength();
117  CHECK (lenC1 > Time::ZERO);
118  CHECK (lenC2 > Time::ZERO);
119  CHECK (lenL1 ==Time::ZERO);
120 
121  cout << testClip1->shortID() << endl;
122  cout << testClip2->shortID() << endl;
123  cout << testLabel1->shortID() << endl;
124  cout << testDummy1->shortID() << endl;
125  cout << testDummy2->shortID() << endl;
126  }
127  };
128 
129 
130 
132  LAUNCHER (MObjectInterface_test, "unit session");
133 
134 
135 }}} // namespace steam::mobject::test
Automatically use custom string conversion in C++ stream output.
Subclass-1 is not defined "processible", thus will always be handled as DummyMO...
Test MObject subclass, which, contrary to any real MObject, can be created directly without involving...
Media data represented a specific kind of Asset.
Definition: run.hpp:49
Core abstraction: placement of a media object into session context.
Per type specific configuration of instances created as service dependencies.
Unit test helper to access an emulated media file.
Core abstraction of the Session model: a media object.
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:84
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
Token or Atom with distinct identity.
Definition: symbol.hpp:126
string const & shortID() const
a short readable ID as a single name-token, denoting both the kind of MObject and some sort of instan...
Definition: mobject.cpp:58
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Marker types to indicate a literal string and a Symbol.
Simple test class runner.
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:229
A hierarchy of simple dummy-Media-Objects for easy unit testing.
Core factory to generate media objects for use in the Session model.
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
virtual bool isValid() const =0
MObject self-test (usable for asserting)
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.