Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
builder-tool-test.cpp
Go to the documentation of this file.
1/*
2 BuilderTool(Test) - specialised visitor used within the builder for processing Placements
3
4 Copyright (C)
5 2008, 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
24#include "steam/asset/media.hpp"
28#include "lib/depend-inject.hpp"
29#include "lib/format-cout.hpp"
30#include "lib/util.hpp"
31
32using std::string;
33
34
35
36namespace steam {
37namespace mobject {
38namespace builder {
39namespace test {
40
41 using session::Clip;
43 using namespace mobject::test;
44
46 ::Local<vault::test::MediaAccessMock>;
47
48
49
62 : public Applicable<TestTool, Types<Clip, DummyMO>::List>
63 {
64 public:
65 string log_;
66
67 void treat (Clip& c)
68 {
69 Placement<Clip>& pC = getPlacement<Clip>();
70 cout << "Clip on media : "<< pC->getMedia() <<"\n";
71 CHECK (pC->isEquivalentTo(c));
72 log_ = string (pC);
73 }
75 {
76 cout << "treat (AbstractMO&);\n";
77 log_ = string (getPlacement<MObject>());
78 }
80 {
81 cout << "catch-all-function called...\n";
82 log_ = string (getPlacement<MObject>());
83 }
84 };
85
86
87
88
89
90
91 /*********************************************************************************/
105 class BuilderTool_test : public Test
106 {
107 virtual void
108 run(Arg)
109 {
110 MediaAccessMock useMockMedia;
111
112
113 TestTool t1;
114 BuilderTool& tool = t1;
115
116 Placement<Clip> clip = asset::Media::create("test-1", asset::VIDEO)->createClip();
117 TestPlacement<> test1(*new TestSubMO1);
118 TestPlacement<> test2(*new TestSubMO2);
119
120
121 cout << "apply (tool, clip);\n";
122 apply (tool, clip);
123 INFO (test, "got Wrapper = %s", t1.log_.c_str());
124 CHECK (t1.log_ == string(clip));
125
126 cout << "apply (tool, test1);\n";
127 apply (tool, test1);
128 INFO (test, "got Wrapper = %s", t1.log_.c_str());
129 CHECK (t1.log_ == string(test1));
130
131 cout << "apply (tool, test2);\n";
132 apply (tool, test2);
133 INFO (test, "got Wrapper = %s", t1.log_.c_str());
134 CHECK (t1.log_ == string(test2));
135 }
136 };
137
138
140 LAUNCHER (BuilderTool_test, "unit builder");
141
142
143
144}}}} // namespace steam::mobject::builder::test
Visiting-tool mechanism configured specifically for the Builder.
Definition of Asset categorisation.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
static MediaFactory create
storage for the static MediaFactory instance
Definition media.hpp:75
Marker Interface for classes visitable by Builder tools.
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
declare the concrete types a BuilderTool may receive and treat.
Base class of all BuilderTools, used according to the visitor pattern: each Tool contains the concret...
BuilderTool implementation for checking the invocation of the correct treat() function and for access...
abstract base class of all MObjects for providing common services.
A user visible/editable Clip is a reference to a contiguous sequence of media data loaded as Asset in...
Per type specific configuration of instances created as service dependencies.
Automatically use custom string conversion in C++ stream output.
Unit test helper to access an emulated media file.
Media data represented a specific kind of Asset.
MObject in the Session to represent a clip on the timeline.
lib::DependInject< vault::MediaAccessFacade > ::Local< vault::test::MediaAccessMock > MediaAccessMock
Buildable::ReturnType apply(BuilderTool &tool, WRA &wrappedTargetObj)
to be picked up by ADL: redirect tool invocation for double dispatch.
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
Core abstraction: placement of a media object into session context.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Subclass-1 is not defined "processible", thus will always be handled as DummyMO...
Subclass-2 is defined "processible", but we omit the necessary "applicable" definition in TestTool,...
A hierarchy of simple dummy-Media-Objects for easy unit testing.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...