37 #include <forward_list> 47 using std::forward_list;
81 forward_list<Attachment> widgets_;
90 return entry.widget.i;
97 return std::find_if (widgets_.begin()
99 , [&](
Attachment const& a) {
return a.widget == someWidget; });
107 return widgets_.empty();
111 testContains (
int someWidgetID)
113 return util::linearSearch (allWidgetIDs(), someWidgetID);
117 testVerifyPos (
DummyWidget const& someWidget,
int x_expected,
int y_expected)
119 auto end = widgets_.end();
120 auto pos = findEntry (someWidget);
122 and pos->posX == x_expected
123 and pos->posY == y_expected;
130 hook (
DummyWidget& elm,
int xPos,
int yPos)
override 132 widgets_.push_front (
Attachment{elm, xPos,yPos});
136 move (
DummyWidget& elm,
int xPos,
int yPos)
override 138 auto end = widgets_.end();
139 auto pos = findEntry (elm);
150 widgets_.remove_if ([&](
Attachment const& a) {
return a.widget == elm; });
157 NOTREACHED (
"Time to pixel translation not covered in this unit test");
195 CHECK (canvas.empty());
197 HookedWidget widget{canvas.hookedAt(1,1)};
198 CHECK (canvas.testVerifyPos (widget, 1,1));
199 CHECK (not canvas.empty());
203 HookedWidget otherWidget{canvas.hookedAt(2,2)};
204 someID = otherWidget.i;
205 CHECK (canvas.testContains (someID));
206 CHECK (canvas.testContains (widget.i));
207 CHECK (canvas.testVerifyPos (widget, 1,1));
208 CHECK (canvas.testVerifyPos (otherWidget, 2,2));
210 CHECK (not canvas.testContains (someID));
211 CHECK (canvas.testContains (widget.i));
212 CHECK (not canvas.empty());
222 int x1 = rand() % 100;
223 int y1 = rand() % 100;
224 int x2 = rand() % 100;
225 int y2 = rand() % 100;
226 int x3 = rand() % 100;
227 int y3 = rand() % 100;
230 HookedWidget w1{canvas.hookedAt(x1,y1)};
231 HookedWidget w3{canvas.hookedAt(x3,y3)};
235 HookedWidget w2{canvas.hookedAt(x2,y2)};
237 CHECK (canvas.testContains (id2));
238 CHECK (canvas.testVerifyPos (w2, x2,y2));
242 w2.moveTo (newX,newY);
244 CHECK (canvas.testVerifyPos (w2, newX,newY));
245 CHECK (canvas.testVerifyPos (w1, x1,y1));
246 CHECK (canvas.testVerifyPos (w3, x3,y3));
248 CHECK (not canvas.testContains (id2));
249 CHECK (canvas.testVerifyPos (w1, x1,y1));
250 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.
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.
Simple 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, bypassing any custom comparison operators.