From 5c113b058d240511ede85b2baa651f67bbbb3a19 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 2 Oct 2017 16:51:45 +0200 Subject: [PATCH] UI-Coordinates: better name the local component UIC_PATH --- src/gui/interact/ui-coord.hpp | 12 +++++----- tests/gui/interact/ui-coord-test.cpp | 34 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/gui/interact/ui-coord.hpp b/src/gui/interact/ui-coord.hpp index ec8a335bc..fca619ec3 100644 --- a/src/gui/interact/ui-coord.hpp +++ b/src/gui/interact/ui-coord.hpp @@ -90,7 +90,7 @@ namespace interact { UIC_PANEL, UIC_VIEW, UIC_TAB, - UIC_PART + UIC_PATH }; @@ -192,7 +192,7 @@ namespace interact { { if (empty()) return ""; - size_t end = min (size(), UIC_PART); + size_t end = min (size(), UIC_PATH); size_t pos = indexOf(*begin()); if (pos >= end) @@ -231,13 +231,13 @@ namespace interact { getPath() const { size_t siz = size(); - if (siz <= UIC_PART) + if (siz <= UIC_PATH) return ""; // no path information string buff; // heuristic pre-allocation - buff.reserve (10 * (siz - UIC_PART)); + buff.reserve (10 * (siz - UIC_PATH)); - iterator elm{this, unConst(this)->getPosition(UIC_PART)}; + iterator elm{this, unConst(this)->getPosition(UIC_PATH)}; if (isnil (*elm)) { // irregular case : only a path fragment elm = this->begin(); @@ -455,7 +455,7 @@ namespace interact { Builder path (Literal pathDef) { - uic_.setTailSequence (UIC_PART, pathDef); + uic_.setTailSequence (UIC_PATH, pathDef); return std::move (*this); } }; diff --git a/tests/gui/interact/ui-coord-test.cpp b/tests/gui/interact/ui-coord-test.cpp index 6b440ea56..6d1b9eb0f 100644 --- a/tests/gui/interact/ui-coord-test.cpp +++ b/tests/gui/interact/ui-coord-test.cpp @@ -105,9 +105,9 @@ namespace test { CHECK ("Θ" == uic[UIC_PANEL]); CHECK ("Ξ" == uic[UIC_VIEW]); CHECK ("Σ" == uic[UIC_TAB]); - CHECK ("Ψ" == uic[UIC_PART]); - CHECK ("Φ" == uic[UIC_PART+1]); - CHECK ("Ω" == uic[UIC_PART+2]); + CHECK ("Ψ" == uic[UIC_PATH]); + CHECK ("Φ" == uic[UIC_PATH+1]); + CHECK ("Ω" == uic[UIC_PATH+2]); // iteration matches index order uint i=0; @@ -133,9 +133,9 @@ namespace test { CHECK ("Θ" == uic[UIC_PANEL]); CHECK ("*" == uic[UIC_VIEW]); CHECK ("Σ" == uic[UIC_TAB]); - CHECK ("*" == uic[UIC_PART]); - CHECK ("Φ" == uic[UIC_PART+1]); - VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART+2]); + CHECK ("*" == uic[UIC_PATH]); + CHECK ("Φ" == uic[UIC_PATH+1]); + VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH+2]); } @@ -235,13 +235,13 @@ namespace test { CHECK (Symbol::EMPTY == uic[UIC_PANEL]); CHECK (Symbol::EMPTY == uic[UIC_VIEW]); CHECK (Symbol::EMPTY == uic[UIC_TAB]); - CHECK ("α" == uic[UIC_PART]); - CHECK ("β" == uic[UIC_PART+1]); - CHECK ("γ" == uic[UIC_PART+2]); - CHECK ("δ" == uic[UIC_PART+3]); - CHECK ("ε" == uic[UIC_PART+4]); - CHECK ("λ" == uic[UIC_PART+5]); - CHECK ("ον" == uic[UIC_PART+6]); + CHECK ("α" == uic[UIC_PATH]); + CHECK ("β" == uic[UIC_PATH+1]); + CHECK ("γ" == uic[UIC_PATH+2]); + CHECK ("δ" == uic[UIC_PATH+3]); + CHECK ("ε" == uic[UIC_PATH+4]); + CHECK ("λ" == uic[UIC_PATH+5]); + CHECK ("ον" == uic[UIC_PATH+6]); uic = uic.prepend("ειδος"); CHECK ("UI:?.ειδος/α/β/γ/δ/ε/λ/ον" == string(uic)); @@ -295,15 +295,15 @@ namespace test { CHECK ("win[*]-panel.*. " == uic.getComp()); CHECK (" " == uic.getPath()); CHECK (6 == uic.size()); - CHECK (" " == uic[UIC_PART]); - VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART+1]); + CHECK (" " == uic[UIC_PATH]); + VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH+1]); uic = uic.path(nullptr); CHECK ("UI:win[*]-panel.*. " == string(uic)); CHECK ("win[*]-panel.*. " == uic.getComp()); CHECK ("" == uic.getPath()); CHECK (5 == uic.size()); - VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART]); + VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH]); uic = uic.append(nullptr); CHECK ("UI:win[*]-panel.*. " == string(uic)); @@ -321,7 +321,7 @@ namespace test { CHECK ("UI:win[*]-panel.*. /**" == string(uic)); CHECK ("win[*]-panel.*. " == uic.getComp()); CHECK ("**" == uic.getPath()); - CHECK ("**" == uic[UIC_PART]); + CHECK ("**" == uic[UIC_PATH]); CHECK (6 == uic.size()); uic = uic.tab("");