summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/platform
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/platform')
-rw-r--r--tests/auto/gui/platform/CMakeLists.txt3
-rw-r--r--tests/auto/gui/platform/qx11info/CMakeLists.txt11
-rw-r--r--tests/auto/gui/platform/qx11info/tst_qx11info.cpp56
3 files changed, 41 insertions, 29 deletions
diff --git a/tests/auto/gui/platform/CMakeLists.txt b/tests/auto/gui/platform/CMakeLists.txt
index fc2d330fd7..4b2cee205d 100644
--- a/tests/auto/gui/platform/CMakeLists.txt
+++ b/tests/auto/gui/platform/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(QT_FEATURE_xcb)
add_subdirectory(qx11info)
endif()
diff --git a/tests/auto/gui/platform/qx11info/CMakeLists.txt b/tests/auto/gui/platform/qx11info/CMakeLists.txt
index c4ce1f91c8..40188f24a0 100644
--- a/tests/auto/gui/platform/qx11info/CMakeLists.txt
+++ b/tests/auto/gui/platform/qx11info/CMakeLists.txt
@@ -1,7 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qx11info LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qx11info
SOURCES
tst_qx11info.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::GuiPrivate
XCB::XCB
)
diff --git a/tests/auto/gui/platform/qx11info/tst_qx11info.cpp b/tests/auto/gui/platform/qx11info/tst_qx11info.cpp
index 0cd11c87ac..f71e644a8f 100644
--- a/tests/auto/gui/platform/qx11info/tst_qx11info.cpp
+++ b/tests/auto/gui/platform/qx11info/tst_qx11info.cpp
@@ -1,37 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 David Faure <david.faure@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtGui>
#include <QtTest/QtTest>
#include <QtGui/private/qtx11extras_p.h>
+using namespace Qt::StringLiterals;
+
class tst_QX11Info : public QObject
{
Q_OBJECT
@@ -108,10 +85,21 @@ void initialize()
}
Q_CONSTRUCTOR_FUNCTION(initialize)
+static QString checkSkip() {
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ return "This test is only for X11, not Wayland."_L1;
+ if (QGuiApplication::platformName().startsWith(QLatin1String("offscreen"), Qt::CaseInsensitive))
+ return "This test is only for X11, not offscreen."_L1;
+ return ""_L1;
+}
+
void tst_QX11Info::startupId()
{
int argc = 0;
QGuiApplication app(argc, 0);
+ QString result = checkSkip();
+ if (!result.isEmpty())
+ QSKIP(result.toUtf8());
// This relies on the fact that no widget was shown yet,
// so please make sure this method is always the first test.
@@ -133,6 +121,9 @@ void tst_QX11Info::isPlatformX11()
{
int argc = 0;
QGuiApplication app(argc, 0);
+ QString result = checkSkip();
+ if (!result.isEmpty())
+ QSKIP(result.toUtf8());
QVERIFY(QX11Info::isPlatformX11());
}
@@ -141,6 +132,9 @@ void tst_QX11Info::appTime()
{
int argc = 0;
QGuiApplication app(argc, 0);
+ QString result = checkSkip();
+ if (!result.isEmpty())
+ QSKIP(result.toUtf8());
// No X11 event received yet
QCOMPARE(QX11Info::appTime(), 0ul);
@@ -367,6 +361,9 @@ void tst_QX11Info::peeker()
{
int argc = 0;
QGuiApplication app(argc, 0);
+ QString result = checkSkip();
+ if (!result.isEmpty())
+ QSKIP(result.toUtf8());
PeekerTest test;
test.show();
@@ -378,6 +375,9 @@ void tst_QX11Info::isCompositingManagerRunning()
{
int argc = 0;
QGuiApplication app(argc, 0);
+ QString result = checkSkip();
+ if (!result.isEmpty())
+ QSKIP(result.toUtf8());
const bool b = QX11Info::isCompositingManagerRunning();
Q_UNUSED(b);
const bool b2 = QX11Info::isCompositingManagerRunning(0);