Lumiera  0.pre.03
»edit your freedom«
testclip.cpp
Go to the documentation of this file.
1 /*
2  TestClip - test clip (stub) for checking Model/Session functionality
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 
31 #include "lib/depend-inject.hpp"
32 #include "steam/asset/media.hpp"
33 #include "steam/asset/clip.hpp"
34 #include "lib/depend.hpp"
35 #include "lib/time/timevalue.hpp"
36 
37 namespace steam {
38 namespace mobject {
39 namespace session {
40 namespace test {
41 
42  using lib::time::Time;
43  using lib::time::Duration;
44  using asset::VIDEO;
45 
46  using PM = shared_ptr<asset::Media>;
48 
50 
51 
52 
53  asset::Media &
54  createTestMedia ()
55  {
56  // install Mock-Interface to Lumiera Vault
57  MediaAccessMock useMockMedia;
58 
59  return *asset::Media::create("test-2", VIDEO); // query magic filename
60  }
61 
62 
63  asset::Clip &
64  createTestClipAsset (asset::Media& media)
65  {
66  return *(asset::Media::create(media));
67  }
68 
69 
70  struct Testbed
71  {
72  asset::Media & media_;
73  asset::Clip & clipA_;
74 
75  Testbed()
76  : media_ (createTestMedia()),
77  clipA_ (createTestClipAsset(media_))
78  { }
79  };
80 
81  lib::Depend<Testbed> testbed_1; // invoke ctor when creating first TestClip...
82 
83 
84 
85 
86 
87  TestClip::TestClip ()
88  : Clip(testbed_1().clipA_,
89  testbed_1().media_)
90  {
91  CHECK (isValid());
92  }
93 
94 
95  /* == define some data for verification in unit tests == */
96 
97  const Duration LENGTH_TestClip(Time(0,25,0,0));
98 
99 
100 }}}} // namespace steam::mobject::session::test
key abstraction: media-like assets
Definition: media.hpp:72
Media data represented a specific kind of Asset.
Definition: run.hpp:49
Per type specific configuration of instances created as service dependencies.
Mock implementation of the MediaAccessFacade.
Unit test helper to access an emulated media file.
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:84
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:289
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
Interface to the vault layer: provides functions for querying (opening) a media file, detecting the channels or streams found within this file etc.
A stub implementation of the Clip interface for unit testing.
Definition of Asset representation for a media clip.
Singleton services and Dependency Injection.
bookkeeping (Asset) view of a media clip.
Definition: asset/clip.hpp:44
represents moving (or still) image data
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
a family of time value like entities and their relationships.
Configuration handle for temporarily shadowing a dependency by a test mock instance.
Abstraction interface to query for a media file.