From 218e1b8d60fc1b43373add8449236fa88f08ce92 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 21 Nov 2009 01:07:56 +0100 Subject: [PATCH] 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() --- .../proc/mobject/scope-path-test.cpp | 4 +-- .../proc/mobject/session/scope-query-test.cpp | 2 +- .../proc/mobject/session/test-scopes.cpp | 26 ++++++++++++------- .../proc/mobject/session/test-scopes.hpp | 20 +++++--------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/tests/components/proc/mobject/scope-path-test.cpp b/tests/components/proc/mobject/scope-path-test.cpp index 9334f0e11..4663ae388 100644 --- a/tests/components/proc/mobject/scope-path-test.cpp +++ b/tests/components/proc/mobject/scope-path-test.cpp @@ -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(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 } diff --git a/tests/components/proc/mobject/session/scope-query-test.cpp b/tests/components/proc/mobject/session/scope-query-test.cpp index 3e5e77240..e139b6452 100644 --- a/tests/components/proc/mobject/session/scope-query-test.cpp +++ b/tests/components/proc/mobject/session/scope-query-test.cpp @@ -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(); diff --git a/tests/components/proc/mobject/session/test-scopes.cpp b/tests/components/proc/mobject/session/test-scopes.cpp index 20cf0639e..f7e4c3f6c 100644 --- a/tests/components/proc/mobject/session/test-scopes.cpp +++ b/tests/components/proc/mobject/session/test-scopes.cpp @@ -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 -//#include - -//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(SessionServiceExploreScope::getResolver() + ,SessionServiceExploreScope::getScopeRoot()); + } + + }}} // namespace mobject::session::test diff --git a/tests/components/proc/mobject/session/test-scopes.hpp b/tests/components/proc/mobject/session/test-scopes.hpp index 24147c399..a95da5bde 100644 --- a/tests/components/proc/mobject/session/test-scopes.hpp +++ b/tests/components/proc/mobject/session/test-scopes.hpp @@ -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 -//#include -//#include - -//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 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