Debian Codegraph @

tests/auto/wayland/nooutput/tst_nooutput.cpp

raw
1 // Copyright (C) 2019 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include "mockcompositor.h"
5 #include <QtGui/QScreen>
6 #include <QtGui/QRasterWindow>
7
8 using namespace MockCompositor;
9
10 class NoOutputCompositor : public DefaultCompositor {
11 public:
12 NoOutputCompositor()
13 {
14 exec([this] { removeAll<Output>(); });
15 m_config.autoConfigure = false;
16 }
17 };
18
19 class tst_nooutput : public QObject, private NoOutputCompositor
20 {
21 Q_OBJECT
22 private slots:
23 void cleanup()
24 {
25 // There should be no wl_outputs in this test
26 QCOMPOSITOR_COMPARE(getAll<Output>().size(), 0);
27 QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
28 }
29 void noScreens();
30 };
31
32 void tst_nooutput::noScreens()
33 {
34 QRasterWindow window;
35 window.resize(16, 16);
36 window.show();
37
38 QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
39
40 QTRY_VERIFY(window.isVisible());
41 // The window should not be exposed before the first xdg_surface configure event
42 QTRY_VERIFY(!window.isExposed());
43
44 exec([&] {
45 xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size
46 xdgSurface()->sendConfigure(nextSerial());
47 });
48
49 QTRY_VERIFY(window.isExposed());
50 }
51
52 QCOMPOSITOR_TEST_MAIN(tst_nooutput)
53 #include "tst_nooutput.moc"