From 60d40a6a6e7acd71dbc7496ea07993535525aa5a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 14 Feb 2018 04:42:19 +0100 Subject: [PATCH] LocationSolver: concept for standard usage situation test coverage ...using a fixed set of rules this time, while injecting a different (simulated) UI tree for each testcase --- .../gui/interact/ui-location-solver-test.cpp | 44 +++++++++++++++++-- wiki/thinkPad.ichthyo.mm | 34 +++++++++++--- 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/tests/gui/interact/ui-location-solver-test.cpp b/tests/gui/interact/ui-location-solver-test.cpp index 5b08a494a..cb7753a81 100644 --- a/tests/gui/interact/ui-location-solver-test.cpp +++ b/tests/gui/interact/ui-location-solver-test.cpp @@ -348,19 +348,53 @@ namespace test { } + /** @test emulate the relevant standard situations of view location resolution. + * The typical location specifications to be expected in practice can be subsumed + * under a small selection of standard situations; this test demonstrates how these + * are triggered by specific tree configurations in a (hopefully) obvious way. + * + * For this purpose, we create a single set of location clauses here, but evaluate them + * each time against different (simulated) UI tree configurations to verify that the expected + * resulting location is actually derived in all those cases. + */ void verify_standardSituations() { - UNIMPLEMENTED ("emulate the relevant standard situations of view location resolution"); + // Test Fixture: a solver which always queries the current state of a (simulated) uiTree + Rec uiTree; + std::unique_ptr query; + UILocationSolver solver{[&]() -> GenNodeLocationQuery& + { + query.reset (new GenNodeLocationQuery(uiTree)); + return *query; + }}; + + // Test Fixture: common set of location clauses + LocationRule location{UICoord().persp("edit").panel("viewer")}; + location.append (UICoord::currentWindow().panel("viewer")); + location.append (UICoord().panel("viewer")); + location.append (UICoord().tab("type(Asset)")); + location.append (UICoord().persp("asset").view("asset")); + location.append (UICoord().view("asset").tab("type(Asset)").create()); + location.append (UICoord::currentWindow().panel("viewer").create()); + location.append (UICoord::window("meta").panel("infobox").view("inspect").create()); + + cout << location << endl; + /* === match by perspective + panel === */ + uiTree = MakeRec() + .set("win" + , MakeRec() + .type("edit") + .set ("viewer", MakeRec())); + cout << solver.solve (location, UIC_VIEW, "videoViewer") < + + + + + + + + +

+ nur einen Satz Klauseln +

+ + +
+
+ + + + + + + - + - - - - - - + @@ -10979,6 +10996,9 @@ + + +