| 1 |
// Copyright (C) 2021 David Edmundson <[email protected]> |
| 2 |
// Copyright (C) 2018 Pier Luigi Fiorini <[email protected]> |
| 3 |
// Copyright (C) 2017 The Qt Company Ltd. |
| 4 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 5 |
|
| 6 |
#include "mockcompositor.h" |
| 7 |
|
| 8 |
#include <QRasterWindow> |
| 9 |
|
| 10 |
#include <QtTest/QtTest> |
| 11 |
|
| 12 |
using namespace MockCompositor; |
| 13 |
|
| 14 |
class tst_WaylandClientFullScreenShellV1 : public QObject, private DefaultCompositor |
| 15 |
{ |
| 16 |
Q_OBJECT |
| 17 |
|
| 18 |
private slots: |
| 19 |
void createDestroyWindow(); |
| 20 |
}; |
| 21 |
|
| 22 |
void tst_WaylandClientFullScreenShellV1::createDestroyWindow() |
| 23 |
{ |
| 24 |
QRasterWindow window; |
| 25 |
window.resize(800, 600); |
| 26 |
window.show(); |
| 27 |
|
| 28 |
QCOMPOSITOR_TRY_VERIFY(fullScreenShellV1()->surfaces().size() == 1); |
| 29 |
QCOMPOSITOR_VERIFY(surface(0)); |
| 30 |
|
| 31 |
window.destroy(); |
| 32 |
QCOMPOSITOR_TRY_VERIFY(!surface(0)); |
| 33 |
} |
| 34 |
|
| 35 |
int main(int argc, char **argv) |
| 36 |
{ |
| 37 |
QTemporaryDir tmpRuntimeDir; |
| 38 |
qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); |
| 39 |
qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin |
| 40 |
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1"); |
| 41 |
qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); // window decorations don't make much sense here |
| 42 |
|
| 43 |
tst_WaylandClientFullScreenShellV1 tc; |
| 44 |
QGuiApplication app(argc, argv); |
| 45 |
QTEST_SET_MAIN_SOURCE_PATH |
| 46 |
return QTest::qExec(&tc, argc, argv); |
| 47 |
} |
| 48 |
|
| 49 |
#include <tst_fullscreenshellv1.moc> |