From cbd69ea4fb67442f3e53405b3e62f6f0d6e439a4 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 14 Feb 2016 00:23:24 +0100 Subject: [PATCH] cover additional message/error diagnostics in MockElm NOTE: we don't have any "real" UI-Element implementation yet. Such would have to define its own, private error and message handling. It is likely that we'll end up with some kind of base implementation within model::Element and model::Controller. Anyhow, this is future work --- tests/gui/abstract-tangible-test.cpp | 19 ++++++++++++++++++- tests/gui/test/mock-elm.hpp | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/gui/abstract-tangible-test.cpp b/tests/gui/abstract-tangible-test.cpp index c80e59dc3..2577fc9f6 100644 --- a/tests/gui/abstract-tangible-test.cpp +++ b/tests/gui/abstract-tangible-test.cpp @@ -56,12 +56,13 @@ #include "lib/format-cout.hpp" #include "lib/symbol.hpp" #include "lib/error.hpp" -//#include "lib/util.hpp" +#include "lib/util.hpp" #include using lib::Symbol; +using util::isnil; using util::toString; using lib::time::Time; using gui::test::MockElm; @@ -512,6 +513,9 @@ namespace test { CHECK (mock.ensureNot("Flash")); CHECK (mock.ensureNot("Error")); CHECK (mock.ensureNot("Message")); + CHECK (isnil(mock.getMessage())); + CHECK (isnil(mock.getError())); + CHECK (not mock.isError()); // now send a "Flash" mark via UI-Bus.... uiBus.mark (targetID, GenNode{"Flash", true }); @@ -519,12 +523,19 @@ namespace test { CHECK (mock.ensureNot("Error")); CHECK (mock.ensureNot("Message")); + CHECK (isnil(mock.getMessage())); + CHECK (isnil(mock.getError())); uiBus.mark (targetID, GenNode{"Error", "getting serious"}); CHECK (mock.verifyMark("Error", "serious")); + CHECK (mock.isError()); + CHECK ("getting serious" == mock.getError()); + CHECK (isnil(mock.getMessage())); uiBus.mark (targetID, GenNode{"Message", "by mistake"}); CHECK (mock.verifyMark("Message", "mistake")); + CHECK ("by mistake" == mock.getMessage()); + CHECK ("getting serious" == mock.getError()); CHECK (mock.verify("target") .before("Flash") @@ -539,6 +550,12 @@ namespace test { CHECK (mock.ensureNot(string(Time::NEVER))); CHECK (nexusLog.verifyCall("mark").arg(targetID, Time::NEVER)); CHECK (nexusLog.ensureNot("delivered mark").arg(Time::NEVER)); + CHECK ("getting serious" == mock.getError()); + + mock.reset(); + CHECK (isnil(mock.getMessage())); + CHECK (isnil(mock.getError())); + CHECK (not mock.isError()); cout << "____Event-Log_________________\n" diff --git a/tests/gui/test/mock-elm.hpp b/tests/gui/test/mock-elm.hpp index 738f0b62d..2fe107e00 100644 --- a/tests/gui/test/mock-elm.hpp +++ b/tests/gui/test/mock-elm.hpp @@ -284,7 +284,7 @@ namespace test{ bool isError() const { - return isnil (error_); + return not isnil(error_); } string