66 std::list<DummyWidget> widgets_;
81 return std::find_if (widgets_.begin()
83 , [&](
DummyWidget const& widget) {
return widget == someWidget; });
91 return widgets_.empty();
95 testContains (
int someWidgetID)
97 return util::linearSearch (allWidgetIDs(), someWidgetID);
105 auto ids = allWidgetIDs();
106 for ( ; refSeq and ids; ++refSeq, ++ids)
107 if (refSeq->i != *ids)
break;
118 widgets_.push_back (elm);
124 widgets_.remove_if ([&](
auto const& widget) {
return widget == elm; });
129 rehook (
DummyWidget& existingHook) noexcept
override 131 auto pos = findEntry (existingHook);
132 REQUIRE (pos != widgets_.end(),
"the given iterator must yield previously hooked-up elements");
134 this->
remove (widget);
162 verify_standardUsage();
163 verify_multiplicity();
174 CHECK (canvas.empty());
176 HookedWidget widget{canvas};
177 CHECK (canvas.testContains (widget.i));
178 CHECK (not canvas.empty());
180 CHECK (canvas.empty());
190 CHECK (canvas.empty());
192 HookedWidget widget{canvas};
193 CHECK (canvas.testContains (widget.i));
194 CHECK (not canvas.empty());
198 HookedWidget otherWidget{canvas};
199 someID = otherWidget.i;
200 CHECK (canvas.testContains (someID));
201 CHECK (canvas.testContains (widget.i));
203 CHECK (not canvas.testContains (someID));
204 CHECK (canvas.testContains (widget.i));
205 CHECK (not canvas.empty());
223 using OrderIdx = vector<HookedWidget*>;
230 for (uint i=0; i<20; ++i)
231 orderIdx.push_back (& widgets.emplace<HookedWidget>(canvas));
234 auto orderSequence = [&] {
return lib::ptrDeref(eachElm(orderIdx)); };
236 CHECK (canvas.testContainsSequence (eachElm(widgets)));
237 CHECK (canvas.testContainsSequence (orderSequence()));
240 shuffle (orderIdx.begin(),orderIdx.end(), std::random_device());
241 CHECK (not canvas.testContainsSequence (orderSequence()));
244 canvas.reOrder (orderSequence());
245 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
int rani(uint bound=_iBOUND())
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.
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)
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, based directly on the referee's memory identities. ...