implement logging/identification of mock UI elements
This commit is contained in:
parent
972045d8f8
commit
4d1fcd6dcb
7 changed files with 58 additions and 11 deletions
|
|
@ -176,7 +176,13 @@ namespace ctrl {
|
|||
{
|
||||
theBus_.routeDetach (node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BusTerm::operator string() const
|
||||
{
|
||||
return "BusTerm-" + string(endpointID_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::ctrl
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ namespace ctrl{
|
|||
virtual void note (ID subject, GenNode const& mark);
|
||||
virtual void mark (ID subject, GenNode const& mark);
|
||||
|
||||
virtual operator string() const;
|
||||
|
||||
void note (GenNode const& mark);
|
||||
|
||||
ID getID() const { return endpointID_; }
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "lib/error.hpp"
|
||||
//#include "lib/idi/entry-id.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "gui/model/tangible.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
|
@ -121,6 +122,13 @@ namespace ctrl{
|
|||
routingTable_.erase (node);
|
||||
}
|
||||
|
||||
|
||||
virtual operator string() const
|
||||
{
|
||||
return lib::idi::instanceTypeID(this);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
explicit
|
||||
Nexus (BusTerm& uplink_to_CoreService, ID identity =lib::idi::EntryID<Nexus>())
|
||||
|
|
|
|||
|
|
@ -174,6 +174,8 @@ namespace idi {
|
|||
return hash_;
|
||||
}
|
||||
|
||||
operator string() const;
|
||||
|
||||
|
||||
/** using BareEntryID derived objects as keys within tr1::unordered_map */
|
||||
struct UseEmbeddedHash
|
||||
|
|
@ -252,10 +254,7 @@ namespace idi {
|
|||
}
|
||||
|
||||
|
||||
operator string () const
|
||||
{
|
||||
return "ID<"+typeSymbol<TY>()+">-"+EntryID::getSym();
|
||||
}
|
||||
operator string() const;
|
||||
|
||||
friend ostream& operator<< (ostream& os, EntryID const& id) { return os << string(id); }
|
||||
friend bool operator< (EntryID const& i1, EntryID const& i2) { return i1.getSym() < i2.getSym(); }
|
||||
|
|
@ -290,6 +289,20 @@ namespace idi {
|
|||
}
|
||||
|
||||
|
||||
inline
|
||||
BareEntryID::operator string() const
|
||||
{
|
||||
return "bID-"+lib::idi::format::instance_hex_format(symbol_, hash_);
|
||||
}
|
||||
|
||||
template<class TY>
|
||||
inline
|
||||
EntryID<TY>::operator string() const
|
||||
{
|
||||
return "ID<"+typeSymbol<TY>()+">-"+EntryID::getSym();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} // namespace lib::idi
|
||||
#endif /*LIB_IDI_ENTRY_ID_H*/
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ namespace test {
|
|||
|
||||
CHECK (mock.verify("ctor"));
|
||||
CHECK (mock.verifyEvent("create","dummy"));
|
||||
CHECK (mock.verify("ctor").arg("dummy").on(&mock));
|
||||
CHECK (mock.verify("ctor").arg("dummy","TestNexus").on(&mock));
|
||||
|
||||
CHECK ("dummy" == mock.getID().getSym());
|
||||
CHECK (EntryID<MockElm>("dummy") == mock.getID());
|
||||
|
|
@ -141,6 +141,7 @@ namespace test {
|
|||
mock.reset();
|
||||
CHECK (mock.verify("reset"));
|
||||
CHECK (mock.verifyCall("reset"));
|
||||
CHECK (mock.verifyCall("reset").on(&mock));
|
||||
CHECK (mock.verifyCall("reset").on("dummy"));
|
||||
CHECK (mock.verifyEvent("reset"));
|
||||
CHECK (mock.verify("reset").after("ctor"));
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include "lib/test/event-log.hpp"
|
||||
#include "gui/model/tangible.hpp"
|
||||
#include "lib/diff/record.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "test/test-nexus.hpp"
|
||||
#include <string>
|
||||
|
||||
|
|
@ -86,13 +87,15 @@ namespace test{
|
|||
|
||||
EventLog log_{this};
|
||||
|
||||
bool virgin_{true};
|
||||
|
||||
|
||||
/* ==== Tangible interface ==== */
|
||||
|
||||
virtual void doReset() override
|
||||
{
|
||||
log_.call(this, "reset");
|
||||
// _Par::doReset();
|
||||
log_.call(this->identify(), "reset");
|
||||
virgin_ = true;
|
||||
log_.event("reset");
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +131,13 @@ namespace test{
|
|||
|
||||
|
||||
protected:
|
||||
string
|
||||
identify() const
|
||||
{
|
||||
return lib::idi::instanceTypeID(this) +"-"+getID().getSym();
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
explicit
|
||||
MockElm(string id)
|
||||
|
|
@ -138,7 +148,7 @@ namespace test{
|
|||
MockElm(ID identity, ctrl::BusTerm& nexus =Nexus::testUI())
|
||||
: gui::model::Tangible(identity, nexus)
|
||||
{
|
||||
log_.call(this, "ctor", identity, nexus);
|
||||
log_.call(this->identify(), "ctor", identity, string(nexus));
|
||||
log_.create(getID().getSym());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,14 +40,15 @@
|
|||
#include "gui/ctrl/nexus.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
#include "lib/idi/entry-id.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "lib/depend.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
#include <string>
|
||||
//#include <map>
|
||||
|
||||
//using std::map;
|
||||
//using std::string;
|
||||
using std::string;
|
||||
|
||||
//using lib::idi::EntryID;
|
||||
using lib::diff::GenNode;
|
||||
|
|
@ -85,6 +86,12 @@ namespace test{
|
|||
{
|
||||
UNIMPLEMENTED ("receive and handle presentation state note messages.");
|
||||
}
|
||||
|
||||
|
||||
virtual operator string() const
|
||||
{
|
||||
return lib::idi::instanceTypeID(this);
|
||||
}
|
||||
|
||||
public:
|
||||
TestNexus()
|
||||
|
|
|
|||
Loading…
Reference in a new issue