ElementAccess: fix first unit test case
ouch, the typedef Base /is/ already a pointer...
This commit is contained in:
parent
4c273d902c
commit
4071a58454
4 changed files with 19 additions and 15 deletions
|
|
@ -67,7 +67,6 @@ namespace ctrl{
|
|||
*/
|
||||
class ElemAccessDir
|
||||
: public model::ElementAccess
|
||||
, ::util::NonCopyable
|
||||
{
|
||||
WindowLocator& windowLoc_;
|
||||
PanelLocator& panelLoc_;
|
||||
|
|
@ -84,7 +83,7 @@ namespace ctrl{
|
|||
/* == ElementAccess interface == */
|
||||
|
||||
RawResult
|
||||
performAccessTo (UICoord, size_t limitCreation) override
|
||||
performAccessTo (UICoord const&, size_t limitCreation) override
|
||||
{
|
||||
UNIMPLEMENTED ("implementation of access function based on real UI widgets");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,17 +102,17 @@ namespace model {
|
|||
/* == Access by Location == */
|
||||
|
||||
template<class TAR>
|
||||
Result<TAR&> access (UICoord destination);
|
||||
Result<TAR&> access (UICoord const& destination);
|
||||
|
||||
template<class TAR>
|
||||
Result<TAR&> access_or_create (UICoord destination, size_t limitCreation = LUMIERA_MAX_ORDINAL_NUMBER);
|
||||
Result<TAR&> access_or_create (UICoord const& destination, size_t limitCreation = LUMIERA_MAX_ORDINAL_NUMBER);
|
||||
|
||||
|
||||
protected:
|
||||
using RawResult = lib::Variant<Types<model::Tangible*, Gtk::Widget*>>;
|
||||
|
||||
/** @internal drill down according to coordinates, maybe create element */
|
||||
virtual RawResult performAccessTo (UICoord, size_t limitCreation) =0;
|
||||
virtual RawResult performAccessTo (UICoord const&, size_t limitCreation) =0;
|
||||
|
||||
private:
|
||||
template<class TAR>
|
||||
|
|
@ -149,13 +149,13 @@ namespace model {
|
|||
// we know then the following dynamic_cast (downcast) can succeed
|
||||
using Base = typename RawResult::FirstMatching<canUpcast>::Type;
|
||||
|
||||
void
|
||||
accept (Base* pb)
|
||||
virtual void
|
||||
handle (Base& pb) override
|
||||
{
|
||||
if (pb)
|
||||
result = *dynamic_cast<TAR*> (pb);
|
||||
else
|
||||
result = "access returns empty answer";
|
||||
result = Result<TAR&>{"access returns empty answer"};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ namespace model {
|
|||
*/
|
||||
template<class TAR>
|
||||
inline ElementAccess::Result<TAR&>
|
||||
ElementAccess::access (UICoord destination)
|
||||
ElementAccess::access (UICoord const& destination)
|
||||
{
|
||||
return access_or_create<TAR> (destination, 0);
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ namespace model {
|
|||
*/
|
||||
template<class TAR>
|
||||
inline ElementAccess::Result<TAR&>
|
||||
ElementAccess::access_or_create (UICoord destination, size_t limitCreation)
|
||||
ElementAccess::access_or_create (UICoord const& destination, size_t limitCreation)
|
||||
{
|
||||
TypeConverter<TAR> converter;
|
||||
RawResult targetElm = performAccessTo (destination, limitCreation);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace test {
|
|||
/* == ElementAccess interface == */
|
||||
|
||||
RawResult
|
||||
performAccessTo (UICoord target, size_t limitCreation) override
|
||||
performAccessTo (UICoord const& target, size_t limitCreation) override
|
||||
{
|
||||
CHECK (target == expectedQuery);
|
||||
return expectedAnswer;
|
||||
|
|
|
|||
|
|
@ -12939,8 +12939,8 @@
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523053336219" ID="ID_1234019560" MODIFIED="1523205867255" TEXT="ElementAccess_test">
|
||||
<linktarget COLOR="#43667c" DESTINATION="ID_1234019560" ENDARROW="Default" ENDINCLINATION="-338;-1489;" ID="Arrow_ID_839730277" SOURCE="ID_1539184761" STARTARROW="None" STARTINCLINATION="-530;453;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523118534675" ID="ID_669651266" MODIFIED="1523118659130" TEXT="Mock-Implementierung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523118534675" ID="ID_669651266" MODIFIED="1523663819813" TEXT="Mock-Implementierung">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1523118577557" ID="ID_1246038265" MODIFIED="1523118589479" TEXT="Mock-Prinzip">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1523118591395" ID="ID_1571065062" MODIFIED="1523118636465" TEXT="vorgefertigter Response">
|
||||
|
|
@ -12954,11 +12954,16 @@
|
|||
<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>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1523118660882" ID="ID_1452843558" MODIFIED="1523118677304" TEXT="Testfälle">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1523205670160" ID="ID_649704431" MODIFIED="1523205878512" TEXT="einfacher Zugriff auf existierendes Objekt">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<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"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue