50#ifndef STAGE_TEST_MOCK_ELM_H
51#define STAGE_TEST_MOCK_ELM_H
135 return Tangible::doExpand (yes);
142 Tangible::doReveal();
149 cout << this->
identify() <<
" <-- Message(\""<<text<<
"\")" <<endl;
152 log_.
note (
"type=mark",
"ID=Message", text);
165 log_.
note (
"type=mark",
"ID=Message",
"Message notification cleared");
173 cerr << this->
identify() <<
" <-- Error(\""<<text<<
"\")" <<endl;
176 log_.
note (
"type=mark",
"ID=Error", text);
189 log_.
note (
"type=mark",
"ID=Error",
"Error state cleared");
197 cout << this->
identify() <<
" <-- Flash!" <<endl;
198 log_.
note (
"type=mark",
"ID=Flash");
205 cout << this->
identify() <<
" <-- state-mark = "<< mark <<endl;
211 Tangible::doMark (
mark);
217 using Attrib = std::pair<const string,string>;
218 using lib::diff::collection;
219 using lib::diff::render;
222 cout << this->
identify() <<
" <-- DIFF" <<endl;
226 .attach (collection(
scope)
227 .isApplicableIf ([&](
GenNode const& spec) ->
bool
233 return spec.
idi == elm->getID();
238 PMockElm child = std::make_unique<MockElm>(spec.
idi, this->uiBus_);
239 child->joinLog(*
this);
244 if (target->getID() != subID)
return false;
245 target->buildMutator (buff);
249 .attach (collection(
attrib)
250 .isApplicableIf ([&](
GenNode const& spec) ->
bool
255 .matchElement ([&](
GenNode const& spec, Attrib
const& elm) ->
bool
259 .constructFrom ([&](
GenNode const& spec) -> Attrib
262 val{render(spec.
data)};
263 log_.
event(
"diff",
"++Attrib++ "+key+
" = "+val);
266 .assignElement ([&](Attrib& target,
GenNode const& spec) ->
bool
269 newVal{render (spec.
data)};
270 log_.
event(
"diff",
"set Attrib "+key+
" <-"+newVal);
271 target.second = newVal;
320 cerr <<
"Error while logging shutdown of Mock-UI-Element: " << errID <<endl;
322 cerr <<
"Unknown Error while logging shutdown of Mock-UI-Element." <<endl;
346 log_.
event (
string(
getID()) +
" successfully connected to zombie bus");
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
SUB & emplace(SUB &&implementation)
move-construct an instance of a subclass into the opaque buffer
Token or Atom with distinct identity.
bool isNested() const
determine if payload constitutes a nested scope ("object")
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...
static Builder< TreeMutator > build()
DSL: start building a custom adapted tree mutator, where the operations are tied by closures or wrapp...
string const & getSym() const
Helper to log and verify the occurrence of events.
EventLog & destroy(string text)
Log the destruction of an object.
EventLog & event(string text)
log some text as event
EventMatch verify(string match) const
start a query to match for some substring.
EventMatch verifyCall(string match) const
start a query to match especially a function call
EventMatch verifyEvent(string match) const
start a query to match for some event.
EventLog & joinInto(EventLog &otherLog)
Merge this log into another log, forming a combined log.
EventMatch verifyMatch(string regExp) const
start a query to match with a regular expression
EventLog & create(string text)
Log the creation of an object.
EventMatch ensureNot(string match) const
start a query to ensure the given expression does not match.
EventLog & note(ELMS const &...initialiser)
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
EventMatch & type(string typeID)
refine filter to additionally require a matching log entry type
EventMatch & id(string classifier)
refine filter to additionally match on the ID attribute
connection point at the UI-Bus.
Interface common to all UI elements of relevance for the Lumiera application.
Tangible(ID identity, ctrl::BusTerm &nexus)
void installExpander(Expander::ProbeFun, Expander::ChangeFun)
Configure the (optional) functionality to expand or collapse the UI-Element.
void mark(GenNode const &)
generic handler for all incoming "state mark" messages
Mock UI element or controller.
virtual bool doClearErr() override
virtual bool doReset() override
virtual bool doMsg(string text) override
virtual void doReveal() override
generic default implementation of the "reveal" functionality.
virtual void doMark(GenNode const &mark) override
default implementation and catch-all handler for receiving »state mark« messages.
string getMessage() const
virtual void doFlash() override
EventMatch verifyEvent(string classifier, string match) const
MockElm(ID identity, ctrl::BusTerm &nexus=Nexus::testUI())
EventMatch verifyMark(string id) const
special verification match on a "state mark" message to this element
EventMatch verifyMark(string id, string payloadMatch) const
verification match on a specific "state mark" message
~MockElm()
document our death in the diagnostic log.
EventLog const & getLog() const
virtual bool doExpand(bool yes) override
generic default implementation of the expand/collapse functionality.
EventMatch verify(string match) const
virtual void buildMutator(TreeMutator::Handle buffer) override
build a custom implementation of the TreeMutator interface, suitably wired to cause appropriate chang...
std::map< string, string > attrib
std::vector< PMockElm > scope
void kill()
commit suicide.
EventMatch verifyCall(string match) const
EventMatch verifyEvent(string match) const
virtual bool doClearMsg() override
EventMatch verifyMatch(string regExp) const
EventLog & joinLog(EventLog &otherLog)
EventMatch verifyMark(string id, X const &something) const
EventMatch ensureNot(string match) const
EventLog & joinLog(MockElm &otherMock)
virtual bool doErr(string text) override
static ctrl::BusTerm & testUI()
get a connection point to a UI backbone faked for test
static void zombificate(ctrl::BusTerm &)
kill the given [BusTerm] and implant a dead terminal in place
lumiera_err lumiera_error(void)
Get and clear current error state.
Lumiera error handling (C++ interface).
Support for verifying the occurrence of events from unit tests.
Generic functions to build identification schemes.
string instanceTypeID(const TY *const obj)
designation of an distinct object instance
Implementation namespace for support and library code.
std::unique_ptr< MockElm > PMockElm
Lumiera GTK UI implementation root.
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Special collection to represent object-like data.
generic data element node within a tree
Marker types to indicate a literal string and a Symbol.
Abstraction: a tangible element of the User Interface.
Diagnostic helper for unit tests regarding mutation of custom data.
A fake UI backbone for investigations and unit testing.
Hard wired key constants and basic definitions for communication with the GUI.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...