From e9a649ff63d231fcee508f03633c72ac676d9ee0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 11 Feb 2016 16:19:24 +0100 Subject: [PATCH] draft test for mesage dispatch to UI-Elements seems to work already, just there is some mismatch in the test verification code --- src/lib/test/event-log.hpp | 7 ++++ tests/gui/abstract-tangible-test.cpp | 52 +++++++++++++++++++++++++--- tests/gui/test/mock-elm.hpp | 7 ++++ 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/lib/test/event-log.hpp b/src/lib/test/event-log.hpp index dbde03ac7..9c2aeac63 100644 --- a/src/lib/test/event-log.hpp +++ b/src/lib/test/event-log.hpp @@ -873,6 +873,13 @@ namespace test{ return matcher; } + template + 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 */ diff --git a/tests/gui/abstract-tangible-test.cpp b/tests/gui/abstract-tangible-test.cpp index 12c857ffa..fbe6d89c3 100644 --- a/tests/gui/abstract-tangible-test.cpp +++ b/tests/gui/abstract-tangible-test.cpp @@ -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───╼━━━━━━━━━╾────────────────"< + EventMatch + verifyMark (string id, X const& something) const + { + return getLog().verifyEvent("mark", something).type("mark").id(id); + } + EventLog const& getLog() const