[autotests] Adjust to changes regarding AbstractClient
We need a Mock for AbstractClient and our mock Client needs to inherit from it.icc-effect-5.14.5
parent
912ab71abd
commit
6826b9eb94
|
@ -197,6 +197,7 @@ target_link_libraries(effectversionplugin kwineffects)
|
||||||
########################################################
|
########################################################
|
||||||
set( testScreens_SRCS
|
set( testScreens_SRCS
|
||||||
test_screens.cpp
|
test_screens.cpp
|
||||||
|
mock_abstract_client.cpp
|
||||||
mock_client.cpp
|
mock_client.cpp
|
||||||
mock_screens.cpp
|
mock_screens.cpp
|
||||||
mock_workspace.cpp
|
mock_workspace.cpp
|
||||||
|
@ -224,6 +225,7 @@ ecm_mark_as_test(testScreens)
|
||||||
########################################################
|
########################################################
|
||||||
set( testXRandRScreens_SRCS
|
set( testXRandRScreens_SRCS
|
||||||
test_xrandr_screens.cpp
|
test_xrandr_screens.cpp
|
||||||
|
mock_abstract_client.cpp
|
||||||
mock_client.cpp
|
mock_client.cpp
|
||||||
mock_screens.cpp
|
mock_screens.cpp
|
||||||
mock_workspace.cpp
|
mock_workspace.cpp
|
||||||
|
@ -259,6 +261,7 @@ ecm_mark_as_test(testXRandRScreens)
|
||||||
########################################################
|
########################################################
|
||||||
set( testScreenEdges_SRCS
|
set( testScreenEdges_SRCS
|
||||||
test_screen_edges.cpp
|
test_screen_edges.cpp
|
||||||
|
mock_abstract_client.cpp
|
||||||
mock_client.cpp
|
mock_client.cpp
|
||||||
mock_screens.cpp
|
mock_screens.cpp
|
||||||
mock_workspace.cpp
|
mock_workspace.cpp
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include "mock_abstract_client.h"
|
|
@ -0,0 +1,94 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2014 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/>.
|
||||||
|
*********************************************************************/
|
||||||
|
#include "mock_abstract_client.h"
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
AbstractClient::AbstractClient(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
, m_active(false)
|
||||||
|
, m_screen(0)
|
||||||
|
, m_fullscreen(false)
|
||||||
|
, m_hiddenInternal(false)
|
||||||
|
, m_geometry()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractClient::~AbstractClient() = default;
|
||||||
|
|
||||||
|
bool AbstractClient::isActive() const
|
||||||
|
{
|
||||||
|
return m_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::setActive(bool active)
|
||||||
|
{
|
||||||
|
m_active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::setScreen(int screen)
|
||||||
|
{
|
||||||
|
m_screen = screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractClient::isOnScreen(int screen) const
|
||||||
|
{
|
||||||
|
// TODO: mock checking client geometry
|
||||||
|
return screen == m_screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AbstractClient::screen() const
|
||||||
|
{
|
||||||
|
return m_screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::setFullScreen(bool set)
|
||||||
|
{
|
||||||
|
m_fullscreen = set;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractClient::isFullScreen() const
|
||||||
|
{
|
||||||
|
return m_fullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractClient::isHiddenInternal() const
|
||||||
|
{
|
||||||
|
return m_hiddenInternal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::setHiddenInternal(bool set)
|
||||||
|
{
|
||||||
|
m_hiddenInternal = set;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::setGeometry(const QRect &rect)
|
||||||
|
{
|
||||||
|
m_geometry = rect;
|
||||||
|
emit geometryChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect AbstractClient::geometry() const
|
||||||
|
{
|
||||||
|
return m_geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2014 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_MOCK_ABSTRACT_CLIENT_H
|
||||||
|
#define KWIN_MOCK_ABSTRACT_CLIENT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QRect>
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
class AbstractClient : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AbstractClient(QObject *parent);
|
||||||
|
virtual ~AbstractClient();
|
||||||
|
|
||||||
|
int screen() const;
|
||||||
|
bool isOnScreen(int screen) const;
|
||||||
|
bool isActive() const;
|
||||||
|
bool isFullScreen() const;
|
||||||
|
bool isHiddenInternal() const;
|
||||||
|
QRect geometry() const;
|
||||||
|
|
||||||
|
void setActive(bool active);
|
||||||
|
void setScreen(int screen);
|
||||||
|
void setFullScreen(bool set);
|
||||||
|
void setHiddenInternal(bool set);
|
||||||
|
void setGeometry(const QRect &rect);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void geometryChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_active;
|
||||||
|
int m_screen;
|
||||||
|
bool m_fullscreen;
|
||||||
|
bool m_hiddenInternal;
|
||||||
|
QRect m_geometry;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,77 +23,15 @@ namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
Client::Client(QObject *parent)
|
Client::Client(QObject *parent)
|
||||||
: QObject(parent)
|
: AbstractClient(parent)
|
||||||
, m_active(false)
|
|
||||||
, m_screen(0)
|
|
||||||
, m_fullscreen(false)
|
|
||||||
, m_hiddenInternal(false)
|
|
||||||
, m_geometry()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client() = default;
|
Client::~Client() = default;
|
||||||
|
|
||||||
bool Client::isActive() const
|
|
||||||
{
|
|
||||||
return m_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::setActive(bool active)
|
|
||||||
{
|
|
||||||
m_active = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::setScreen(int screen)
|
|
||||||
{
|
|
||||||
m_screen = screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Client::isOnScreen(int screen) const
|
|
||||||
{
|
|
||||||
// TODO: mock checking client geometry
|
|
||||||
return screen == m_screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Client::screen() const
|
|
||||||
{
|
|
||||||
return m_screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::showOnScreenEdge()
|
void Client::showOnScreenEdge()
|
||||||
{
|
{
|
||||||
setHiddenInternal(false);
|
setHiddenInternal(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setFullScreen(bool set)
|
|
||||||
{
|
|
||||||
m_fullscreen = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Client::isFullScreen() const
|
|
||||||
{
|
|
||||||
return m_fullscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Client::isHiddenInternal() const
|
|
||||||
{
|
|
||||||
return m_hiddenInternal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::setHiddenInternal(bool set)
|
|
||||||
{
|
|
||||||
m_hiddenInternal = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::setGeometry(const QRect &rect)
|
|
||||||
{
|
|
||||||
m_geometry = rect;
|
|
||||||
emit geometryChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect Client::geometry() const
|
|
||||||
{
|
|
||||||
return m_geometry;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,43 +20,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef KWIN_MOCK_CLIENT_H
|
#ifndef KWIN_MOCK_CLIENT_H
|
||||||
#define KWIN_MOCK_CLIENT_H
|
#define KWIN_MOCK_CLIENT_H
|
||||||
|
|
||||||
|
#include <abstract_client.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class Client : public QObject
|
class Client : public AbstractClient
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Client(QObject *parent);
|
explicit Client(QObject *parent);
|
||||||
virtual ~Client();
|
virtual ~Client();
|
||||||
|
|
||||||
int screen() const;
|
|
||||||
bool isOnScreen(int screen) const;
|
|
||||||
bool isActive() const;
|
|
||||||
bool isFullScreen() const;
|
|
||||||
bool isHiddenInternal() const;
|
|
||||||
QRect geometry() const;
|
|
||||||
|
|
||||||
void setActive(bool active);
|
|
||||||
void setScreen(int screen);
|
|
||||||
void setFullScreen(bool set);
|
|
||||||
void setHiddenInternal(bool set);
|
|
||||||
void setGeometry(const QRect &rect);
|
|
||||||
|
|
||||||
void showOnScreenEdge();
|
void showOnScreenEdge();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void geometryChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_active;
|
|
||||||
int m_screen;
|
|
||||||
bool m_fullscreen;
|
|
||||||
bool m_hiddenInternal;
|
|
||||||
QRect m_geometry;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "mock_workspace.h"
|
#include "mock_workspace.h"
|
||||||
#include "mock_client.h"
|
#include "mock_abstract_client.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -39,22 +39,22 @@ MockWorkspace::~MockWorkspace()
|
||||||
s_self = nullptr;
|
s_self = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *MockWorkspace::activeClient() const
|
AbstractClient *MockWorkspace::activeClient() const
|
||||||
{
|
{
|
||||||
return m_activeClient;
|
return m_activeClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockWorkspace::setActiveClient(Client *c)
|
void MockWorkspace::setActiveClient(AbstractClient *c)
|
||||||
{
|
{
|
||||||
m_activeClient = c;
|
m_activeClient = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *MockWorkspace::getMovingClient() const
|
AbstractClient *MockWorkspace::getMovingClient() const
|
||||||
{
|
{
|
||||||
return m_movingClient;
|
return m_movingClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockWorkspace::setMovingClient(Client *c)
|
void MockWorkspace::setMovingClient(AbstractClient *c)
|
||||||
{
|
{
|
||||||
m_movingClient = c;
|
m_movingClient = c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class AbstractClient;
|
||||||
class Client;
|
class Client;
|
||||||
class X11EventFilter;
|
class X11EventFilter;
|
||||||
|
|
||||||
|
@ -38,14 +39,14 @@ class MockWorkspace : public QObject
|
||||||
public:
|
public:
|
||||||
explicit MockWorkspace(QObject *parent = nullptr);
|
explicit MockWorkspace(QObject *parent = nullptr);
|
||||||
virtual ~MockWorkspace();
|
virtual ~MockWorkspace();
|
||||||
Client *activeClient() const;
|
AbstractClient *activeClient() const;
|
||||||
Client *getMovingClient() const;
|
AbstractClient *getMovingClient() const;
|
||||||
void setShowingDesktop(bool showing);
|
void setShowingDesktop(bool showing);
|
||||||
bool showingDesktop() const;
|
bool showingDesktop() const;
|
||||||
QRect clientArea(clientAreaOption, int screen, int desktop) const;
|
QRect clientArea(clientAreaOption, int screen, int desktop) const;
|
||||||
|
|
||||||
void setActiveClient(Client *c);
|
void setActiveClient(AbstractClient *c);
|
||||||
void setMovingClient(Client *c);
|
void setMovingClient(AbstractClient *c);
|
||||||
|
|
||||||
void registerEventFilter(X11EventFilter *filter);
|
void registerEventFilter(X11EventFilter *filter);
|
||||||
void unregisterEventFilter(X11EventFilter *filter);
|
void unregisterEventFilter(X11EventFilter *filter);
|
||||||
|
@ -56,8 +57,8 @@ Q_SIGNALS:
|
||||||
void clientRemoved(KWin::Client*);
|
void clientRemoved(KWin::Client*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Client *m_activeClient;
|
AbstractClient *m_activeClient;
|
||||||
Client *m_movingClient;
|
AbstractClient *m_movingClient;
|
||||||
bool m_showingDesktop;
|
bool m_showingDesktop;
|
||||||
static Workspace *s_self;
|
static Workspace *s_self;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue