Lumiera  0.pre.03
»edit your freedom«
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 
23 #include "steam/assetmanager.hpp"
24 #include "steam/asset/media.hpp"
25 #include "steam/asset/proc.hpp"
26 
29 #include "lib/depend-inject.hpp"
30 
31 using util::isnil;
32 using std::string;
33 
34 
35 namespace steam {
36 namespace asset{
37 namespace test {
38 
39  using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
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))
57  dumpAssetManager();
58  TRACE (asset_mem, "leaving IdentityOfAssets_test::run()");
59  }
60 
61 
62 
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 
103  LAUNCHER (IdentityOfAssets_test, "unit asset");
104 
105 
106 
107 }}} // namespace steam::asset::test
Steam-Layer Interface: Asset Lookup and Organisation.
Media data represented a specific kind of Asset.
Definition: run.hpp:40
Per type specific configuration of instances created as service dependencies.
Unit test helper to access an emulated media file.
Facade for the Asset subsystem.
This header is for including and configuring NoBug.
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:75
Steam-Layer implementation namespace root.
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Data processing Plugins and Codecs can be treated as a specific Kind of Asset.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:149
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Small helper and diagnostic functions related to Asset and AssetManager.
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35