Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
media-access-mock-test.cpp
Go to the documentation of this file.
1/*
2 MediaAccessMock(Test) - checking our Test Mock replacing the MediaAccessFacade
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
25#include "lib/depend-inject.hpp"
26#include "lib/format-cout.hpp"
27
28#include "lib/test/run.hpp"
29#include "lib/symbol.hpp"
30
31#include <string>
32
34using lib::Literal;
35using std::string;
36
37
38namespace vault {
39namespace test {
40
41
42
43
44 /****************************************************************************/
48 class MediaAccessMock_test : public Test
49 {
51
52 virtual void
53 run (Arg)
54 {
56
57 queryScenario ("test-1");
58 queryScenario ("test-2");
59 }
60
61
65 void queryScenario (string const& filename)
66 {
67 MAF& maf (MAF::instance());
68 MediaDesc& mhandle = maf.queryFile (filename);
69 cout << "accessing \""<<filename<<"\" (dur="<<mhandle.length<<")...\n";
70 for (int i=0; true; ++i)
71 {
72 ChanDesc chan = maf.queryChannel (mhandle, i);
73 if (!chan.handle) break;
74
75 cout << " Channel-" << i
76 << ": nameID=" << chan.chanID
77 << " codecID=" << chan.codecID
78 << "\n";
79 } }
80
81
82 };
83
84
85
87 LAUNCHER (MediaAccessMock_test, "unit integration");
88
89
90
91}} // namespace vault::test
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Inline string literal.
Definition symbol.hpp:78
Interface to the vault layer: provides functions for querying (opening) a media file,...
static lib::Depend< MediaAccessFacade > instance
storage for the SingletonFactory (actually a lumiera::test::MockInjector)
virtual ChanDesc queryChannel(MediaDesc &, uint chanNo) const
request for information about the n-th channel of the file referred by FileHandle.
virtual MediaDesc & queryFile(string const &name) const
request for testing the denoted files accessibility
void queryScenario(string const &filename)
perform the test: query for an (alleged) file and retrieve the mock answer.
Mock implementation of the MediaAccessFacade.
Per type specific configuration of instances created as service dependencies.
Automatically use custom string conversion in C++ stream output.
Abstraction interface to query for a media file.
Unit test helper to access an emulated media file.
Test runner and basic definitions for tests.
Vault-Layer implementation namespace root.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Description of one channel found in a media file; result of querying the channel.
CStr codecID
identifier characterising the access method (or codec) needed to get at the media data.
CStr chanID
identifier which can be used to create a name for the media asset corresponding to this channel.
MediaAccessFacade::ChanHandle handle
opaque handle, which will be used later to open this channel and retrieve some frames from it
Descriptor holding the global information record required for further handling this kind of media wit...
Duration length
effectively usable duration.
Marker types to indicate a literal string and a Symbol.