draft test for mesage dispatch to UI-Elements

seems to work already, just there is some mismatch
in the test verification code
This commit is contained in:
Fischlurch 2016-02-11 16:19:24 +01:00
parent 0964e56c49
commit e9a649ff63
3 changed files with 62 additions and 4 deletions

View file

@ -873,6 +873,13 @@ namespace test{
return matcher;
}
template<typename X>
EventMatch
verifyEvent (string classifier, X const& something) const
{
return verifyEvent (classifier, util::toString (something));
}
/** start a query to match especially a function call
* @param match text to match against the function name
*/

View file

@ -77,6 +77,9 @@ namespace gui {
namespace model{
namespace test {
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using ID = lib::idi::BareEntryID const&;
namespace { // test fixture...
// dummy operation to be invoked through the command system
@ -176,7 +179,7 @@ namespace test {
{
verify_mockManipulation();
invokeCommand();
markState();
// markState(); ////////////////////////////////////////////////////////////TODO: WIP
notify();
mutate();
}
@ -380,12 +383,53 @@ namespace test {
}
/** @test receive various kinds of notifications
* Send message, error and flash messages via Bus to the element
* and verify the doMsg, doErr or doFlash handlers were invoked.
*/
void
notify ()
{
UNIMPLEMENTED ("receive various kinds of notifications");
// send msg, error and flash messages via Bus to the element
// verify the doMsg, doErr or doFlash get invoked
MARK_TEST_FUN
EventLog nexusLog = gui::test::Nexus::startNewLog();
MockElm mock("target");
ID targetID = mock.getID();
auto& uiBus = gui::test::Nexus::testUI();
CHECK (mock.ensureNot("Flash"));
CHECK (mock.ensureNot("Error"));
CHECK (mock.ensureNot("Message"));
uiBus.mark(targetID, GenNode{"Flash", true });
////////////////////////////////////////////////////////////TODO: WIP
cout << "____Event-Log_________________\n"
<< util::join(mock.getLog(), "\n")
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
cout << "____Nexus-Log_________________\n"
<< util::join(gui::test::Nexus::getLog(), "\n")
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
////////////////////////////////////////////////////////////TODO: WIP
CHECK (mock.verifyMark("Message", true ));
CHECK (mock.ensureNot("Error"));
CHECK (mock.ensureNot("Message"));
uiBus.mark(targetID, GenNode{"Error", "getting serious"});
CHECK (mock.verifyMark("Message", "serious"));
uiBus.mark(targetID, GenNode{"Message", "mistake"});
CHECK (mock.verifyMark("Message", "mistake"));
CHECK (mock.verify("target")
.before("true")
.before("serious")
.before("mistake"));
VERIFY_ERROR(WRONG_TYPE, uiBus.mark(targetID, GenNode{"Message", false }))
}

View file

@ -312,6 +312,13 @@ namespace test{
return getLog().verifyEvent("mark", payloadMatch).type("mark").id(id);
}
template<typename X>
EventMatch
verifyMark (string id, X const& something) const
{
return getLog().verifyEvent("mark", something).type("mark").id(id);
}
EventLog const&
getLog() const