From 8097485dbf1ddd08c6838b40ff29b0f2d43d3534 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 15 Jun 2018 18:02:08 +0200 Subject: [PATCH] ViewSpec: integrate the simple View access case (Unit test PASS) This finishes the first round of design drafts in this area. Right now it seems difficult to get any further, since most of the actual view creation and management in the UI is not yet coded. --- src/gui/interact/view-locator.cpp | 3 +- src/gui/interact/view-locator.hpp | 10 +- src/gui/model/element-access.hpp | 7 +- tests/52-gui-control.tests | 2 +- tests/gui/interact/view-spec-dsl-test.cpp | 9 +- tests/gui/test/test-element-access.hpp | 2 +- wiki/thinkPad.ichthyo.mm | 109 +++++++++++++--------- 7 files changed, 84 insertions(+), 58 deletions(-) diff --git a/src/gui/interact/view-locator.cpp b/src/gui/interact/view-locator.cpp index dd9703b67..ecfb2e848 100644 --- a/src/gui/interact/view-locator.cpp +++ b/src/gui/interact/view-locator.cpp @@ -71,8 +71,7 @@ namespace gui { AllocSpec limitAllocation =[](UICoord target, uint limit) { lib::Depend rawElementAccessor; - - return target; + return rawElementAccessor().locate_or_create (target, limit); }; } diff --git a/src/gui/interact/view-locator.hpp b/src/gui/interact/view-locator.hpp index eb023a66c..607ae411a 100644 --- a/src/gui/interact/view-locator.hpp +++ b/src/gui/interact/view-locator.hpp @@ -46,7 +46,15 @@ ** API, and this abstraction allows to keep all the intricacies of navigating concrete UI widgets confined within the ** implementation of the Navigator service. ** - ** @todo WIP 9/2017 early draft ////////////////////////////////////////////////////////////TICKET #1104 + ** @todo WIP 6/2018 half finished draft ////////////////////////////////////////////////////////////TICKET #1104 + ** + ** @remark the *performance* of such an view location and access step is not considered a priority. + ** As it's implemented right now, the access several times repeats the same drill-down into the + ** UI widget structure. This was deemed acceptable, since we assume views will be located only + ** occasionally, while further UI interactions will use either direct wiring or messages via + ** the UI-Bus. On the other hand, the flexibility in the configuration seems important and + ** the complexities generated thereby can be a maintenance burden. Which means, a clear + ** typed interface within the DSL is more important than burning some more CPU cycles. ** ** @see interaction-director.hpp ** @see panel-locator.hpp diff --git a/src/gui/model/element-access.hpp b/src/gui/model/element-access.hpp index c0338dd73..166569cd3 100644 --- a/src/gui/model/element-access.hpp +++ b/src/gui/model/element-access.hpp @@ -60,10 +60,6 @@ #include "lib/meta/typelist-manip.hpp" #include "lib/access-casted.hpp" #include "gui/interact/ui-coord.hpp" -//#include "lib/format-string.hpp" -//#include "lib/symbol.hpp" -//#include "lib/util.hpp" -#include "lib/test/test-helper.hpp" ////////TOD-o #include @@ -77,7 +73,6 @@ namespace model { using interact::UICoord; using lib::meta::Types; -// using util::isnil; using std::string; class Tangible; @@ -185,6 +180,8 @@ namespace model { /** Navigate to the designated component, possibly create the element and parents + * @param limitCreation limit on the number of similar UI elements that can be created + * within a scope. A value of zero prohibits creating of new elements. * @return location of the actual element to use, as UI-coordinates. * @note when access was not possible because the element could not been created, * the indicated location returned is an _empty coordinate spec._ diff --git a/tests/52-gui-control.tests b/tests/52-gui-control.tests index 47e192823..550c7106b 100644 --- a/tests/52-gui-control.tests +++ b/tests/52-gui-control.tests @@ -7,7 +7,7 @@ return: 0 END -PLANNED "configuration DSL for view access" ViewSpecDSL_test < //#include @@ -49,6 +49,7 @@ using lib::diff::Rec; //using lib::diff::GenNode; //using util::isSameObject; //using util::isnil; +using util::contains; namespace gui { @@ -217,12 +218,10 @@ namespace test { DummyView& view1 = viewLocator.get(); cout << "created view:" << view1.getID() << endl; + CHECK (fakeAccessor->response); // a new "widget" was created + CHECK (contains (view1.getID(), "DummyView")); // using the type name as ID prefix /////////////////////////////////////////////TICKET 1129 : some way to verify the last allocated path. Should be a child of "parentLocation" - - -// TimelineView timeline = viewLocator.get(); - /////////////////////////////////////////////////////////////////////////////////////////TICKET 1129 : use an EventLog to verify the forwarded invocations?? } }; diff --git a/tests/gui/test/test-element-access.hpp b/tests/gui/test/test-element-access.hpp index 8cd2fb2c8..a2c457fd8 100644 --- a/tests/gui/test/test-element-access.hpp +++ b/tests/gui/test/test-element-access.hpp @@ -118,7 +118,7 @@ namespace test { /** the next query will fail unless it presents this Path */ UICoord existingPath; - /** ...and if acceptable, the next query will answer with this object */ + /** ...and if acceptable, we record the last answer here */ std::unique_ptr response; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 044155bd6..29edcfc5d 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -990,7 +990,7 @@ - + @@ -2484,7 +2484,7 @@ - + @@ -2495,7 +2495,7 @@

- +
@@ -4181,7 +4181,7 @@
- + @@ -4323,7 +4323,7 @@ - + @@ -4354,7 +4354,7 @@ - + @@ -4362,7 +4362,8 @@ - + + @@ -4601,7 +4602,7 @@ - + @@ -4686,7 +4687,7 @@ - + @@ -4709,7 +4710,7 @@ - + @@ -9111,7 +9112,7 @@ - + @@ -9125,7 +9126,7 @@ - + @@ -9146,7 +9147,7 @@ - + @@ -9335,7 +9336,7 @@ - + @@ -9360,19 +9361,19 @@

- +
- + - - + + @@ -9413,12 +9414,12 @@ - + - + @@ -9431,13 +9432,13 @@ - + - + @@ -9463,7 +9464,7 @@ - + @@ -9562,7 +9563,7 @@ - + @@ -9805,7 +9806,7 @@ - + @@ -10116,7 +10117,7 @@ - + @@ -11120,8 +11121,8 @@ - - + + @@ -11139,14 +11140,21 @@ - - + + + + + + + - - + + + + @@ -11201,7 +11209,7 @@ - + @@ -11213,7 +11221,7 @@ - + @@ -11227,9 +11235,16 @@

- + +
+ + + + + +
@@ -11241,8 +11256,9 @@ - + + @@ -11261,7 +11277,9 @@ - + + + @@ -11674,8 +11692,13 @@ - - + + + + + + + @@ -13225,7 +13248,7 @@ - + @@ -21523,7 +21546,7 @@ - + @@ -22694,8 +22717,8 @@ - - + +