enable special unit-tests to link against the gui
This commit is contained in:
parent
aa17106c41
commit
e02a9d213d
7 changed files with 270 additions and 3 deletions
|
|
@ -47,4 +47,4 @@ gui = ( guimodule
|
|||
)
|
||||
|
||||
|
||||
Export('lumiera core core_lib app_lib backend_lib support_lib plugins gui')
|
||||
Export('lumiera core core_lib app_lib backend_lib support_lib plugins guimodule gui')
|
||||
|
|
|
|||
94
src/gui/model/session-facade.cpp
Normal file
94
src/gui/model/session-facade.cpp
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
SessionFacade - service for
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2014, 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 session-facade.cpp
|
||||
** Service for session-facade.
|
||||
** This header defines the basics of...
|
||||
**
|
||||
** @note as of X/2014 this is complete bs
|
||||
** @todo WIP ///////////////////////TICKET #
|
||||
**
|
||||
** @see ////TODO_test usage example
|
||||
** @see session-facade.cpp implementation
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
//#include "lib/util.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "gui/model/session-facade.hpp"
|
||||
#include "lib/depend.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
|
||||
//using std::map;
|
||||
//using std::string;
|
||||
|
||||
//using util::contains;
|
||||
//using util::isnil;
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
namespace { // internal details
|
||||
lib::Depend<SessionFacade> guiSessionFacade;
|
||||
|
||||
} // internal details
|
||||
|
||||
|
||||
|
||||
SessionFacade::SessionFacade()
|
||||
: nothing_("boo")
|
||||
{ }
|
||||
|
||||
|
||||
SessionFacade::~SessionFacade() { }
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
string
|
||||
SessionFacade::beCreative ()
|
||||
{
|
||||
return guiSessionFacade().maybe();
|
||||
}
|
||||
|
||||
|
||||
string
|
||||
SessionFacade::maybe() const
|
||||
{
|
||||
return nothing_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::model
|
||||
86
src/gui/model/session-facade.hpp
Normal file
86
src/gui/model/session-facade.hpp
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
SESSION-FACADE.hpp - service for
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2014, 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 session-facade.hpp
|
||||
** Service for session-facade.
|
||||
** This header defines the basics of...
|
||||
**
|
||||
** @note as of X/2014 this is complete bs
|
||||
** @todo WIP ///////////////////////TICKET #
|
||||
**
|
||||
** @see ////TODO_test usage example
|
||||
** @see session-facade.cpp implementation
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SESSION_FACADE_H_
|
||||
#define SESSION_FACADE_H_
|
||||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
// using lib::HashVal;
|
||||
// using util::isnil;
|
||||
using std::string;
|
||||
|
||||
|
||||
/**
|
||||
* Basic (abstracted) view of...
|
||||
*
|
||||
* @see SomeSystem
|
||||
* @see NA_test
|
||||
*/
|
||||
class SessionFacade
|
||||
: boost::noncopyable
|
||||
{
|
||||
string nothing_;
|
||||
|
||||
public:
|
||||
SessionFacade();
|
||||
~SessionFacade();
|
||||
|
||||
|
||||
static string beCreative ();
|
||||
|
||||
/* == Adapter interface for == */
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
string maybe () const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::model
|
||||
#endif /*SESSION_FACADE_H_*/
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
TESTING "Component Test Suite: GUI Model Parts" ./test-suite --group=gui
|
||||
|
||||
PLANNED "ModelClipTrack_test" ModelClipTrack_test <<END
|
||||
|
||||
|
||||
TEST "Self-check: testing GUI backbone parts" TestGui_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
PLANNED "ModelClip_test" ModelClip_test <<END
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from Buildhelper import scanSubtree
|
|||
from Buildhelper import globRootdirs
|
||||
from Buildhelper import createPlugins
|
||||
|
||||
Import('env core_lib app_lib backend_lib gui tools config')
|
||||
Import('env core_lib app_lib backend_lib guimodule tools config')
|
||||
env = env.Clone()
|
||||
env.Append(CPPPATH='include') # additional headers for tests
|
||||
|
||||
|
|
@ -26,6 +26,8 @@ def linkContext(id):
|
|||
return app_lib # tests in 'lib*' subdirs only linked against application framework
|
||||
elif id.startswith('back'):
|
||||
return backend_lib # tests in 'back*' subdirs only linked against backend layer
|
||||
elif id.startswith('gui'):
|
||||
return guimodule+core_lib # tests in 'gui*' are additionally linked against the GTK GUI module
|
||||
else:
|
||||
return core_lib # all other tests linked against complete application core
|
||||
|
||||
|
|
|
|||
17
tests/gui/README
Normal file
17
tests/gui/README
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
GUI backbone tests
|
||||
|
||||
The tests in this subtree are a bit special: they cover the generic and
|
||||
backbone internals of the Lumiera GTK GUI. They are linked against the
|
||||
complete GUI-module (gui plugin), and thus may use all related ABIs.
|
||||
|
||||
Yet these tests are *deliberately* compiled without any GTK, GTKmm or SigC
|
||||
includes. This effectively rules out the use, even indirectly, of any GTK
|
||||
widgets and APIs -- forcing the covered GUI backbone entities to stay
|
||||
clean and generic at API level.
|
||||
|
||||
This is a decision done on purpose. The concrete GUI framework technology
|
||||
shall be treated as an implementation detail. There is no point in writing
|
||||
tests which click buttons in the GUI -- better delegate any significant
|
||||
logic or functionality to GUI agnostic components. GUI is meant to be
|
||||
a presentation layer and must not develop intelligence on its own.
|
||||
|
||||
65
tests/gui/test-gui-test.cpp
Normal file
65
tests/gui/test-gui-test.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
TestGui(Test) - how to use this test framework...
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, 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.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/util.hpp"
|
||||
#include "gui/model/session-facade.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace test{
|
||||
|
||||
/**************************************//**
|
||||
* Hellooooooo the world is just a test
|
||||
* @test demo of using the test framework
|
||||
*/
|
||||
class TestGui_test : public Test
|
||||
{
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
cout << model::SessionFacade::beCreative() << "\n";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Register this test class to be invoked in some test groups (suites)
|
||||
* @remarks this macro \c LUNCHER is defined in run.hpp to simplify
|
||||
* the registration of test classes. It expands to the
|
||||
* following static variable definition
|
||||
* \code
|
||||
* Launch<HelloWorld_test> run_HelloWorld_test("HelloWorld_test","unit common");
|
||||
* \endcode
|
||||
*/
|
||||
LAUNCHER (TestGui_test, "unit gui");
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::test
|
||||
Loading…
Reference in a new issue