ElementAccess: add very simplistic mock implementation
This commit is contained in:
parent
bf9fcc3b2e
commit
4c273d902c
3 changed files with 58 additions and 66 deletions
|
|
@ -30,7 +30,6 @@
|
||||||
//#include "gui/interact/view-spec-dsl.hpp"
|
//#include "gui/interact/view-spec-dsl.hpp"
|
||||||
#include "test/test-element-access.hpp"
|
#include "test/test-element-access.hpp"
|
||||||
#include "gui/interact/ui-coord.hpp"
|
#include "gui/interact/ui-coord.hpp"
|
||||||
#include "test/mock-elm.hpp"
|
|
||||||
//#include "gen-node-location-query.hpp"
|
//#include "gen-node-location-query.hpp"
|
||||||
#include "lib/depend-inject.hpp"
|
#include "lib/depend-inject.hpp"
|
||||||
#include "lib/format-cout.hpp"
|
#include "lib/format-cout.hpp"
|
||||||
|
|
@ -52,33 +51,19 @@ using util::isSameObject;
|
||||||
|
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
namespace model {
|
namespace model{
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
// using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
|
// using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
|
||||||
// using lib::test::showSizeof;
|
// using lib::test::showSizeof;
|
||||||
using interact::UICoord;
|
using interact::UICoord;
|
||||||
|
using gui::test::TestElementAccess;
|
||||||
|
using gui::test::DummyWidget;
|
||||||
|
using gui::test::DummyTab;
|
||||||
|
|
||||||
using MockAccess = lib::DependInject<ElementAccess>::Local<TestElementAccess>;
|
using MockAccess = lib::DependInject<ElementAccess>::Local<TestElementAccess>;
|
||||||
using AccessAPI = lib::Depend<ElementAccess>;
|
using AccessAPI = lib::Depend<ElementAccess>;
|
||||||
|
|
||||||
namespace { //Test fixture...
|
|
||||||
|
|
||||||
class DummyWidget
|
|
||||||
: public gui::test::MockElm
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
virtual ~DummyWidget() { } ///< is an interface
|
|
||||||
DummyWidget()
|
|
||||||
: MockElm("DummyWidget")
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
|
|
||||||
class DummyTab
|
|
||||||
: public DummyWidget
|
|
||||||
{ };
|
|
||||||
|
|
||||||
}//(End)Test fixture
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************//**
|
/******************************************************************************//**
|
||||||
|
|
@ -93,6 +78,7 @@ namespace test {
|
||||||
* rather than on the real UI topology.
|
* rather than on the real UI topology.
|
||||||
* @see GenNodeLocationQuery
|
* @see GenNodeLocationQuery
|
||||||
*
|
*
|
||||||
|
* @see [Mock testing support](test-element-access.hpp)
|
||||||
* @see id-scheme.hpp
|
* @see id-scheme.hpp
|
||||||
* @see ViewLocator
|
* @see ViewLocator
|
||||||
* @see ViewSpecDSL_test
|
* @see ViewSpecDSL_test
|
||||||
|
|
|
||||||
|
|
@ -22,29 +22,25 @@
|
||||||
|
|
||||||
|
|
||||||
/** @file test-element-access.hpp
|
/** @file test-element-access.hpp
|
||||||
** Generic building block in the Lumiera GUI model.
|
** Unit test helper for access to UI elements without actually running an UI.
|
||||||
** A model::Element has a unique identifier, which is tied to the
|
|
||||||
** identification scheme used in the "real" model in Proc-Layer.
|
|
||||||
** Model elements can be addressed receive mutations caused by changes
|
|
||||||
** and rebuilding of elements within the Session; moreover, a generic
|
|
||||||
** representation of attributes is provided.
|
|
||||||
**
|
**
|
||||||
** @note as of 1/2015 this is a first draft and WIP-WIP-WIP
|
** @note as of 1/2015 this is a first draft and WIP-WIP-WIP
|
||||||
** @todo WIP ///////////////////////TICKET #1134
|
** @todo WIP ///////////////////////TICKET #1134
|
||||||
**
|
**
|
||||||
** @see ////TODO_test usage example
|
** @see ElementAccess_test usage example
|
||||||
** @see element.cpp implementation
|
** @see elem-access-dir.hpp real implementation
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef GUI_MODEL_TEST_ELEMENT_ACCESS_H
|
#ifndef GUI_TEST_ELEMENT_ACCESS_H
|
||||||
#define GUI_MODEL_TEST_ELEMENT_ACCESS_H
|
#define GUI_TEST_ELEMENT_ACCESS_H
|
||||||
|
|
||||||
|
|
||||||
#include "lib/error.hpp"
|
#include "lib/error.hpp"
|
||||||
#include "gui/model/element-access.hpp"
|
#include "gui/model/element-access.hpp"
|
||||||
#include "gui/interact/ui-coord.hpp"
|
#include "gui/interact/ui-coord.hpp"
|
||||||
|
#include "test/mock-elm.hpp"
|
||||||
//#include "lib/symbol.hpp"
|
//#include "lib/symbol.hpp"
|
||||||
//#include "lib/util.hpp"
|
//#include "lib/util.hpp"
|
||||||
|
|
||||||
|
|
@ -53,21 +49,37 @@
|
||||||
|
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
namespace model {
|
namespace test {
|
||||||
|
|
||||||
// using util::isnil;
|
// using util::isnil;
|
||||||
// using std::string;
|
// using std::string;
|
||||||
using interact::UICoord;
|
using interact::UICoord;
|
||||||
|
|
||||||
|
|
||||||
|
/* === Dummy Widgets for Unit testing === */
|
||||||
|
|
||||||
|
class DummyWidget
|
||||||
|
: public MockElm
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual ~DummyWidget() { } ///< is an interface
|
||||||
|
DummyWidget()
|
||||||
|
: MockElm("DummyWidget")
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
class DummyTab
|
||||||
|
: public DummyWidget
|
||||||
|
{ };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic (abstracted) view of...
|
* Mock implementation of the model::ElementAccess interface for testing without actual UI.
|
||||||
*
|
* @see ElementAccess_test
|
||||||
* @see SomeSystem
|
|
||||||
* @see NA_test
|
|
||||||
*/
|
*/
|
||||||
class TestElementAccess
|
class TestElementAccess
|
||||||
: public ElementAccess
|
: public model::ElementAccess
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -82,15 +94,16 @@ namespace model {
|
||||||
UICoord expectedQuery;
|
UICoord expectedQuery;
|
||||||
|
|
||||||
/** ...and if acceptable, the next query will answer with this object */
|
/** ...and if acceptable, the next query will answer with this object */
|
||||||
void* expectedAnswer;
|
model::Tangible* expectedAnswer;
|
||||||
|
|
||||||
|
|
||||||
/* == ElementAccess interface == */
|
/* == ElementAccess interface == */
|
||||||
|
|
||||||
RawResult
|
RawResult
|
||||||
performAccessTo (UICoord, size_t limitCreation) override
|
performAccessTo (UICoord target, size_t limitCreation) override
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("internal access function");
|
CHECK (target == expectedQuery);
|
||||||
|
return expectedAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,22 +113,5 @@ namespace model {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}} // namespace gui::test
|
||||||
|
#endif /*GUI_TEST_ELEMENT_ACCESS_H*/
|
||||||
/** @internal in case
|
|
||||||
*/
|
|
||||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1134
|
|
||||||
template<class X>
|
|
||||||
inline void
|
|
||||||
ElementAccess<X>::maybe () const
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED ("tbw");
|
|
||||||
}
|
|
||||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1134
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}} // namespace gui::model
|
|
||||||
#endif /*GUI_MODEL_TEST_ELEMENT_ACCESS_H*/
|
|
||||||
|
|
|
||||||
|
|
@ -12872,12 +12872,14 @@
|
||||||
<linktarget COLOR="#97db97" DESTINATION="ID_1568226158" ENDARROW="Default" ENDINCLINATION="226;0;" ID="Arrow_ID_26754858" SOURCE="ID_1400754551" STARTARROW="None" STARTINCLINATION="277;-10;"/>
|
<linktarget COLOR="#97db97" DESTINATION="ID_1568226158" ENDARROW="Default" ENDINCLINATION="226;0;" ID="Arrow_ID_26754858" SOURCE="ID_1400754551" STARTARROW="None" STARTINCLINATION="277;-10;"/>
|
||||||
<icon BUILTIN="yes"/>
|
<icon BUILTIN="yes"/>
|
||||||
</node>
|
</node>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523222380124" ID="ID_1101595897" MODIFIED="1523228027969" TEXT="muß prüfen, ob der Cast möglich ist">
|
<node COLOR="#338800" CREATED="1523222380124" ID="ID_1101595897" MODIFIED="1523587710088" TEXT="muß prüfen, ob der Cast möglich ist">
|
||||||
<icon BUILTIN="flag-yellow"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
<node CREATED="1523229139923" ID="ID_636796034" MODIFIED="1523229481422" TEXT="Variant?">
|
<node CREATED="1523229139923" ID="ID_636796034" MODIFIED="1523229481422" TEXT="Variant?">
|
||||||
<icon BUILTIN="forward"/>
|
<icon BUILTIN="forward"/>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523229483619" ID="ID_1116388815" MODIFIED="1523232763524" TEXT="wohl einzige Lösung?"/>
|
<node COLOR="#338800" CREATED="1523229483619" ID="ID_1116388815" MODIFIED="1523587648174" TEXT="wohl einzige Lösung?">
|
||||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1523232748878" ID="ID_153055029" MODIFIED="1523232770707" TEXT="AUA --- geht auch nicht">
|
<icon BUILTIN="button_ok"/>
|
||||||
|
</node>
|
||||||
|
<node COLOR="#6c2525" CREATED="1523232748878" ID="ID_153055029" MODIFIED="1523587755516" TEXT="AUA --- geht auch nicht ohne Weiteres">
|
||||||
<icon BUILTIN="broken-line"/>
|
<icon BUILTIN="broken-line"/>
|
||||||
<node CREATED="1523232788680" ID="ID_849117954" MODIFIED="1523232797628" TEXT="Ändert nix am Grundproblem">
|
<node CREATED="1523232788680" ID="ID_849117954" MODIFIED="1523232797628" TEXT="Ändert nix am Grundproblem">
|
||||||
<icon BUILTIN="smily_bad"/>
|
<icon BUILTIN="smily_bad"/>
|
||||||
|
|
@ -12903,13 +12905,21 @@
|
||||||
<node CREATED="1523232945043" ID="ID_45452812" MODIFIED="1523232954053" TEXT="erst zur Laufzeit wissen wir, was zurückkommt"/>
|
<node CREATED="1523232945043" ID="ID_45452812" MODIFIED="1523232954053" TEXT="erst zur Laufzeit wissen wir, was zurückkommt"/>
|
||||||
<node CREATED="1523233007258" ID="ID_1076174983" MODIFIED="1523233019060" TEXT="aber zur Compilezeit müssen wir schon den Cast vorbereiten"/>
|
<node CREATED="1523233007258" ID="ID_1076174983" MODIFIED="1523233019060" TEXT="aber zur Compilezeit müssen wir schon den Cast vorbereiten"/>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1523233031479" ID="ID_1135973571" MODIFIED="1523233048184" TEXT="Idee: Visitor spezialisieren">
|
<node COLOR="#338800" CREATED="1523233031479" ID="ID_1135973571" MODIFIED="1523587851464" TEXT="Idee: Visitor spezialisieren">
|
||||||
<node CREATED="1523233049316" ID="ID_278890079" MODIFIED="1523233057943" TEXT="er implementiert überhaupt nur den Fall, der geht"/>
|
<linktarget COLOR="#3f6796" DESTINATION="ID_1135973571" ENDARROW="Default" ENDINCLINATION="-62;1;" ID="Arrow_ID_290291364" SOURCE="ID_1510464943" STARTARROW="None" STARTINCLINATION="8;-34;"/>
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
|
<node CREATED="1523233049316" ID="ID_278890079" MODIFIED="1523396787384" TEXT="er implementiert überhaupt nur den Fall, der geht">
|
||||||
|
<icon BUILTIN="idea"/>
|
||||||
|
</node>
|
||||||
|
<node CREATED="1523587774453" ID="ID_887720572" MODIFIED="1523587792039" TEXT="in allen anderen Fällen bleibt der Result-Proxy leer"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1523229496001" ID="ID_190653452" MODIFIED="1523229516738" TEXT="bedeutet...">
|
<node CREATED="1523229496001" ID="ID_190653452" MODIFIED="1523229516738" TEXT="bedeutet...">
|
||||||
<icon BUILTIN="messagebox_warning"/>
|
<icon BUILTIN="messagebox_warning"/>
|
||||||
<node CREATED="1523229517523" ID="ID_1510464943" MODIFIED="1523229517523" TEXT="Variant-Visitor"/>
|
<node CREATED="1523229517523" ID="ID_1510464943" MODIFIED="1523587856731" TEXT="Variant-Visitor">
|
||||||
|
<arrowlink COLOR="#3f6796" DESTINATION="ID_1135973571" ENDARROW="Default" ENDINCLINATION="-62;1;" ID="Arrow_ID_290291364" STARTARROW="None" STARTINCLINATION="8;-34;"/>
|
||||||
|
</node>
|
||||||
|
<node CREATED="1523587686010" ID="ID_533196954" MODIFIED="1523587697908" TEXT="trickreiches Metaprogramming"/>
|
||||||
<node CREATED="1523229519846" ID="ID_307916731" MODIFIED="1523229533208" TEXT="Einschränkungen für die Test-Dummies"/>
|
<node CREATED="1523229519846" ID="ID_307916731" MODIFIED="1523229533208" TEXT="Einschränkungen für die Test-Dummies"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
|
@ -12920,7 +12930,7 @@
|
||||||
<node CREATED="1523225025493" ID="ID_1731501078" MODIFIED="1523225070764" TEXT="der interne Aufruf kann einen Pointer liefern">
|
<node CREATED="1523225025493" ID="ID_1731501078" MODIFIED="1523225070764" TEXT="der interne Aufruf kann einen Pointer liefern">
|
||||||
<icon BUILTIN="idea"/>
|
<icon BUILTIN="idea"/>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1523225052314" ID="ID_271482556" MODIFIED="1523225066889" TEXT="die Aufrufschnittstelle stellt NULL-Check sicher">
|
<node COLOR="#338800" CREATED="1523225052314" ID="ID_271482556" MODIFIED="1523587734563" TEXT="die Aufrufschnittstelle stellt NULL-Check sicher">
|
||||||
<icon BUILTIN="yes"/>
|
<icon BUILTIN="yes"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue