diff --git a/src/gui/id-scheme.hpp b/src/gui/id-scheme.hpp index 8430a9b15..a22bc9a97 100644 --- a/src/gui/id-scheme.hpp +++ b/src/gui/id-scheme.hpp @@ -77,6 +77,8 @@ namespace gui { using lib::Literal; using lib::idi::EntryID; + using interact::UICoord; + using ID = lib::idi::BareEntryID const&; diff --git a/src/gui/interact/view-locator.cpp b/src/gui/interact/view-locator.cpp index 4a7eb4915..01835ae10 100644 --- a/src/gui/interact/view-locator.cpp +++ b/src/gui/interact/view-locator.cpp @@ -39,7 +39,9 @@ */ +#include "gui/gtk-base.hpp" #include "gui/interact/view-locator.hpp" +#include "gui/interact/view-spec-dsl.hpp" #include "gui/interact/ui-location-solver.hpp" #include "gui/ctrl/panel-locator.hpp" #include "gui/model/element-access.hpp" @@ -57,42 +59,53 @@ using gui::model::ElementAccess; namespace gui { -namespace interact { - namespace error = lumiera::error; + /* ==== definitions and concrete bindings for the View-Spec-DSL ==== */ - const Symbol UIC_CURRENT_WINDOW{"currentWindow"}; - const Symbol UIC_FIRST_WINDOW {"firstWindow"}; - const Symbol UIC_ELIDED {"."}; - - - - - ViewLocator::ViewLocator () - : locResolver_{LocationQuery::service} - { } - - // dtors via smart-ptr invoked from here... - ViewLocator::~ViewLocator() { } - - - - /* === Service accessors within global context === */ - -// PanelLocator& -// ViewLocator::panelLocator() -// { -// return windowLoc_.locatePanel(); -// } - - - - - /** */ - - + namespace idi { // Namespace for the actual ViewSpec DSL tokens + + + AllocSpec limitAllocation =[&](UICoord target, uint limit) + { + UNIMPLEMENTED ("Actual DSL token to cause a (limited) view allocation"); + return target; /////////////////////////////////////////////////////////TICKET #1129 : need at least a working draft implementation here + }; + } + namespace interact { + + const Symbol UIC_CURRENT_WINDOW{"currentWindow"}; + const Symbol UIC_FIRST_WINDOW {"firstWindow"}; + const Symbol UIC_ELIDED {"."}; + + + + + ViewLocator::ViewLocator () + : locResolver_{LocationQuery::service} + { } + + // dtors via smart-ptr invoked from here... + ViewLocator::~ViewLocator() { } + + + + /* === Service accessors within global context === */ + + // PanelLocator& + // ViewLocator::panelLocator() + // { + // return windowLoc_.locatePanel(); + // } + + + + + /** */ + + + }}// namespace gui::interact diff --git a/src/gui/interact/view-locator.hpp b/src/gui/interact/view-locator.hpp index ad71718e3..99dae95cc 100644 --- a/src/gui/interact/view-locator.hpp +++ b/src/gui/interact/view-locator.hpp @@ -56,7 +56,6 @@ #ifndef GUI_INTERACT_VIEW_LOCATOR_H #define GUI_INTERACT_VIEW_LOCATOR_H -#include "gui/gtk-base.hpp" #include "lib/depend-inject.hpp" #include "gui/interact/view-spec-dsl.hpp" #include "gui/id-scheme.hpp" diff --git a/src/gui/interact/view-spec-dsl.hpp b/src/gui/interact/view-spec-dsl.hpp index 8d3feb355..d5bac7fa1 100644 --- a/src/gui/interact/view-spec-dsl.hpp +++ b/src/gui/interact/view-spec-dsl.hpp @@ -251,5 +251,15 @@ namespace interact { }; -}}// namespace gui::interact +} // namespace interact +namespace idi { +//bring definitions into scope for DSL use... + using interact::ViewSpec; + using interact::Allocator; + + using interact::AllocSpec; + + extern AllocSpec limitAllocation; + +}}// namespace gui::idi #endif /*GUI_INTERACT_VIEW_SPEC_DSL_H*/ diff --git a/tests/gui/interact/view-spec-dsl-test.cpp b/tests/gui/interact/view-spec-dsl-test.cpp index 976f11d51..117166fbc 100644 --- a/tests/gui/interact/view-spec-dsl-test.cpp +++ b/tests/gui/interact/view-spec-dsl-test.cpp @@ -27,9 +27,11 @@ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" -#include "gui/interact/view-spec-dsl.hpp" #include "gui/interact/ui-coord.hpp" +#include "gui/interact/view-locator.hpp" +#include "gui/interact/view-spec-dsl.hpp" #include "gen-node-location-query.hpp" +#include "test/test-element-access.hpp" #include "lib/depend-inject.hpp" #include "lib/format-cout.hpp" //#include "lib/idi/entry-id.hpp" @@ -50,13 +52,44 @@ using lib::diff::Rec; namespace gui { +namespace idi { //------Mock ViewSpec definitions for component test + + struct MockView1 + : gui::test::DummyWidget + { + using DummyWidget::DummyWidget; + }; + + struct MockView2 + : gui::test::DummyWidget + { + using DummyWidget::DummyWidget; + }; + + /* ==== Dummy ViewSpec rules for those two mock view types (--> see id-scheme.hpp) ==== */ + + template<> + struct Descriptor + { + ViewSpec locate = UICoord::currentWindow().panel("parentLocation"); + Allocator alloc = limitAllocation(2); + }; + +}//----------------(End)Mock ViewSpec definitions + namespace interact { namespace test { // using lumiera::error::LUMIERA_ERROR_WRONG_TYPE; using lib::test::showSizeof; + using gui::model::ElementAccess; + using gui::test::TestElementAccess; + using gui::test::DummyWidget; + using gui::test::DummyView; + using gui::test::DummyTab; using MockLoationSolver = lib::DependInject::Local<>; + using MockElementAccess = lib::DependInject::Local; namespace { //Test fixture... @@ -79,7 +112,7 @@ namespace test { { // verify_basicProperties(); verify_standardUsage(); - verify_alternatives(); +// verify_alternatives(); verify_genericInvocation(); } @@ -156,6 +189,8 @@ namespace test { void verify_genericInvocation() { + ViewLocator viewLocator; + //-------------------------------------------------------------Test-Fixture // a Test dummy placeholder for the real UI structure Rec dummyUiStructure = MakeRec() @@ -167,11 +202,14 @@ namespace test { // answer "location queries" backed by this structure GenNodeLocationQuery locationQuery{dummyUiStructure}; MockLoationSolver mock ([&]{ return new UILocationSolver{locationQuery}; }); - /////////////////////////////////////////////////////////////////////////////////////////TICKET 1129 : how to create ViewLocator mock without global context?? + + MockElementAccess fakeAccessor; //--------------------------------------------------------------(End)Test-Fixture -// ErrorLogView errorLog = viwLocator.get(); -// TimelineView timeline = viwLocator.get(); + using idi::MockView1; + + MockView1& view1 = viewLocator.get(); +// TimelineView timeline = viewLocator.get(); /////////////////////////////////////////////////////////////////////////////////////////TICKET 1129 : use an EventLog to verify the forwarded invocations?? } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 3774cd103..14ca81538 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -3879,7 +3879,7 @@ - + @@ -9414,7 +9414,7 @@ - + @@ -12073,9 +12073,96 @@ - + + + + + + + + + + + + + +

+ ...denn irgendwann wird's lächerlich mit der Unit-Testerei. +

+

+ Oder zumindest Hexagonal. +

+

+ Bedingt durch die ganzen rausgezogenen Interfaces hat jetzt bereits ViewLocator überhaupt keinen Gehalt mehr. +

+

+ Wenn ich jetzt auch noch die einzige verbleibende Methode rausziehe, um sie testen zu können, +

+

+ drehe ich mich komplett im Kreis. Schließlich kann ich diese Methode ja, genau genommen, +

+

+ im Moment auch noch nicht wirklich testen, aus genau den gleichen Gründen, +

+

+ warum ViewLocator so nebulös bleibt: es gibt noch kein Lumiera GUI +

+ + +
+ + + + + + + + + + + +

+ Das ursprüngliche Ziel für diesen Test +

+

+ ist in unserem Test-Framework nicht realisierbar +

+ + +
+ + + + + + + + + + + + + + +

+ Policy: Unit-Tests dürfen keine GTK-Abhängigkeit haben +

+ + +
+
+ + + + + + + + + +
@@ -12716,7 +12803,7 @@
- + @@ -12759,7 +12846,7 @@ - + @@ -12846,7 +12933,7 @@ - + @@ -12936,9 +13023,9 @@ - + - + @@ -12964,8 +13051,8 @@ - - + + @@ -12979,8 +13066,14 @@ + + + + - + + + @@ -21790,7 +21883,7 @@ - +