From 8109badf49c3c415c155f484733541ad3fb964e5 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 24 Sep 2008 06:37:42 +0200 Subject: [PATCH] outline a test covering the stream type registration lifecycle --- tests/50components.tests | 4 + tests/common/streamtypebasicstest.cpp | 12 +-- tests/common/streamtypelifecycletest.cpp | 114 +++++++++++++++++++++++ 3 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 tests/common/streamtypelifecycletest.cpp diff --git a/tests/50components.tests b/tests/50components.tests index 57534f06a..37b867be1 100644 --- a/tests/50components.tests +++ b/tests/50components.tests @@ -284,6 +284,10 @@ PLANNED "StreamTypeBasics_test" StreamTypeBasics_test < Testgroup=ALL diff --git a/tests/common/streamtypebasicstest.cpp b/tests/common/streamtypebasicstest.cpp index d12dee470..b852e1acd 100644 --- a/tests/common/streamtypebasicstest.cpp +++ b/tests/common/streamtypebasicstest.cpp @@ -34,10 +34,10 @@ using std::cout; namespace lumiera { namespace test { - + using control::STypeManager; - - + + /******************************************************************* * @test check the basic workings of the stream type handling. * create some stream implementation data, build a @@ -72,9 +72,9 @@ namespace lumiera { } }; - LAUNCHER (StreamTypeBasics_test, "unit common"); - - + LAUNCHER (StreamTypeBasics_test, "unit common"); + + } // namespace test } // namespace lumiera diff --git a/tests/common/streamtypelifecycletest.cpp b/tests/common/streamtypelifecycletest.cpp new file mode 100644 index 000000000..82f7cf6b9 --- /dev/null +++ b/tests/common/streamtypelifecycletest.cpp @@ -0,0 +1,114 @@ +/* + StreamTypeLifecycle(Test) - check lifecycle of the stream type registration + + Copyright (C) Lumiera.org + 2008, Hermann Vosseler + + This program 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "common/test/run.hpp" +#include "common/util.hpp" + +#include "proc/control/stypemanager.hpp" +#include "proc/mobject/session.hpp" +//#include "teststreamtypes.hpp" + +#include +using std::cout; + + + +namespace lumiera { + namespace test { + + using mobject::Session; + using control::STypeManager; + using control::ON_STREAMTYPES_RESET; + + + //////////TODO define a dummy-type-info here + //////////TODO + + void + setup_basicDummyTypeInfo () + { + UNIMPLEMENTED ("setup basic dummy-type-info"); + } + + namespace // enroll this basic setup to be triggered when the type system is reset + { + LifecycleHook _schedule_at_reset (ON_STREAMTYPES_RESET, &setup_basicDummyTypeInfo); + } + + + + /******************************************************************* + * @test check the stream type registration lifecycle. + * Any internal or external component (plugin) can extend + * the Proc Layer's registry of media stream types. + * There is a basic pristine set of type information, which is + * restored automatically everytime the STypeManager is reset, + * which in turn happenes before loading a (new) Session. + */ + class StreamTypeLifecycle_test : public Test + { + virtual void + run (Arg arg) + { + check_pristineState (); + register_additional_TypeInfo (); + check_pristineState (); + } + + + /** @test this test defines a new (dummy) type info + * and schedules it for setop in the pristine state; + * check this info is actually present after resetting + * the stream type manager, while other additional info + * \em not scheduled in this manner is not present + * in this state + */ + void + check_pristineState () + { + Session::current.reset(); + TODO ("verify the test-dummy basic type info is present now..."); + TODO ("verify the additional type info is *not* present"); + } + + /** @test use the stream type manager to register additional + * type info and verify it is used in type resolution. + */ + void + register_additional_TypeInfo () + { + TODO ("verify the additional type info is *not* present"); + + STypeManager& typeManager = STypeManager::instance(); + TODO ("use the registration facility to add additional type info"); + TODO ("verify the additional type info to be present now..."); + } + }; + + LAUNCHER (StreamTypeLifecycle_test, "unit common"); + + + } // namespace test + +} // namespace lumiera +