LUMIERA.clone/tests/core/steam/engine/output-proxy-provider-test.cpp
Ichthyostega cfdb659ccb BufferProvider: prototyping for a proxy-BufferProvider
This is an implementation experiment to validate the improvements
and internal clean-up. Previously, I was unable to implement such a
forwarding proxy buffer provider, as would be required for the
intended harmonisation of the `OutputSlot` interface with `BufferProvider`

With the reworked verison of the BufferProvider standard implementation
it seems straight-forward to...
 * define a »Buffer Type« that marks any of the prepared buffers to pass-through
 * use the resulting Buffer Descriptor together with a rigged storage backend,
   that just returns the ''local tag'' as buffer adress
2026-02-22 00:30:45 +01:00

87 lines
3.1 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
OutputProxyProvider(Test) - verify accessing an output sink via BufferProvider protocol
Copyright (C)
2024, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** 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. See the file COPYING for further details.
* *****************************************************************/
/** @file output-proxy-provider-test.cpp
** unit test \ref OutputProxyProvider_test
*/
#include "lib/test/run.hpp"
//#include "steam/play/diagnostic-output-slot.hpp"
#include "steam/engine/buffer-proxy-adaptor.hpp"
#include "steam/engine/test-rand-ontology.hpp"
namespace steam {
namespace engine{
namespace test {
/***************************************************************//**
* @test verify the design of OutputSlot and BufferProvider by
* implementing a delegating BufferProvider to expose
* output data buffers provided from _some implementation._
* @todo WIP-WIP 12/2024 this turned out to be impossible,
* due to inconsistencies in the default implementation. /////////////////////////////////////////////TICKET #1387 : need to consolidate BufferProvider default implementation
* @todo 2/2026 broken by refactoring of BufferProvider //////////////////////////////////////////////TICKET #1410 : refactoring to separate external and implementation API
* @todo however, something along this lines *must*
* be made possible, somehow, for OutputSlot...
* @todo 2/2026 now using this setup for prototyping /////////////////////////////////////////////////TICKET #1415 : explore this design idea through prototyping
*/
class OutputProxyProvider_test : public Test
{
virtual void
run (Arg)
{
size_t seenID{0};
BufferState lastState{NIL};
// setup with notification callback
BufferProxyAdaptor proxPro{};
// Assuming some data block is »given«
seedRand();
TestFrame::reseed();
size_t frameNr = defaultGen.u64();
TestFrame dataBlock (frameNr);
CHECK ( dataBlock.isPristine());
BuffHandle handle = proxPro.lockBuffer (dataBlock); ///////////////////////////////////////////////TICKET #1387 : unable to implement this
// Now a »client« can do awful things to the buffer...
CHECK (handle.isValid());
auto& data = handle.accessAs<TestFrame>();
uint64_t param = defaultGen.u64();
ont::manipulateFrame (&data, &data, param);
// »client« is done...
handle.emit();
// end usage cycle
handle.release();
CHECK (not handle.isValid());
CHECK (not dataBlock.isPristine());
CHECK ( dataBlock.isValid());
}
};
/** Register this test class... */
LAUNCHER (OutputProxyProvider_test, "unit play");
}}} // namespace steam::play::test