From 7adb8149db3036b752e3ffb0874aeda2f324e3f9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 9 Jul 2011 02:44:24 +0200 Subject: [PATCH] back to test-driven brainstorming again --- src/proc/engine/buffer-provider.hpp | 6 ++ src/proc/engine/buffhandle.hpp | 2 +- src/proc/play/diagnostic-output-slot.hpp | 73 +++++++++++++++++++ src/proc/play/output-slot.hpp | 11 +-- .../proc/play/output-slot-protocol-test.cpp | 66 +++++++++++++++++ 5 files changed, 148 insertions(+), 10 deletions(-) create mode 100644 src/proc/play/diagnostic-output-slot.hpp create mode 100644 tests/components/proc/play/output-slot-protocol-test.cpp diff --git a/src/proc/engine/buffer-provider.hpp b/src/proc/engine/buffer-provider.hpp index 981bfe799..907cb9806 100644 --- a/src/proc/engine/buffer-provider.hpp +++ b/src/proc/engine/buffer-provider.hpp @@ -64,6 +64,12 @@ namespace engine { public: virtual ~BufferProvider(); ///< this is an interface + + ///////TODO: is there any generic way to obtain a BufferDescriptor; then we should expose it here... + + virtual BuffHandle lockBufferFor (BufferDescriptor const&) =0; + virtual void releaseBuffer (BuffHandle const&) =0; ////////TODO not quite sure what information to pass here + }; diff --git a/src/proc/engine/buffhandle.hpp b/src/proc/engine/buffhandle.hpp index 3d7bcbfac..d7c5ecd87 100644 --- a/src/proc/engine/buffhandle.hpp +++ b/src/proc/engine/buffhandle.hpp @@ -110,7 +110,7 @@ namespace engine { /** * Buffer Type information. * Given a BufferDescriptor, it is possible to allocate a buffer - * of suitable size and type by using BufferProvider::allocateBuffer(). + * of suitable size and type by using BufferProvider::lockBuffer(). */ struct BufferDescriptor { diff --git a/src/proc/play/diagnostic-output-slot.hpp b/src/proc/play/diagnostic-output-slot.hpp new file mode 100644 index 000000000..e0e4a7f0a --- /dev/null +++ b/src/proc/play/diagnostic-output-slot.hpp @@ -0,0 +1,73 @@ +/* + DIAGNOSTIC-OUTPUT-SLOT.hpp - helper for testing against the OutputSlot interface + + Copyright (C) Lumiera.org + 2011, 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. + +*/ + +/** @file diagnostic-output-slot.hpp + ** An facility for writing unit-tests against the OutputSlot interface. + ** + ** @see output-slot-protocol-test.cpp + */ + + +#ifndef PROC_PLAY_DIAGNOSTIC_OUTPUT_SLOT_H +#define PROC_PLAY_DIAGNOSTIC_OUTPUT_SLOT_H + + +#include "lib/error.hpp" +#include "proc/play/output-slot.hpp" +//#include "lib/sync.hpp" + +//#include +//#include +//#include +//#include +//#include + + +namespace proc { +namespace play { + +//using std::string; + +//using std::vector; +//using std::tr1::shared_ptr; +//using boost::scoped_ptr; + + + + /******************************************************************** + * Helper for unit tests: Mock output sink. + * + * @todo write type comment + */ + class DiagnosticOutputSlot + : public OutputSlot + { + public: + + private: + + }; + + + +}} // namespace proc::play +#endif diff --git a/src/proc/play/output-slot.hpp b/src/proc/play/output-slot.hpp index b5d0c3d45..d784bad85 100644 --- a/src/proc/play/output-slot.hpp +++ b/src/proc/play/output-slot.hpp @@ -28,7 +28,7 @@ ** possibilities can be added and removed dynamically from various components (backend, GUI), ** all using the same resolution and mapping mechanisms ** - ** @see output-test-slot.hpp ////TODO + ** @see diagnostic-output-slot.hpp ////TODO */ @@ -54,6 +54,7 @@ namespace proc { namespace play { using ::engine::BuffHandle; + using ::engine::BufferProvider; using lib::time::Time; //using std::string; @@ -65,14 +66,6 @@ namespace play { /** established output channel */ class Connection; - class BufferProvider - { - - public: - ~BufferProvider() { } - - BuffHandle lockBufferFor(Time); - }; class DataSink diff --git a/tests/components/proc/play/output-slot-protocol-test.cpp b/tests/components/proc/play/output-slot-protocol-test.cpp new file mode 100644 index 000000000..2bdc7b09d --- /dev/null +++ b/tests/components/proc/play/output-slot-protocol-test.cpp @@ -0,0 +1,66 @@ +/* + OutputSlotProtocol(Test) - covering the basic usage cycle of an output slot + + Copyright (C) Lumiera.org + 2011, 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 "lib/test/run.hpp" +//#include "lib/util.hpp" +#include "proc/play/diagnostic-output-slot.hpp" + +//#include +//#include + +//using boost::format; +//using std::string; +//using std::cout; + + +namespace engine{ +namespace test { + +// using lib::AllocationCluster; +// using mobject::session::PEffect; + + + namespace { // Test fixture + + } + + + /******************************************************************* + * @test basic render node properties and behaviour. + */ + class OutputSlotProtocol_test : public Test + { + virtual void + run (Arg) + { + UNIMPLEMENTED ("build a mock output slot and perform a full lifecycle"); + } + }; + + + /** Register this test class... */ + LAUNCHER (OutputSlotProtocol_test, "unit player"); + + + +}} // namespace engine::test