75 std::list<DummyWidget> widgets_;
90 return std::find_if (widgets_.begin()
92 , [&](
DummyWidget const& widget) {
return widget == someWidget; });
100 return widgets_.empty();
104 testContains (
int someWidgetID)
106 return util::linearSearch (allWidgetIDs(), someWidgetID);
114 auto ids = allWidgetIDs();
115 for ( ; refSeq and ids; ++refSeq, ++ids)
116 if (refSeq->i != *ids)
break;
127 widgets_.push_back (elm);
133 widgets_.remove_if ([&](
auto const& widget) {
return widget == elm; });
138 rehook (
DummyWidget& existingHook) noexcept
override 140 auto pos = findEntry (existingHook);
141 REQUIRE (pos != widgets_.end(),
"the given iterator must yield previously hooked-up elements");
143 this->
remove (widget);
170 verify_standardUsage();
171 verify_multiplicity();
182 CHECK (canvas.empty());
184 HookedWidget widget{canvas};
185 CHECK (canvas.testContains (widget.i));
186 CHECK (not canvas.empty());
188 CHECK (canvas.empty());
198 CHECK (canvas.empty());
200 HookedWidget widget{canvas};
201 CHECK (canvas.testContains (widget.i));
202 CHECK (not canvas.empty());
206 HookedWidget otherWidget{canvas};
207 someID = otherWidget.i;
208 CHECK (canvas.testContains (someID));
209 CHECK (canvas.testContains (widget.i));
211 CHECK (not canvas.testContains (someID));
212 CHECK (canvas.testContains (widget.i));
213 CHECK (not canvas.empty());
231 using OrderIdx = vector<HookedWidget*>;
238 for (uint i=0; i<20; ++i)
239 orderIdx.push_back (& widgets.emplace<HookedWidget>(canvas));
242 auto orderSequence = [&] {
return lib::ptrDeref(eachElm(orderIdx)); };
244 CHECK (canvas.testContainsSequence (eachElm(widgets)));
245 CHECK (canvas.testContainsSequence (orderSequence()));
248 shuffle (orderIdx.begin(),orderIdx.end(), std::random_device());
249 CHECK (not canvas.testContainsSequence (orderSequence()));
252 canvas.reOrder (orderSequence());
253 CHECK (canvas.testContainsSequence (orderSequence()));
A widget attached onto a display canvas or similar central presentation context.
A fixed collection of non-copyable polymorphic objects.
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
bool testContainsSequence(IT refSeq)
verify our internal sequence matches the given one
void verify_standardUsage()
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
Interface to represent _"some presentation layout entity",_ with the ability to attach widgets (manag...
void verify_multiplicity()
Allow widgets to connect to a common shared presentation context.
Managing a collection of non-copyable polymorphic objects in compact storage.
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)
auto ptrDeref(IT iter)
Convenience shortcut to dereference pointers yielded from the wrapped iterator.
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.