test-driven brainstorming: how to use the dummy playback?

this is an idea how to test a test setup :)
This commit is contained in:
Fischlurch 2012-01-23 02:25:12 +01:00
parent 7e7ecc5d51
commit 2eb39704fc
6 changed files with 129 additions and 50 deletions

View file

@ -61,33 +61,15 @@ namespace engine{
/** core operation: activate the Lumiera Render Engine.
* Invoking this service effectively hooks up each channel
* of the given model exit point to deliver into the corresponding
* output sink on the given OutputConnection (which is assumed
* to be already allocated for active use by this connection).
* The generated calculation streams represent actively ongoing
* calculations within the engine, started right away, according
* to the given timing constraints and service quality.
/** special engine configuration for mock/testing operation.
*/
CalcStreams
EngineServiceMock::calculate(ModelPort mPort,
Timings nominalTimings,
OutputConnection& output,
Quality serviceQuality)
RenderEnvironmentClosure&
EngineServiceMock::configureCalculation ()
{
UNIMPLEMENTED ("MOCK IMPLEMENTATION: build a list of standard calculation streams");
}
/** */
CalcStreams
EngineServiceMock::calculateBackground(ModelPort mPort,
Timings nominalTimings,
Quality serviceQuality)
{
UNIMPLEMENTED ("MOCK IMPLEMENTATION: build calculation streams for background rendering");
UNIMPLEMENTED ("represent *this as RenderEnvironmentClosure)");
RenderEnvironmentClosure* todo_fake(0); ////KABOOOM
return *todo_fake;
}

View file

@ -76,15 +76,12 @@ namespace engine{
/******************************************************
* A service to schedule series of calculations,
* delivering the rendered data into an external output
* sink in a timely fashion. Actually the CalculationStream
* instances provided through this (facade) interface are
* backed by jobs executed through the scheduler in the
* backend layer. The implementation of this service
* cares to create the right job entries in the correct
* order and to enqueue these into the scheduler.
/****************************************************************
* Variant of the render engine, reconfigured for mock operation.
* Especially, this setup leaves out most of the actual Lumiera
* engine's implementation facilities. There is no scheduler
* and no frame cache; rather we perform simple dependent
* calculations which might block.
*/
class EngineServiceMock
: public EngineService
@ -95,21 +92,10 @@ namespace engine{
public:
EngineServiceMock();
~EngineServiceMock() { }
CalcStreams
calculate(ModelPort mPort,
Timings nominalTimings,
OutputConnection& output,
Quality serviceQuality = EngineService::QoS_DEFAULT);
CalcStreams
calculateBackground(ModelPort mPort,
Timings nominalTimings,
Quality serviceQuality = EngineService::QoS_BACKGROUND);
protected:
virtual RenderEnvironmentClosure& configureCalculation ();
};

View file

@ -112,13 +112,13 @@ namespace engine{
* such a specific configuration remains opaque for the user of the
* created render activity
*/
CalcStream
RenderEnvironmentClosure&
EngineService::configureCalculation ()
{
UNIMPLEMENTED ("represent *this as RenderEnvironmentClosure)");
RenderEnvironmentClosure* todo_fake(0); ////KABOOOM
return activateCalculation (*todo_fake);
return *todo_fake;
}

View file

@ -135,8 +135,9 @@ namespace engine{
static lib::Singleton<EngineService> instance;
virtual ~EngineService() { }
EngineService();
~EngineService() { }
CalcStreams
calculate(ModelPort mPort,
@ -154,7 +155,7 @@ namespace engine{
CalcStream activateCalculation (RenderEnvironmentClosure&);
protected:
virtual CalcStream configureCalculation ();
virtual RenderEnvironmentClosure& configureCalculation ();
void activateTracing();
void disableTracing(); ///< EX_FREE

View file

@ -2,6 +2,11 @@ TESTING "Component Test Suite: Player and Output" ./test-components --group=play
PLANNED "Dummy Player setup" DummyPlayConnection_test <<END
return: 0
END
TEST "Output Slot Protocol" OutputSlotProtocol_test <<END
return: 0
END

View file

@ -0,0 +1,105 @@
/*
DummyPlayConnection(Test) - create and verify a simplified test render engine setup
Copyright (C) Lumiera.org
2012, Hermann Vosseler <Ichthyostega@web.de>
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 "lib/test/run.hpp"
#include "proc/play/dummy-play-connection.hpp"
//#include "proc/engine/buffhandle.hpp"
//#include "proc/engine/testframe.hpp"
#include "include/play-facade.h"
#include "lib/time/control.hpp"
namespace proc {
namespace play {
namespace test {
namespace time = lib::time;
using proc::engine::BuffHandle;
//using proc::engine::test::testData;
//using proc::engine::test::TestFrame;
using lumiera::Play;
typedef Play::Controller Controller;
typedef time::Control<time::Duration> DurationControl;
/*******************************************************************
* @test verify the OutputSlot interface and base implementation
* by performing full data exchange cycle. This is a
* kind of "dry run" for documentation purposes,
* both the actual OutputSlot implementation
* as the client using this slot are Mocks.
*/
class DummyPlayConnection_test : public Test
{
virtual void
run (Arg)
{
verify_simulatedPlayback();
}
void
verify_simulatedPlayback()
{
DummyPlayConnection dummy; //////////TODO: how to pre-configure the DummyPlayConnection
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #805
CHECK (!dummy.isWired());
Controller ctrl = Play::facade().connect(dummy.port(), dummy.output());
CHECK ( dummy.isWired());
DurationControl playDuration;
ctrl.controlDuration (playDuration);
// configure the controller to playback only for a fixed time duration
playDuration (dummy.getPlannedTestDuration());
CHECK (!ctrl.is_playing());
ctrl.play(true); // hit the start button
CHECK (ctrl.is_playing());
dummy.waitUntilDue(); // test helper: block waiting until planned test should be done
CHECK (!ctrl.is_playing()); // should have returned to pause, since we've set a fixed playback duration
CHECK (dummy.isWired());
ctrl.close();
CHECK (!dummy.isWired());
CHECK (dummy.gotCorrectOutput());
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #805
}
};
/** Register this test class... */
LAUNCHER (DummyPlayConnection_test, "unit player");
}}} // namespace proc::play::test