kwin/autotests/wayland/kwin_wayland_test.h
Oleg Chernovskiy 61e1a98fb7 Maintenance - fixing naming typos
Fix typos in signal naming var
Fix typo in KWin QPA environment variable
2016-02-09 17:20:12 +01:00

74 lines
2.2 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_WAYLAND_TEST_H
#define KWIN_WAYLAND_TEST_H
#include "../../main.h"
// Qt
#include <QtTest/QtTest>
namespace KWin
{
class WaylandTestApplication : public Application
{
Q_OBJECT
public:
WaylandTestApplication(int &argc, char **argv);
virtual ~WaylandTestApplication();
protected:
void performStartup() override;
private:
void createBackend();
void createX11Connection();
void continueStartupWithScreens();
void continueStartupWithX();
void startXwaylandServer();
int m_xcbConnectionFd = -1;
QProcess *m_xwaylandProcess = nullptr;
QMetaObject::Connection m_xwaylandFailConnection;
};
}
#define WAYLANDTEST_MAIN_HELPER(TestObject, DPI) \
int main(int argc, char *argv[]) \
{ \
setenv("QT_QPA_PLATFORM", "wayland-org.kde.kwin.qpa", true); \
setenv("QT_QPA_PLATFORM_PLUGIN_PATH", KWINQPAPATH, true); \
setenv("KWIN_FORCE_OWN_QPA", "1", true); \
DPI; \
KWin::WaylandTestApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
#define WAYLANTEST_MAIN(TestObject) WAYLANDTEST_MAIN_HELPER(TestObject, QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling) )
#else
#define WAYLANTEST_MAIN(TestObject) WAYLANDTEST_MAIN_HELPER(TestObject,)
#endif
#endif