test: Simplify tests with parent-child relationships
Create object instances with a parent to avoid the need for reparenting objects manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
d7aded92d3
commit
778f6b1d70
2 changed files with 2 additions and 14 deletions
|
@ -27,7 +27,7 @@ public:
|
|||
{
|
||||
pipe(pipefd_);
|
||||
|
||||
notifier_ = new EventNotifier(pipefd_[0], EventNotifier::Read);
|
||||
notifier_ = new EventNotifier(pipefd_[0], EventNotifier::Read, this);
|
||||
notifier_->activated.connect(this, &EventHandler::readReady);
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,6 @@ public:
|
|||
return notified_;
|
||||
}
|
||||
|
||||
void moveToThread(Thread *thread)
|
||||
{
|
||||
Object::moveToThread(thread);
|
||||
notifier_->moveToThread(thread);
|
||||
}
|
||||
|
||||
private:
|
||||
void readReady(EventNotifier *notifier)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ class TimeoutHandler : public Object
|
|||
{
|
||||
public:
|
||||
TimeoutHandler()
|
||||
: timeout_(false)
|
||||
: timer_(this), timeout_(false)
|
||||
{
|
||||
timer_.timeout.connect(this, &TimeoutHandler::timeoutHandler);
|
||||
timer_.start(100);
|
||||
|
@ -31,12 +31,6 @@ public:
|
|||
return timeout_;
|
||||
}
|
||||
|
||||
void moveToThread(Thread *thread)
|
||||
{
|
||||
Object::moveToThread(thread);
|
||||
timer_.moveToThread(thread);
|
||||
}
|
||||
|
||||
private:
|
||||
void timeoutHandler(Timer *timer)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue