WIP: initial testbed for MObjectRef_test
This commit is contained in:
parent
ee7f2d6c0f
commit
56ff31df0a
2 changed files with 51 additions and 6 deletions
|
|
@ -22,17 +22,17 @@
|
|||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
//#include "lib/lumitime.hpp"
|
||||
#include "lib/lumitime.hpp"
|
||||
#include "proc/mobject/mobject.hpp"
|
||||
#include "proc/mobject/mobject-ref.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/mobject/placement-ref.hpp"
|
||||
//#include "proc/mobject/explicitplacement.hpp"
|
||||
#include "proc/mobject/explicitplacement.hpp"
|
||||
#include "proc/mobject/test-dummy-mobject.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//using lumiera::Time;
|
||||
using lumiera::Time;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
|
||||
|
|
@ -40,12 +40,15 @@ using std::cout;
|
|||
namespace mobject {
|
||||
namespace test {
|
||||
|
||||
using namespace mobject::test;
|
||||
using session::Clip;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* @test properties and behaviour of the external reference-mechanism for
|
||||
* MObjects placed into the session.
|
||||
* MObjects placed into the session. We create a simple, simulated
|
||||
* "session" (no real session datastructure) and a mock PlacementIndex.
|
||||
* Then we add two Placements, which can be used then to build
|
||||
* MObjectRef instances to validate their behaviour.
|
||||
* @see mobject::Placement
|
||||
* @see mobject::MObject
|
||||
* @see mobject::PlacementRef_test
|
||||
|
|
@ -53,9 +56,51 @@ namespace test {
|
|||
class MObjectRef_test : public Test
|
||||
{
|
||||
|
||||
typedef Placement<MObject> PMObj;
|
||||
typedef Placement<Clip> PClip;
|
||||
typedef TestPlacement<TestSubMO1> PSub1;
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
|
||||
// create data simulating a "Session"
|
||||
PMObj pClip1 = asset::Media::create("test-1", asset::VIDEO)->createClip();
|
||||
PMObj pClip2 = asset::Media::create("test-2", asset::VIDEO)->createClip();
|
||||
|
||||
// set up a tie to fixed start positions
|
||||
pClip1.chain(Time(10));
|
||||
pClip2.chain(Time(20));
|
||||
|
||||
ASSERT (pClip1->isValid());
|
||||
ASSERT (pClip2->isValid());
|
||||
ASSERT (2 == pClip1.use_count()); // one by the placement and one by the clip-Asset
|
||||
ASSERT (2 == pClip2.use_count());
|
||||
|
||||
|
||||
// Prepare an (test)Index
|
||||
typedef shared_ptr<PlacementIndex> PIdx;
|
||||
PIdx index (PlacementIndex::create());
|
||||
PMO& root = index->getRoot();
|
||||
reset_PlacementIndex(index);
|
||||
|
||||
// Add the Clips to "session"
|
||||
index->insert (pClip1, root);
|
||||
index->insert (pClip2, root);
|
||||
ASSERT (2 == index->size());
|
||||
|
||||
|
||||
// -----Tests------------------
|
||||
// -----Tests------------------
|
||||
|
||||
// verify clean state
|
||||
index->remove (pClip1);
|
||||
index->remove (pClip2);
|
||||
ASSERT (0 == index->size());
|
||||
ASSERT (2 == pClip1.use_count());
|
||||
ASSERT (2 == pClip2.use_count());
|
||||
reset_PlacementIndex();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace test {
|
|||
|
||||
PSub p1(*new TestSubMO21);
|
||||
PSub p2(*new TestSubMO21);
|
||||
p2.chain(Time(2));
|
||||
p2.chain(Time(2)); // define start time of Placement-2 to be at t=2
|
||||
|
||||
// Prepare an (test)Index backing the PlacementRefs
|
||||
typedef shared_ptr<PlacementIndex> PIdx;
|
||||
|
|
|
|||
Loading…
Reference in a new issue