ElementAccess: somewhat improve the mock implementation to cover the standard case
...still quite braindead, but well....
This commit is contained in:
parent
c9dc9264b4
commit
86b1aac721
3 changed files with 61 additions and 25 deletions
|
|
@ -119,6 +119,9 @@ namespace test {
|
|||
}
|
||||
|
||||
|
||||
/** @test the standard use case is to create one new child node
|
||||
* below an existing path (widget) within the UI
|
||||
*/
|
||||
void
|
||||
verify_standardUsage()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,9 +23,15 @@
|
|||
|
||||
/** @file test-element-access.hpp
|
||||
** Unit test helper for access to UI elements without actually running an UI.
|
||||
** This allows to cover functionality for resolving UI-coordinates against an UI topology
|
||||
** and accessing or creating elements. Obviously, only faked UI widgets can be returned,
|
||||
** but this does not matter for those features anyway.
|
||||
**
|
||||
** @note as of 1/2015 this is a first draft and WIP-WIP-WIP
|
||||
** @todo WIP ///////////////////////TICKET #1134
|
||||
** @note as of 4/2018 this is a first draft and WIP-WIP-WIP
|
||||
** @todo right now this test is braindead; the idea is to extend it similar to the
|
||||
** GenNodeLocationQuery eventually, so to mimic the way an actual implementation
|
||||
** would drill down into the UI topology. Yet at the moment (4/2018) we are still
|
||||
** far from implementing anything in this regard; we just need the interface... ///////////////////////////////TICKET #1134
|
||||
**
|
||||
** @see ElementAccess_test usage example
|
||||
** @see elem-access-dir.hpp real implementation
|
||||
|
|
@ -41,20 +47,24 @@
|
|||
#include "gui/model/element-access.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 <string>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace test {
|
||||
namespace error = lumiera::error;
|
||||
|
||||
// using util::isnil;
|
||||
// using std::string;
|
||||
using std::string;
|
||||
using lib::Literal;
|
||||
using interact::UICoord;
|
||||
using interact::UIC_VIEW;
|
||||
using interact::UIC_TAB;
|
||||
|
||||
|
||||
|
||||
|
|
@ -64,20 +74,28 @@ namespace test {
|
|||
class DummyWidget
|
||||
: public MockElm
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
virtual ~DummyWidget() { } ///< is an interface
|
||||
DummyWidget()
|
||||
: MockElm("DummyWidget")
|
||||
|
||||
DummyWidget(string name ="DummyWidget")
|
||||
: MockElm{name}
|
||||
{ }
|
||||
DummyWidget(Literal name)
|
||||
: DummyWidget{string (name)}
|
||||
{ }
|
||||
};
|
||||
|
||||
class DummyTab
|
||||
: public DummyWidget
|
||||
{ };
|
||||
struct DummyTab
|
||||
: DummyWidget
|
||||
{
|
||||
using DummyWidget::DummyWidget;
|
||||
};
|
||||
|
||||
class DummyView
|
||||
: public DummyWidget
|
||||
{ };
|
||||
struct DummyView
|
||||
: DummyWidget
|
||||
{
|
||||
using DummyWidget::DummyWidget;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
@ -109,7 +127,18 @@ namespace test {
|
|||
RawResult
|
||||
performAccessTo (UICoord const& target, size_t limitCreation) override
|
||||
{
|
||||
CHECK (target <= existingPath);
|
||||
CHECK (existingPath >= target);
|
||||
if (existingPath > target and !response)
|
||||
{
|
||||
if (target.size()-1 == UIC_VIEW)
|
||||
response.reset(new DummyView(target[UIC_VIEW]));
|
||||
else
|
||||
if (target.size()-1 == UIC_TAB)
|
||||
response.reset(new DummyTab(target[UIC_TAB]));
|
||||
else
|
||||
throw error::Invalid("Mock ElementAccess supports only creation of VIEW and TAB. Requested Target was "+string(target));
|
||||
}
|
||||
|
||||
return response.get();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12846,8 +12846,8 @@
|
|||
<icon BUILTIN="hourglass"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523222204556" ID="ID_1018012203" MODIFIED="1523222419178" TEXT="Ergebnis-Ausgabe">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1523222204556" ID="ID_1018012203" MODIFIED="1523670938347" TEXT="Ergebnis-Ausgabe">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1523222214579" ID="ID_1568226158" MODIFIED="1523224303183" STYLE="fork" TEXT="Feststellung: keine Status-Rückmeldung">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
|
@ -12954,10 +12954,14 @@
|
|||
<node CREATED="1523118613096" ID="ID_169844591" MODIFIED="1523118623074" TEXT="== Vorarbeit für die spätere Implementierung"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523663840577" ID="ID_1523982995" MODIFIED="1523663860831" TEXT="Mock-Widget-Erzeugung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1523663862182" ID="ID_937721725" MODIFIED="1523663879959" TEXT="besser in die Mock-Service-Impl verlegen"/>
|
||||
<node CREATED="1523663880731" ID="ID_1244735047" MODIFIED="1523663886894" TEXT="von dort nachprüfbar machen"/>
|
||||
<node COLOR="#338800" CREATED="1523663840577" ID="ID_1523982995" MODIFIED="1523670899095" TEXT="Mock-Widget-Erzeugung">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1523663862182" ID="ID_937721725" MODIFIED="1523670907629" TEXT="besser in die Mock-Service-Impl verlegen">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1523663880731" ID="ID_1244735047" MODIFIED="1523670903598" TEXT="von dort nachprüfbar machen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1523118660882" ID="ID_1452843558" MODIFIED="1523118677304" TEXT="Testfälle">
|
||||
|
|
@ -12965,8 +12969,8 @@
|
|||
<node COLOR="#338800" CREATED="1523205670160" ID="ID_649704431" MODIFIED="1523663805752" TEXT="einfacher Zugriff auf existierendes Objekt">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523205706547" ID="ID_210608554" MODIFIED="1523205776609" TEXT="Zugriff auf Parent-Ebene, ein Kind-Knoten wird erzeugt">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1523205706547" ID="ID_210608554" MODIFIED="1523670915381" TEXT="Zugriff auf Parent-Ebene, ein Kind-Knoten wird erzeugt">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523205752509" ID="ID_212194424" MODIFIED="1523205775730" TEXT="partielle oder komplette Erzeugung eines Pfades">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
@ -13155,8 +13159,8 @@
|
|||
<arrowlink COLOR="#715f85" DESTINATION="ID_329609486" ENDARROW="Default" ENDINCLINATION="-368;-2533;" ID="Arrow_ID_575977434" STARTARROW="None" STARTINCLINATION="1555;-260;"/>
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1487313191100" ID="ID_1619021408" MODIFIED="1518487921076" TEXT="Fazit(TODO)">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1487313191100" ID="ID_1619021408" MODIFIED="1523670995386" TEXT="Fazit(TODO)">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
<node CREATED="1487313203254" ID="ID_573801539" MODIFIED="1518487921076" TEXT="Klassen anlegen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1487313231355" ID="ID_1566121505" MODIFIED="1518487921076" TEXT="WorkSite">
|
||||
|
|
|
|||
Loading…
Reference in a new issue