28 #include <forward_list> 38 using std::forward_list;
72 forward_list<Attachment> widgets_;
81 return entry.widget.i;
88 return std::find_if (widgets_.begin()
90 , [&](
Attachment const& a) {
return a.widget == someWidget; });
98 return widgets_.empty();
102 testContains (
int someWidgetID)
104 return util::linearSearch (allWidgetIDs(), someWidgetID);
108 testVerifyPos (
DummyWidget const& someWidget,
int x_expected,
int y_expected)
110 auto end = widgets_.end();
111 auto pos = findEntry (someWidget);
113 and pos->posX == x_expected
114 and pos->posY == y_expected;
121 hook (
DummyWidget& elm,
int xPos,
int yPos)
override 123 widgets_.push_front (
Attachment{elm, xPos,yPos});
127 move (
DummyWidget& elm,
int xPos,
int yPos)
override 129 auto end = widgets_.end();
130 auto pos = findEntry (elm);
141 widgets_.remove_if ([&](
Attachment const& a) {
return a.widget == elm; });
148 NOTREACHED (
"Time to pixel translation not covered in this unit test");
187 CHECK (canvas.empty());
189 HookedWidget widget{canvas.hookedAt(1,1)};
190 CHECK (canvas.testVerifyPos (widget, 1,1));
191 CHECK (not canvas.empty());
195 HookedWidget otherWidget{canvas.hookedAt(2,2)};
196 someID = otherWidget.i;
197 CHECK (canvas.testContains (someID));
198 CHECK (canvas.testContains (widget.i));
199 CHECK (canvas.testVerifyPos (widget, 1,1));
200 CHECK (canvas.testVerifyPos (otherWidget, 2,2));
202 CHECK (not canvas.testContains (someID));
203 CHECK (canvas.testContains (widget.i));
204 CHECK (not canvas.empty());
222 HookedWidget w1{canvas.hookedAt(x1,y1)};
223 HookedWidget w3{canvas.hookedAt(x3,y3)};
227 HookedWidget w2{canvas.hookedAt(x2,y2)};
229 CHECK (canvas.testContains (id2));
230 CHECK (canvas.testVerifyPos (w2, x2,y2));
234 w2.moveTo (newX,newY);
236 CHECK (canvas.testVerifyPos (w2, newX,newY));
237 CHECK (canvas.testVerifyPos (w1, x1,y1));
238 CHECK (canvas.testVerifyPos (w3, x3,y3));
240 CHECK (not canvas.testContains (id2));
241 CHECK (canvas.testVerifyPos (w1, x1,y1));
242 CHECK (canvas.testVerifyPos (w3, x3,y3));
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
Mix-in interface to allow for concrete CanvasHooked widgets to adapt themselves to the metric current...
DisplayMetric & getMetric() const override
access the component to handle layout metric
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
A widget attached onto a display canvas or similar central presentation context.
int rani(uint bound=_iBOUND())
Interface to represent _"some presentation layout entity",_ with the ability to place widgets (manage...
Managing a collection of non-copyable polymorphic objects in compact storage.
Specialised (abstracted) presentation context with positioning by coordinates.
Simplistic test class runner.
Lumiera GTK UI implementation root.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
_SeqT< CON >::Range eachElm(CON &coll)
Building tree expanding and backtracking evaluations within hierarchical scopes.
Preconfigured adapters for some STL container standard usage situations.
bool contains(SEQ const &cont, typename SEQ::const_reference val)
shortcut for brute-force containment test in any sequential container
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...