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)
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 
22 #include "lib/depend-inject.hpp"
23 #include "steam/asset/media.hpp"
24 #include "steam/asset/clip.hpp"
25 #include "lib/depend.hpp"
26 #include "lib/time/timevalue.hpp"
27 
28 namespace steam {
29 namespace mobject {
30 namespace session {
31 namespace test {
32 
33  using lib::time::Time;
34  using lib::time::Duration;
35  using asset::VIDEO;
36 
37  using PM = shared_ptr<asset::Media>;
39 
41 
42 
43 
44  asset::Media &
45  createTestMedia ()
46  {
47  // install Mock-Interface to Lumiera Vault
48  MediaAccessMock useMockMedia;
49 
50  return *asset::Media::create("test-2", VIDEO); // query magic filename
51  }
52 
53 
54  asset::Clip &
55  createTestClipAsset (asset::Media& media)
56  {
57  return *(asset::Media::create(media));
58  }
59 
60 
61  struct Testbed
62  {
63  asset::Media & media_;
64  asset::Clip & clipA_;
65 
66  Testbed()
67  : media_ (createTestMedia()),
68  clipA_ (createTestClipAsset(media_))
69  { }
70  };
71 
72  lib::Depend<Testbed> testbed_1; // invoke ctor when creating first TestClip...
73 
74 
75 
76 
77 
78  TestClip::TestClip ()
79  : Clip(testbed_1().clipA_,
80  testbed_1().media_)
81  {
82  CHECK (isValid());
83  }
84 
85 
86  /* == define some data for verification in unit tests == */
87 
88  const Duration LENGTH_TestClip(Time(0,25,0,0));
89 
90 
91 }}}} // namespace steam::mobject::session::test
key abstraction: media-like assets
Definition: media.hpp:63
Media data represented a specific kind of Asset.
Definition: run.hpp:40
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:75
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:280
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
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:35
represents moving (or still) image data
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:468
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.