provide and cover a mock implementation of receiving notification messages
This commit is contained in:
parent
3c24b4f8e4
commit
b9ef66b221
5 changed files with 81 additions and 30 deletions
|
|
@ -273,6 +273,9 @@ namespace util {
|
|||
_RangeIter(IT&& srcIter)
|
||||
: iter(std::forward<IT>(srcIter))
|
||||
{ }
|
||||
_RangeIter(IT const& srcIter)
|
||||
: iter(srcIter)
|
||||
{ }
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -298,7 +301,7 @@ namespace util {
|
|||
|
||||
std::function<string(Val const&)> toString = [] (Val const& val) { return str(val); };
|
||||
|
||||
_RangeIter<Coll> range(std::forward<Coll>(coll));
|
||||
_RangeIter<Coll> range(std::forward<CON>(coll));
|
||||
auto strings = lib::transformIterator(range.iter, toString);
|
||||
|
||||
if (!strings) return "";
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
|
||||
//#include <boost/lexical_cast.hpp>
|
||||
//#include <iostream>
|
||||
#include <iostream>
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
|
||||
|
|
@ -67,8 +67,8 @@ using lib::idi::EntryID;
|
|||
//using boost::lexical_cast;
|
||||
//using util::contains;
|
||||
//using std::string;
|
||||
//using std::cout;
|
||||
//using std::endl;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
||||
|
||||
|
|
@ -156,12 +156,12 @@ namespace test {
|
|||
CHECK (!mock.isTouched());
|
||||
CHECK (!mock.isExpanded());
|
||||
|
||||
mock.markMsg("dolorem ipsum quia dolor sit amet consectetur adipisci velit.");
|
||||
CHECK (mock.verifyNote("Msg"));
|
||||
CHECK (mock.verifyCall("noteMsg"));
|
||||
CHECK (mock.verifyCall("noteMsg").arg("lorem ipsum"));
|
||||
CHECK (mock.verifyCall("noteMsg").argMatch("dolor.+dolor\\s+"));
|
||||
CHECK (mock.verifyMatch("Rec\\(note.+kind = Msg.+msg = dolorem ipsum"));
|
||||
mock.markMsg("qui dolorem ipsum quia dolor sit amet consectetur adipisci velit.");
|
||||
CHECK (mock.verifyMark("Message", "dolor"));
|
||||
CHECK (mock.verifyCall("doMsg"));
|
||||
CHECK (mock.verifyCall("doMsg").arg("lorem ipsum"));
|
||||
CHECK (mock.verifyCall("doMsg").argMatch("dolor.+dolor\\s+"));
|
||||
CHECK (mock.verifyMatch("Rec\\(mark.+ID = Message.+\\{.+lorem ipsum"));
|
||||
|
||||
EventLog log = mock.getLog();
|
||||
log.verify("ctor")
|
||||
|
|
@ -179,6 +179,9 @@ namespace test {
|
|||
|
||||
bar.joinLog(mock);
|
||||
foo.joinLog(mock);
|
||||
cout << "____Event-Log________________\n"
|
||||
<< util::join(mock.getLog(), "\n")
|
||||
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
|
||||
CHECK (log.verifyEvent("logJoin").arg("bar")
|
||||
.beforeEvent("logJoin").arg("foo"));
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
#include "lib/diff/record.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "test/test-nexus.hpp"
|
||||
#include "lib/symbol.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
|
@ -66,7 +69,11 @@ namespace test{
|
|||
// using util::isnil;
|
||||
// using lib::idi::EntryID;
|
||||
// using lib::diff::Record;
|
||||
using lib::Symbol;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -108,7 +115,7 @@ namespace test{
|
|||
log_.call(this->identify(), "expand", yes);
|
||||
virgin_ = false;
|
||||
expanded_ = yes;
|
||||
log_.event(expanded_? "expanded" : "collapsed");
|
||||
log_.event (expanded_? "expanded" : "collapsed");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -127,25 +134,33 @@ namespace test{
|
|||
virtual void
|
||||
doMsg (string text) override
|
||||
{
|
||||
UNIMPLEMENTED ("mock doMsg");
|
||||
log_.call (this->identify(), "doMsg", text);
|
||||
cout << this->identify() << " <-- Message(\""<<text<<"\")" <<endl;
|
||||
log_.note ("type=mark", "ID=Message", text);
|
||||
}
|
||||
|
||||
virtual void
|
||||
doErr (string text) override
|
||||
{
|
||||
UNIMPLEMENTED ("mock doErr");
|
||||
log_.call (this->identify(), "doErr", text);
|
||||
cerr << this->identify() << " <-- Error(\""<<text<<"\")" <<endl;
|
||||
log_.note ("type=mark", "ID=Error", text);
|
||||
}
|
||||
|
||||
virtual void
|
||||
doFlash() override
|
||||
{
|
||||
UNIMPLEMENTED ("mock doFlash");
|
||||
log_.call (this->identify(), "doFlash");
|
||||
cout << this->identify() << " <-- Flash!" <<endl;
|
||||
log_.note ("type=mark", "ID=Flash");
|
||||
}
|
||||
|
||||
virtual void
|
||||
doMark (GenNode const& mark) override
|
||||
{
|
||||
UNIMPLEMENTED ("mock doMark");
|
||||
log_.call (this->identify(), "doMark");
|
||||
cout << this->identify() << " <-- state-mark = "<< string(mark) <<endl;
|
||||
log_.note ("type=mark", "ID="+mark.idi.getSym(), mark);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -153,7 +168,7 @@ namespace test{
|
|||
string
|
||||
identify() const
|
||||
{
|
||||
return lib::idi::instanceTypeID(this) +"-"+getID().getSym();
|
||||
return getID().getSym() +"."+ lib::idi::instanceTypeID(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,11 +252,21 @@ namespace test{
|
|||
return getLog().ensureNot(match);
|
||||
}
|
||||
|
||||
/** special verification match on a "note" message to this element */
|
||||
/** special verification match on a "state mark" message to this element */
|
||||
EventMatch
|
||||
verifyNote (string msgContentMatch) const
|
||||
verifyMark (string msgContentMatch) const
|
||||
{
|
||||
UNIMPLEMENTED ("generic match");
|
||||
return getLog().verifyEvent("mark", msgContentMatch);
|
||||
}
|
||||
|
||||
/** verification match on a specific "state mark" message
|
||||
* @param id the ID-symbol used, identifying the kind of notification message
|
||||
* @param payloadMatch to be applied to the payload of the message solely
|
||||
*/
|
||||
EventMatch
|
||||
verifyMark (string id, string payloadMatch) const
|
||||
{
|
||||
return getLog().verifyEvent("mark", payloadMatch).type("mark").id(id);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8393,7 +8393,7 @@ The UI-Bus has a star shaped topology, with a central "bus master" hub
|
|||
:down-link communication to //feed back// state updates or to replay previously recorded //state marks//
|
||||
</pre>
|
||||
</div>
|
||||
<div title="UI-Element" creator="Ichthyostega" modifier="Ichthyostega" created="201511210307" modified="201512252349" tags="GuiPattern design draft decision" changecount="28">
|
||||
<div title="UI-Element" creator="Ichthyostega" modifier="Ichthyostega" created="201511210307" modified="201512260017" tags="GuiPattern design draft decision" changecount="40">
|
||||
<pre>While our UI widgets are implemented the standard way as proposed by [[GTKmm|http://www.gtkmm.org/en/documentation.html]], some key elements -- which are especially relevant for the anatomy and mechanics of the interface at a whole -- are made to conform to a common interface and behaviour protocol. {{red{WIP 11/15 work out gradually what this protocol is all about}}}. #975
|
||||
As a starting point, we know
|
||||
* there is a backbone structure known as the UI-Bus
|
||||
|
|
@ -8417,12 +8417,14 @@ These manipulations in itself do not constitute an action. But there typically i
|
|||
|
||||
A special case of state marking is the presentation of transient feedback. Such feedback is pushed from "somewhere" towards given elements, which react through an implementation dependent visual state change (flushing, colour change, marker icon). If such state marking is to be persistent, the interface element has in turn to send a specific state mark. An example would be a permanent error flag with a explanatory text showed in mouse over. Which in turn means there can also be sweeping state reset messages, which are to be broadcasted: A general "reset", an indication to collapse everything, or to clear pending error flags.
|
||||
|
||||
And finally, there are the //essential updates// -- any changes in the model //for real.// These are sent as notifications just to some top level element, expecting this element to request a diff and to recursively mutate contents into shape.
|
||||
And finally, there are the //essential updates// -- any changes in the model //for real.//
|
||||
These are sent as notifications just to some top level element, expecting this element to request a diff and to mutate contents into shape recursively.
|
||||
|
||||
|
||||
!Interactions
|
||||
;new
|
||||
:connect to an existing term, supply the {{{EntryID}}} of the new element
|
||||
;lifecycle
|
||||
:connect to an existing term, supply the {{{EntryID}}} of the new element.
|
||||
:automatically detach at end of life.
|
||||
;act
|
||||
:send a GenNode representing the action
|
||||
;note
|
||||
|
|
@ -8431,8 +8433,8 @@ And finally, there are the //essential updates// -- any changes in the model //f
|
|||
:receive a GenNode representing the //feedback// or replayed //state mark//
|
||||
;signals
|
||||
:the individual element exposes some generic signal slots
|
||||
:* slotExpand prompts the element to transition into expanded / unfolded state. If this state is sticky, the element should answer with a ''mark''
|
||||
:* slotReveal prompts the element to bring the indicated child into sight
|
||||
:* slotExpand prompts the element to transition into expanded / unfolded state. If this state is to be sticky, the element answers with a ''state mark''
|
||||
:* slotReveal prompts the element to bring the indicated child into sight. Typically, this request will "bubble up" recursively.
|
||||
:these slots are defined to be {{{sigc::trackable}}} for automated disconnection (&rarr; see [[#940|http://issues.lumiera.org/ticket/940#comment:3]] for an explanation)
|
||||
;diff
|
||||
:ask to retrieve a diff, which
|
||||
|
|
@ -8448,7 +8450,7 @@ While the above definitions might seem more or less obvious and reasonable, ther
|
|||
&rarr; [[Command handling (Proc-Layer)|CommandHandling]]
|
||||
|
||||
!!!actual implementation of command invocation
|
||||
The {{{InvocationTrail}}} of an command is actually just a tag object, wrapping the command definition ID. In a first step, when the arguments can be closed, a {{{Record}}} with suitable bindings is created and wrapped into a {{{GenNode}}} corresponding to the command. This compound is sent over the UI-Bus, marking the command ready for execution. From this point on, just the {{{InvocationTrail}}} is passed to enable the trigger sites. When it is triggered, just a "bang!" message with the command ID is sent over the bus. An command instance can be re-used, as long as it is structurally the same as before, and as log as there is no possible collision with a similar, but differently parametrised instantiation process.
|
||||
A command's {{{InvocationTrail}}} is in fact just some tag object, wrapping the command definition ID. In a first step, when the command's arguments can be //closed,// a {{{Record}}} with suitable argument bindings is created and wrapped into a {{{GenNode}}} corresponding to the command. We should note that these bindings typically also entail to specify the //subject of the command.// This binding compound is sent over the UI-Bus, marking the command ready for execution. From this point on, just the {{{InvocationTrail}}} is passed to enable the trigger sites. When it is actually triggered, a simple "bang!" message with the command ID is sent over the bus. A given command instance may be re-used, as long as it is structurally the same as before, and as log as there is no possible collision with a similar, but differently parametrised instantiation process.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="ViewConnection" modifier="Ichthyostega" created="201105221854" modified="201501091154" tags="def Model SessionLogic" changecount="3">
|
||||
|
|
|
|||
|
|
@ -185,6 +185,23 @@
|
|||
</html></richcontent>
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1448659456882" ID="ID_946761955" MODIFIED="1448659469420" TEXT="Notwendig: Command-Name + Varargs"/>
|
||||
<node CREATED="1451093919426" ID="ID_56876272" MODIFIED="1451093932614" TEXT="generisch impliziert auch zentrale Definition">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1451093994135" ID="ID_1002329025" MODIFIED="1451094104862">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...wird sinnvoll im Rahmen von <font color="#8e11a1">InteractionControl</font>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<arrowlink COLOR="#b567c4" DESTINATION="ID_1009169288" ENDARROW="Default" ENDINCLINATION="254;0;" ID="Arrow_ID_200182911" STARTARROW="None" STARTINCLINATION="162;0;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1448659723879" ID="ID_197701429" MODIFIED="1448659728002" TEXT="UI-Grundverhalten">
|
||||
<node CREATED="1448659735557" ID="ID_1553949303" MODIFIED="1448659741744" TEXT="Falten / Expandieren"/>
|
||||
|
|
@ -204,7 +221,7 @@
|
|||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1448659021803" ID="ID_1800666256" MODIFIED="1448659025502" TEXT="nah an der Session"/>
|
||||
<node CREATED="1448659026042" ID="ID_831434285" MODIFIED="1448659032566" TEXT="ein Schnittstellen-Paket"/>
|
||||
<node CREATED="1448669306480" ID="ID_1009169288" MODIFIED="1448669482182">
|
||||
<node CREATED="1448669306480" ID="ID_1009169288" MODIFIED="1451094122356">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
|
|
@ -215,7 +232,8 @@
|
|||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#5f0ac8" DESTINATION="ID_329609486" ENDARROW="Default" ENDINCLINATION="219;-148;" ID="Arrow_ID_1101633958" STARTARROW="None" STARTINCLINATION="-205;4;"/>
|
||||
<arrowlink COLOR="#5f0ac8" DESTINATION="ID_329609486" ENDARROW="Default" ENDINCLINATION="219;-148;" ID="Arrow_ID_1101633958" STARTARROW="None" STARTINCLINATION="-315;0;"/>
|
||||
<linktarget COLOR="#b567c4" DESTINATION="ID_1009169288" ENDARROW="Default" ENDINCLINATION="254;0;" ID="Arrow_ID_200182911" SOURCE="ID_1002329025" STARTARROW="None" STARTINCLINATION="162;0;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1448659051823" ID="ID_1995941804" MODIFIED="1448683546775" TEXT="dezentral">
|
||||
|
|
@ -404,8 +422,8 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1448669332204" HGAP="76" ID="ID_329609486" MODIFIED="1448669770746" TEXT="InteractionControl">
|
||||
<linktarget COLOR="#5f0ac8" DESTINATION="ID_329609486" ENDARROW="Default" ENDINCLINATION="219;-148;" ID="Arrow_ID_1101633958" SOURCE="ID_1009169288" STARTARROW="None" STARTINCLINATION="-205;4;"/>
|
||||
<node CREATED="1448669332204" HGAP="76" ID="ID_329609486" MODIFIED="1451094122356" TEXT="InteractionControl">
|
||||
<linktarget COLOR="#5f0ac8" DESTINATION="ID_329609486" ENDARROW="Default" ENDINCLINATION="219;-148;" ID="Arrow_ID_1101633958" SOURCE="ID_1009169288" STARTARROW="None" STARTINCLINATION="-315;0;"/>
|
||||
<font NAME="SansSerif" SIZE="15"/>
|
||||
<node CREATED="1448669439582" HGAP="41" ID="ID_307071507" MODIFIED="1448669726965" TEXT="ad-hoc oder systematisch" VSHIFT="-2">
|
||||
<icon BUILTIN="help"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue