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)
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 "lib/symbol.hpp"
21 
22 #include "steam/asset/media.hpp"
25 //#include "steam/mobject/mobject-ref.hpp"
27 //#include "steam/mobject/placement-ref.hpp"
28 //#include "steam/mobject/session/placement-index.hpp"
29 //#include "steam/mobject/session/session-service-mock-index.hpp"
30 //#include "steam/mobject/session/clip.hpp"
31 //#include "steam/mobject/explicitplacement.hpp"
34 #include "lib/depend-inject.hpp"
35 #include "lib/time/timevalue.hpp"
36 #include "lib/format-cout.hpp"
37 
38 
39 
40 
41 
42 namespace steam {
43 namespace mobject {
44 namespace test {
45 
46 // using lib::test::showSizeof;
47 
48  using lib::Symbol;
49  using lib::time::Duration;
50  using lib::time::FSecs;
51  using lib::time::Time;
52 
53 
54 // using session::Clip;
55 // using session::PMedia;
56 
57  using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
58  ::Local<vault::test::MediaAccessMock>;
59 
60 
61  using namespace mobject::test;
62  typedef TestPlacement<DummyMO> PDummy;
63 
64 
65  /*****************************************************************************/
73  class MObjectInterface_test : public Test
74  {
75 
76 
77 
78  virtual void
79  run (Arg)
80  {
81  MediaAccessMock useMockMedia;
82 
83 
84  PMO testClip1 = asset::Media::create("test-1", asset::VIDEO)->createClip();
85  PMO testClip2 = asset::Media::create("test-2", asset::VIDEO)->createClip();
86 
87  // set up a tie to fixed start positions (i.e. "properties of placement")
88  testClip1.chain(Time(FSecs(10)));
89  testClip2.chain(Time(FSecs(20)));
90 
91  Symbol labelType ("dummyLabel");
92  PMO testLabel1 = MObject::create (labelType);
93 
94  testLabel1.chain(Time(FSecs(30)));
95 
96  PDummy testDummy1(*new DummyMO);
97  PDummy testDummy2(*new TestSubMO1);
98 
99  CHECK (testClip1->isValid());
100  CHECK (testClip2->isValid());
101  CHECK (testLabel1->isValid());
102  CHECK (testDummy1->isValid());
103  CHECK (testDummy2->isValid());
104 
105  Duration lenC1 = testClip1->getLength();
106  Duration lenC2 = testClip2->getLength();
107  Duration lenL1 = testLabel1->getLength();
108  CHECK (lenC1 > Time::ZERO);
109  CHECK (lenC2 > Time::ZERO);
110  CHECK (lenL1 ==Time::ZERO);
111 
112  cout << testClip1->shortID() << endl;
113  cout << testClip2->shortID() << endl;
114  cout << testLabel1->shortID() << endl;
115  cout << testDummy1->shortID() << endl;
116  cout << testDummy2->shortID() << endl;
117  }
118  };
119 
120 
121 
123  LAUNCHER (MObjectInterface_test, "unit session");
124 
125 
126 }}} // 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:40
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:75
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
Token or Atom with distinct identity.
Definition: symbol.hpp:117
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:49
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Marker types to indicate a literal string and a Symbol.
Simplistic test class runner.
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:220
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:468
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:89
a family of time value like entities and their relationships.