From c88747dc997b6a694dd79176f8c483f2fef8fbde Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 6 Jan 2018 04:36:18 +0100 Subject: [PATCH] Navigator: cover selection from several possible solutions --- tests/gui/interact/ui-coord-resolver-test.cpp | 23 ++- wiki/thinkPad.ichthyo.mm | 175 ++++++++++-------- 2 files changed, 124 insertions(+), 74 deletions(-) diff --git a/tests/gui/interact/ui-coord-resolver-test.cpp b/tests/gui/interact/ui-coord-resolver-test.cpp index aba573824..1c3917ad8 100644 --- a/tests/gui/interact/ui-coord-resolver-test.cpp +++ b/tests/gui/interact/ui-coord-resolver-test.cpp @@ -329,6 +329,10 @@ namespace test { * ** reject mismatch immediately behind second gap * ** mismatch of tree level * ** contradiction to anchorage + * - (5) selection between several possible solutions + * ** the length of the covered trailing suffix decides + * ** when two solutions are equivalent, pick the fist one + * ** best solution will be picked, irrespective of discovery order */ void verify_mutateCoverage() @@ -368,6 +372,7 @@ namespace test { , MakeRec() .set("sub", MakeRec()) ) + .set("#1", MakeRec()) ) ) .set("panelZZ", MakeRec()) @@ -468,7 +473,23 @@ namespace test { CHECK (not r47.canCover()); - UNIMPLEMENTED ("TODO: further cases of coverage query...."); + /* === the solution with maximum covered depth wins === */ + UICoordResolver r51 {UICoord().tab("tab").path("sub"), tree}; + CHECK ("UI:window-3[persp-C]-panelZ.thirdView.tab/sub" == string(r51.cover())); // the second solution found covers to maximum depth + + /* === when two solutions are equivalent, pick the fist one === */ + UICoordResolver r52 {UICoord().tab("tab"), tree}; + CHECK ("UI:window-1[persp-A]-panelZ.thirdView.tab" == string(r52.cover())); // "UI:window-3[persp-C]-panelZ.thirdView.tab" would match too + + /* === best solution will be picked, irrespective of discovery order === */ + UICoordResolver r531 {UICoord().persp("persp-A").tab(1), tree}; + CHECK ("UI:window-1[persp-A]-panelZ.thirdView.#1" == string(r531.cover())); // best solution discovered as first one + + UICoordResolver r532 {UICoord().view("thirdView").tab("tab"), tree}; + CHECK ("UI:window-1[persp-A]-panelZ.thirdView.tab" == string(r532.cover())); // best solution is 3rd of five possible ones + + UICoordResolver r533 {UICoord().persp("persp-C").tab(1), tree}; + CHECK ("UI:window-3[persp-C]-panelZ.thirdView.#1" == string(r533.cover())); // best solution is found as last one } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 55d4e9ee7..2e791442c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -4193,20 +4193,21 @@ - + - - - - - + + + + + + - - + + @@ -4244,8 +4245,8 @@ - - + + @@ -4318,7 +4319,7 @@ - + @@ -4326,18 +4327,39 @@ + + + + + + +

+ letzten Endes war es nahezu gleich schwer zu implementieren, +

+

+ aber von der Aufruf-Logik her einfacher, stets nach partieller zu suchen +

+

+ und totale Coverage nur nachträglich durch Längenvergleich festzustellen +

+ + +
+ +
- - + + + - - + + @@ -4543,9 +4565,9 @@ - + - + @@ -8648,7 +8670,18 @@ - + + + + + + +

+ YAGNI +

+ + +
@@ -8727,8 +8760,8 @@
- - + + @@ -8766,8 +8799,9 @@ - + + @@ -8834,31 +8868,22 @@ - - - - + + + + - - - - + + - - + + - - + + - - - - - - - - - + + @@ -9016,10 +9041,10 @@ - - + + - + @@ -9165,59 +9190,63 @@ - - - - - + + + + + - + - - + + - + - + - - + + - - + + - - + + - - + + - - + + + + - - + + + - - + + + + - + + + - - -