diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@liri.io> | 2018-08-28 20:17:42 +0200 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@liri.io> | 2019-01-18 14:39:07 +0000 |
commit | 8d9268c5c1a4e3346f4960cf239c822aca01fe83 (patch) | |
tree | 960f83107c0bcd5c96fdd2e3fb04ce4a883a3de2 /tests/auto/compositor | |
parent | ca65a264c8d0259a8699d1c93eee47d840806aad (diff) | |
download | qtwayland-8d9268c5c1a4e3346f4960cf239c822aca01fe83.tar.gz |
Test output related signals from QWaylandCompositor
These signals were never tested, in fact there was a bug where
outputAdded was not emitted if a new output was added with
QWaylandCompositor::setDefaultOutput() that was fixed
in 9875a14daaec12ca65d3cb4a2aaf2c4582e6191d.
Also while we are here, set the default output for TestCompositor.
Change-Id: I21c2ff2f51f52b38f2dc992bcc9c03fd3071e82d
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests/auto/compositor')
-rw-r--r-- | tests/auto/compositor/compositor/testcompositor.cpp | 4 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/tst_compositor.cpp | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/tests/auto/compositor/compositor/testcompositor.cpp b/tests/auto/compositor/compositor/testcompositor.cpp index 22ecf28c..d5967a41 100644 --- a/tests/auto/compositor/compositor/testcompositor.cpp +++ b/tests/auto/compositor/compositor/testcompositor.cpp @@ -41,7 +41,9 @@ TestCompositor::TestCompositor(bool createInputDev) void TestCompositor::create() { - new QWaylandOutput(this, nullptr); + auto output = new QWaylandOutput(this, nullptr); + setDefaultOutput(output); + QWaylandCompositor::create(); connect(this, &QWaylandCompositor::surfaceCreated, this, &TestCompositor::onSurfaceCreated); diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp index 0e11618a..6c4aa107 100644 --- a/tests/auto/compositor/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/compositor/tst_compositor.cpp @@ -79,7 +79,7 @@ private slots: void mapSurface(); void mapSurfaceHiDpi(); void frameCallback(); - void removeOutput(); + void outputs(); void customSurface(); void advertisesXdgShellSupport(); @@ -622,18 +622,33 @@ void tst_WaylandCompositor::frameCallback() wl_surface_destroy(surface); } -void tst_WaylandCompositor::removeOutput() +void tst_WaylandCompositor::outputs() { TestCompositor compositor; + + QSignalSpy defaultOutputSpy(&compositor, SIGNAL(defaultOutputChanged())); + + compositor.create(); + + QSignalSpy outputAddedSpy(&compositor, SIGNAL(outputAdded(QWaylandOutput*))); + QSignalSpy outputRemovedSpy(&compositor, SIGNAL(outputRemoved(QWaylandOutput*))); + QWindow window; window.resize(800, 600); + auto output = new QWaylandOutput(&compositor, &window); + QTRY_COMPARE(outputAddedSpy.count(), 1); + + compositor.setDefaultOutput(output); + QTRY_COMPARE(defaultOutputSpy.count(), 2); - compositor.create(); MockClient client; QTRY_COMPARE(client.m_outputs.size(), 2); delete output; + QTRY_COMPARE(outputRemovedSpy.count(), 1); + QEXPECT_FAIL("", "FIXME: defaultOutputChanged() is not emitted when the default output is removed", Continue); + QTRY_COMPARE(defaultOutputSpy.count(), 3); compositor.flushClients(); QTRY_COMPARE(client.m_outputs.size(), 1); } |