add a start-element shortcut to the test-helper

This allows to get a start Placement, which is known
to be way down in the test-hierarchy of Placements
created by build_testScopes()
This commit is contained in:
Fischlurch 2009-11-21 01:07:56 +01:00
parent 1a02239e26
commit 218e1b8d60
4 changed files with 25 additions and 27 deletions

View file

@ -65,8 +65,7 @@ namespace test {
{
// Prepare an (test)Index backing the PlacementRefs
PPIdx index = build_testScopes();
#if false ////////////////////////////////////////////////////////////////////////////////TICKET 384
PMO& startPlacement = *(index->query<TestSubMO1>(index->getRoot()));
PMO& startPlacement = retrieve_startElm();
ASSERT (startPlacement);
ScopePath testPath = buildPath (startPlacement);
@ -76,7 +75,6 @@ namespace test {
check_Identity_and_Copy (startPlacement);
navigate (testPath, index);
clear (testPath, index);
#endif
}

View file

@ -61,7 +61,7 @@ namespace test {
run (Arg)
{
// Prepare an (test)Index (dummy "session")
build_testScopes();
PPIdx testSession (build_testScopes());
QueryResolver const& resolver = SessionServiceExploreScope::getResolver();
PlacementMO const& scope = SessionServiceExploreScope::getScopeRoot();

View file

@ -23,16 +23,8 @@
#include "proc/mobject/session/test-scopes.hpp"
#include "proc/mobject/session/session-service-mock-index.hpp"
//#include "lib/util.hpp"
//#include <iostream>
//#include <string>
//using util::isSameObject;
//using lumiera::Time;
//using std::string;
//using std::cout;
//using std::endl;
#include "proc/mobject/session/session-service-explore-scope.hpp"
#include "proc/mobject/session/scope-query.hpp"
namespace mobject {
@ -90,4 +82,18 @@ namespace test {
}
/** @note this test helper only works if build_testScopes is invoked
* beforehand, and the returned smart-ptr to the created test/dummy index
* is retained. Moreover, this function makes assumptions about the actual
* objects created by the former test function.
* @throw lumiera::error::Invalid if the intended start element doesn't exist (anymore)
*/
PlacementMO&
retrieve_startElm()
{
return *ContentsQuery<TestSubMO1>(SessionServiceExploreScope::getResolver()
,SessionServiceExploreScope::getScopeRoot());
}
}}} // namespace mobject::session::test

View file

@ -25,22 +25,10 @@
#define MOBJECT_SESSION_TEST_TEST_SCOPES_H
//#include "lib/lumitime.hpp"
//#include "proc/mobject/placement-ref.hpp"
#include "proc/mobject/session/test-scopes.hpp"
#include "proc/mobject/test-dummy-mobject.hpp"
#include "proc/mobject/session/placement-index.hpp"
//#include "lib/util.hpp"
#include <tr1/memory>
//#include <iostream>
//#include <string>
//using util::isSameObject;
//using lumiera::Time;
//using std::string;
//using std::cout;
//using std::endl;
namespace mobject {
@ -48,7 +36,7 @@ namespace session {
namespace test {
using std::tr1::shared_ptr;
using namespace mobject::test;
typedef TestPlacement<DummyMO> PDum;
@ -67,5 +55,11 @@ namespace test {
PPIdx build_testScopes();
/** complement to the helper: retrieve one of the dummy placements
* which is a Placement<> and way down into the hierarchy
*/
PlacementMO& retrieve_startElm();
}}} // namespace mobject::session::test
#endif