2007-09-16 17:17:54 +02:00
|
|
|
|
/*
|
|
|
|
|
|
IdentityOfAssets(Test) - Asset object identity and versioning
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
* *****************************************************************/
|
2007-09-16 17:17:54 +02:00
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
|
/** @file identity-of-assets-test.cpp
|
2017-02-22 03:17:18 +01:00
|
|
|
|
** unit test \ref IdentityOfAssets_test
|
2016-11-03 18:20:10 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2007-09-16 17:17:54 +02:00
|
|
|
|
|
2009-01-25 00:24:42 +01:00
|
|
|
|
#include "include/logging.h"
|
2008-12-18 04:47:41 +01:00
|
|
|
|
#include "lib/test/run.hpp"
|
|
|
|
|
|
#include "lib/util.hpp"
|
2007-09-16 17:17:54 +02:00
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/assetmanager.hpp"
|
|
|
|
|
|
#include "steam/asset/media.hpp"
|
|
|
|
|
|
#include "steam/asset/proc.hpp"
|
2007-09-16 17:17:54 +02:00
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/asset/asset-diagnostics.hpp"
|
|
|
|
|
|
#include "vault/media-access-mock.hpp"
|
2018-03-30 18:46:13 +02:00
|
|
|
|
#include "lib/depend-inject.hpp"
|
2007-09-16 17:17:54 +02:00
|
|
|
|
|
|
|
|
|
|
using util::isnil;
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace steam {
|
2011-12-02 17:50:44 +01:00
|
|
|
|
namespace asset{
|
2010-12-17 22:51:27 +01:00
|
|
|
|
namespace test {
|
|
|
|
|
|
|
2018-11-15 23:59:23 +01:00
|
|
|
|
using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
|
|
|
|
|
|
::Local<vault::test::MediaAccessMock>;
|
2018-03-30 23:55:42 +02:00
|
|
|
|
|
2010-12-17 22:51:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/*******************************************************************//**
|
2010-12-17 22:51:27 +01:00
|
|
|
|
* @test creating several Assets and checking object identity,
|
|
|
|
|
|
* detection of duplicates and version handling.
|
|
|
|
|
|
* @see proc_interface::AssetManager#reg
|
|
|
|
|
|
*/
|
|
|
|
|
|
class IdentityOfAssets_test : public Test
|
2007-09-16 17:17:54 +02:00
|
|
|
|
{
|
2010-12-17 22:51:27 +01:00
|
|
|
|
virtual void run(Arg arg)
|
|
|
|
|
|
{
|
|
|
|
|
|
createDuplicate();
|
|
|
|
|
|
|
|
|
|
|
|
if (!isnil (arg))
|
|
|
|
|
|
dumpAssetManager();
|
|
|
|
|
|
TRACE (asset_mem, "leaving IdentityOfAssets_test::run()");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef shared_ptr<asset::Media> PM;
|
|
|
|
|
|
|
|
|
|
|
|
/** @test produce an ID clash.
|
|
|
|
|
|
* documents the current behaviour of the code as of 9/07
|
|
|
|
|
|
* @todo this test is expected to break when the detection
|
|
|
|
|
|
* of duplicate registrations is implemented.
|
|
|
|
|
|
*/
|
|
|
|
|
|
void createDuplicate()
|
|
|
|
|
|
{
|
2018-03-30 23:55:42 +02:00
|
|
|
|
MediaAccessMock useMockMedia;
|
2011-05-20 02:59:29 +02:00
|
|
|
|
|
|
|
|
|
|
PM mm1 = asset::Media::create ("test-1.mov", VIDEO);
|
2010-12-17 22:51:27 +01:00
|
|
|
|
|
|
|
|
|
|
Asset::Ident idi (mm1->ident); // duplicate Ident record
|
|
|
|
|
|
PM mm1X = asset::Media::create (idi); // note: we actually don't call any ctor
|
|
|
|
|
|
CHECK (mm1 == mm1X); // instead, we got mm1 back.
|
|
|
|
|
|
|
2011-05-20 02:59:29 +02:00
|
|
|
|
PM mm2 = asset::Media::create (idi,"test-2.mov");
|
2010-12-17 22:51:27 +01:00
|
|
|
|
|
|
|
|
|
|
CHECK (mm1->getID() == mm2->getID()); // different object, same hash
|
|
|
|
|
|
|
|
|
|
|
|
AssetManager& aMang = AssetManager::instance();
|
|
|
|
|
|
CHECK (aMang.getAsset (mm1->getID()) == mm2); // record of mm1 was replaced by mm2
|
|
|
|
|
|
CHECK (aMang.getAsset (mm2->getID()) == mm2);
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (aMang.known (mm1->getID()));
|
|
|
|
|
|
CHECK (aMang.known (mm2->getID()));
|
2011-05-20 02:59:29 +02:00
|
|
|
|
CHECK (mm1->ident.name == "test-1");
|
|
|
|
|
|
CHECK (mm2->ident.name == "test-1");
|
|
|
|
|
|
CHECK (mm1->getFilename() == "test-1.mov");
|
|
|
|
|
|
CHECK (mm2->getFilename() == "test-2.mov");
|
2010-12-17 22:51:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRACE (asset_mem, "leaving test method scope");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
|
|
|
|
|
LAUNCHER (IdentityOfAssets_test, "unit asset");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}}} // namespace steam::asset::test
|