ViewSpec: use mocked LocationSolver to verify operation of the DSL

This commit is contained in:
Fischlurch 2018-04-05 01:09:13 +02:00
parent 64d5f868ea
commit 18a552002d
3 changed files with 38 additions and 10 deletions

View file

@ -285,7 +285,7 @@ namespace lib {
* instance of the `MOC` subclass, which it manages and exposes like a smart-ptr.
* When the handle goes out of scope, the original state and configuration is restored
*/
template<class MOC>
template<class MOC =SRV>
class Local
: util::MoveOnly
{

View file

@ -29,15 +29,20 @@
#include "lib/test/test-helper.hpp"
#include "gui/interact/view-spec-dsl.hpp"
#include "gui/interact/ui-coord.hpp"
#include "gui/interact/gen-node-location-query.hpp"
#include "lib/depend-inject.hpp"
#include "lib/format-cout.hpp"
//#include "lib/idi/entry-id.hpp"
//#include "lib/diff/gen-node.hpp"
//#include "lib/util.hpp"
//#include <string>
//#include <vector>
//using std::string;
using std::string;
using lib::diff::MakeRec;
using lib::diff::Rec;
//using lib::idi::EntryID;
//using lib::diff::GenNode;
//using util::isSameObject;
@ -51,6 +56,8 @@ namespace test {
// using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lib::test::showSizeof;
using MockLoationSolver = lib::DependInject<UILocationSolver>::Local<>;
namespace { //Test fixture...
}//(End)Test fixture
@ -86,6 +93,21 @@ namespace test {
void
verify_standardUsage()
{
//-------------------------------------------------------------Test-Fixture
// a Test dummy placeholder for the real UI structure
Rec dummyUiStructure = MakeRec()
.set("win-1"
, MakeRec()
.type("perspective")
.set("parentLocation", MakeRec())
);
// answer "location queries" backed by this structure
GenNodeLocationQuery locationQuery{dummyUiStructure};
MockLoationSolver mock ([&]{ return new UILocationSolver{locationQuery}; });
//--------------------------------------------------------------(End)Test-Fixture
uint allocCounter = 0;
// Simulation/Example for an allocator-builder
@ -96,8 +118,6 @@ namespace test {
else
return target.tab(limit);
};
/////////TODO verify this...
cout << showSizeof(limitAllocation) <<endl;
// the actual View Specification would then be written as...
ViewSpec locate = UICoord::currentWindow().panel("parentLocation");

View file

@ -10871,14 +10871,21 @@
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1519347191513" ID="ID_1058958215" MODIFIED="1520222272574" TEXT="Zugang zum LocationSolver">
<node COLOR="#338800" CREATED="1519347191513" ID="ID_1058958215" MODIFIED="1522883286186" TEXT="Zugang zum LocationSolver">
<arrowlink COLOR="#33a0d6" DESTINATION="ID_1459009906" ENDARROW="Default" ENDINCLINATION="766;0;" ID="Arrow_ID_393354619" STARTARROW="None" STARTINCLINATION="-338;0;"/>
<linktarget COLOR="#3391c4" DESTINATION="ID_1058958215" ENDARROW="Default" ENDINCLINATION="356;0;" ID="Arrow_ID_1958186293" SOURCE="ID_782466951" STARTARROW="None" STARTINCLINATION="40;166;"/>
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1519347295051" ID="ID_846050459" MODIFIED="1522808896717" TEXT="im realen UI">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1519347289508" ID="ID_723600288" MODIFIED="1522809238028" TEXT="setup f&#xfc;r Unit-Test">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1519347289508" FOLDED="true" ID="ID_723600288" MODIFIED="1522883307177" TEXT="setup f&#xfc;r Unit-Test">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1522883291235" ID="ID_543936991" MODIFIED="1522883304073" TEXT="GenNodeLocationQuery">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1522883297346" ID="ID_1901671292" MODIFIED="1522883303346" TEXT="darauf aufbauender Mock">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
<node COLOR="#338800" CREATED="1519347266311" ID="ID_1347610352" MODIFIED="1522808950831" TEXT="Funktor-Anwendung implementieren">
@ -11830,14 +11837,15 @@
</node>
</node>
</node>
<node CREATED="1506182023288" ID="ID_1539184761" MODIFIED="1518487921072" TEXT="ViewSpecDSL_test">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1506182023288" ID="ID_1539184761" MODIFIED="1522883337660" TEXT="ViewSpecDSL_test">
<icon BUILTIN="pencil"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1506182077694" ID="ID_839824654" MODIFIED="1518487921072" TEXT="verify_basicProperties">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1515633695710" ID="ID_1540478220" MODIFIED="1518487921072" TEXT="aus standardUsage ablzuleiten"/>
<node CREATED="1515633710396" ID="ID_335824710" MODIFIED="1518487921072" TEXT="spezifiziert die formalen Basis-Eigenschaften"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1506182037003" ID="ID_439307131" MODIFIED="1518487921072" TEXT="verify_standardUsage">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1506182037003" ID="ID_439307131" MODIFIED="1522883325632" TEXT="verify_standardUsage">
<icon BUILTIN="button_ok"/>
<node CREATED="1515633645885" ID="ID_1659749577" MODIFIED="1518487921072" TEXT="einfaches Dummy-Setup"/>
<node CREATED="1515633651212" ID="ID_704575529" MODIFIED="1518487921072" TEXT="erlaubt, die Strukturen zu bauen"/>
<node CREATED="1515633658483" ID="ID_149158343" MODIFIED="1518487921072" TEXT="l&#xe4;uft ohne die UI-Backbone">