summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/corecompositor.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/client/shared/corecompositor.h')
-rw-r--r--tests/auto/client/shared/corecompositor.h54
1 files changed, 18 insertions, 36 deletions
diff --git a/tests/auto/client/shared/corecompositor.h b/tests/auto/client/shared/corecompositor.h
index 254465ee6..2df1b5758 100644
--- a/tests/auto/client/shared/corecompositor.h
+++ b/tests/auto/client/shared/corecompositor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** 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) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_CORECOMPOSITOR_H
#define MOCKCOMPOSITOR_CORECOMPOSITOR_H
@@ -48,11 +23,18 @@ public:
class CoreCompositor
{
public:
- explicit CoreCompositor();
+ enum CompositorType {
+ Default,
+ Legacy // wl-shell
+ };
+
+ CompositorType m_type = Default;
+ explicit CoreCompositor(CompositorType t = Default, int socketFd = -1);
+
~CoreCompositor();
bool isClean();
QString dirtyMessage();
- void dispatch();
+ void dispatch(int timeout = 0);
template<typename function_type, typename... arg_types>
auto exec(function_type func, arg_types&&... args) -> decltype(func())
@@ -117,7 +99,7 @@ public:
global_type *get()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
return casted;
}
@@ -131,7 +113,7 @@ public:
global_type *get(int index)
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global)) {
if (index--)
continue;
@@ -145,11 +127,11 @@ public:
* \brief Returns all globals with the given type, if any
*/
template<typename global_type>
- QVector<global_type *> getAll()
+ QList<global_type *> getAll()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- QVector<global_type *> matching;
- for (auto *global : qAsConst(m_globals)) {
+ QList<global_type *> matching;
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
matching.append(casted);
}
@@ -164,6 +146,7 @@ public:
public:
// Only use this carefully from the test thread (i.e. lock first)
wl_display *m_display = nullptr;
+
protected:
class Lock {
public:
@@ -196,10 +179,9 @@ protected:
CoreCompositor *m_compositor = nullptr;
std::thread::id m_threadId;
};
- QByteArray m_socketName;
wl_event_loop *m_eventLoop = nullptr;
bool m_running = true;
- QVector<Global *> m_globals;
+ QList<Global *> m_globals;
QElapsedTimer m_timer;
private: