pondering about how to connect the central bus hub
...especially since we need a faked UI backbone for unit testing
This commit is contained in:
parent
af98d75da4
commit
f19ebd63d0
4 changed files with 125 additions and 2 deletions
|
|
@ -43,6 +43,7 @@
|
|||
//#include "include/logging.h"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "gui/ctrl/bus-controller.hpp"
|
||||
#include "gui/ctrl/nexus.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
#include <string>
|
||||
|
|
|
|||
115
src/gui/ctrl/nexus.hpp
Normal file
115
src/gui/ctrl/nexus.hpp
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
test/NEXUS.hpp - fake user interface backbone for test support
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2015, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/** @file test/nexus.hpp
|
||||
** Core hub and routing table of the UI-Bus.
|
||||
** Any relevant element within the Lumiera GTK UI is connected to the [UI-Bus][ui-bus.hpp]
|
||||
** through some [bus terminal][bus-term.hpp]. Actually, there is one special BustTerm
|
||||
** implementation, which acts as router and messaging hub.
|
||||
**
|
||||
** @todo initial draft and WIP-WIP-WIP as of 11/2015
|
||||
**
|
||||
** @see abstract-tangible-test.cpp
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GUI_CTRL_NEXUS_H
|
||||
#define GUI_CTRL_NEXUS_H
|
||||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
//#include "lib/idi/entry-id.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
//#include "gui/model/tangible.hpp"
|
||||
//#include "lib/diff/record.hpp"
|
||||
#include "lib/idi/entry-id.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace ctrl{
|
||||
|
||||
// using lib::HashVal;
|
||||
// using util::isnil;
|
||||
// using lib::idi::EntryID;
|
||||
// using lib::diff::Record;
|
||||
// using std::string;
|
||||
|
||||
|
||||
/**
|
||||
* Central hub of the UI-Bus.
|
||||
* This special implementation of the [BusTerm] interface maintains
|
||||
* a routing table and manages the connections to individual UI-Elements.
|
||||
*
|
||||
* @todo write type comment
|
||||
*/
|
||||
class Nexus
|
||||
: public BusTerm
|
||||
, boost::noncopyable
|
||||
{
|
||||
using ID = lib::idi::BareEntryID const&;
|
||||
using Tangible = gui::model::Tangible const&;
|
||||
|
||||
|
||||
virtual void
|
||||
note (ID subject, GenNode const& mark) override
|
||||
{
|
||||
UNIMPLEMENTED ("forward note messages to the presentation state manager");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
mark (ID subject, GenNode const& mark) override
|
||||
{
|
||||
UNIMPLEMENTED ("route mark messages down to the individual Tangible");
|
||||
}
|
||||
|
||||
|
||||
virtual BusTerm&
|
||||
routeAdd(Tangible newNode) override
|
||||
{
|
||||
UNIMPLEMENTED ("add a new down-link connection to the routing table");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
routeDetach(ID node) noexcept override
|
||||
{
|
||||
UNIMPLEMENTED ("deactivate and remove a down-link route");
|
||||
}
|
||||
|
||||
public:
|
||||
explicit
|
||||
Nexus (BusTerm& coreService)
|
||||
: BusTerm(lib::idi::EntryID<Nexus>(), coreService)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::ctrl
|
||||
#endif /*GUI_CTRL_NEXUS_H*/
|
||||
|
|
@ -37,6 +37,8 @@
|
|||
//#include "lib/symbol.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "test/nexus.hpp"
|
||||
#include "gui/ctrl/nexus.hpp"
|
||||
#include "lib/depend.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
|
|
@ -53,6 +55,8 @@ namespace test{
|
|||
|
||||
namespace { // internal details
|
||||
|
||||
lib::Depend<gui::ctrl::Nexus> testNexus;
|
||||
|
||||
} // internal details
|
||||
|
||||
|
||||
|
|
@ -69,7 +73,7 @@ namespace test{
|
|||
ctrl::BusTerm&
|
||||
Nexus::testUI()
|
||||
{
|
||||
UNIMPLEMENTED("test nexus");
|
||||
return testNexus();
|
||||
}
|
||||
|
||||
}} // namespace gui::test
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@
|
|||
** backbone to run any test probes against. The test::Nexus allows to [hook up][::testUI]
|
||||
** a generic interface element, to participate in a simulated interface interaction.
|
||||
**
|
||||
** @todo initial draft and WIP-WIP-WIP as of 11/2015
|
||||
** This class test::Nexus acts as front-end for unit tests, while the actual implementation
|
||||
** of a test rigged mock interface backbone remains an implementation detail.
|
||||
**
|
||||
** @todo initial draft and WIP-WIP-WIP as of 12/2015
|
||||
**
|
||||
** @see abstract-tangible-test.cpp
|
||||
**
|
||||
|
|
|
|||
Loading…
Reference in a new issue