Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
identity-of-assets-test.cpp
Go to the documentation of this file.
1/*
2 IdentityOfAssets(Test) - Asset object identity and versioning
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 "include/logging.h"
20#include "lib/test/run.hpp"
21#include "lib/util.hpp"
22
24#include "steam/asset/media.hpp"
25#include "steam/asset/proc.hpp"
26
29#include "lib/depend-inject.hpp"
30
31using util::isnil;
32using std::string;
33
34
35namespace steam {
36namespace asset{
37namespace test {
38
40 ::Local<vault::test::MediaAccessMock>;
41
42
43
44
45 /*******************************************************************/
50 class IdentityOfAssets_test : public Test
51 {
52 virtual void run(Arg arg)
53 {
55
56 if (!isnil (arg))
58 TRACE (asset_mem, "leaving IdentityOfAssets_test::run()");
59 }
60
61
62
63 typedef shared_ptr<asset::Media> PM;
64
71 {
72 MediaAccessMock useMockMedia;
73
74 PM mm1 = asset::Media::create ("test-1.mov", VIDEO);
75
76 Asset::Ident idi (mm1->ident); // duplicate Ident record
77 PM mm1X = asset::Media::create (idi); // note: we actually don't call any ctor
78 CHECK (mm1 == mm1X); // instead, we got mm1 back.
79
80 PM mm2 = asset::Media::create (idi,"test-2.mov");
81
82 CHECK (mm1->getID() == mm2->getID()); // different object, same hash
83
85 CHECK (aMang.getAsset (mm1->getID()) == mm2); // record of mm1 was replaced by mm2
86 CHECK (aMang.getAsset (mm2->getID()) == mm2);
87
88 CHECK (aMang.known (mm1->getID()));
89 CHECK (aMang.known (mm2->getID()));
90 CHECK (mm1->ident.name == "test-1");
91 CHECK (mm2->ident.name == "test-1");
92 CHECK (mm1->getFilename() == "test-1.mov");
93 CHECK (mm2->getFilename() == "test-2.mov");
94
95
96 TRACE (asset_mem, "leaving test method scope");
97 }
98
99 };
100
101
104
105
106
107}}} // namespace steam::asset::test
Small helper and diagnostic functions related to Asset and AssetManager.
Steam-Layer Interface: Asset Lookup and Organisation.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Facade for the Asset subsystem.
lib::P< KIND > getAsset(const ID< KIND > &id)
find and return corresponding object
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
static MediaFactory create
storage for the static MediaFactory instance
Definition media.hpp:75
Per type specific configuration of instances created as service dependencies.
This header is for including and configuring NoBug.
Unit test helper to access an emulated media file.
Media data represented a specific kind of Asset.
lib::DependInject< vault::MediaAccessFacade > ::Local< vault::test::MediaAccessMock > MediaAccessMock
The asset subsystem of the Steam-Layer.
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Data processing Plugins and Codecs can be treated as a specific Kind of Asset.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
a POD comprised of all the information sufficiently identifying any given Asset.
Definition asset.hpp:147
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...