Code review comment for lp:~gerboland/miral/fix-windowmanager-tests

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I could add functions to wrap each notifier.* method with flush() call, but
> wasn't sure the test readability would be enhanced. Second opinion desired.

Well, I'd be tempted by a bit more a restructuring of the tests:

All the tests start with:

    WindowModelNotifier notifier;
    WindowModel model(&notifier, nullptr); // no need for controller in this testcase

I don't see why these can't be moved into the fixture.

Then the fixture can have:

    void processEvents(std::function<void>(WindowModelNotifier& notifier) const& eventSource)
    {
        eventSource(notifier);
        qtApp->sendPostedEvents();
    }

and the tests can have:

    processEvents([&](WindowModelNotifier& notifier)
        {
            notifier.addWindow(mirWindowInfo1);
            notifier.addWindow(mirWindowInfo2);
        });

« Back to merge proposal