[autotests] Fix remaining autotests with failing border calculation
Summary:
As in 2c088894b
fix remaining autotests failing since no borders has become
the new default behavior of Breeze.
Autotests should not rely on this default behavior of Breeze though, but be
run with a faked deco such that changes on Breeze does not directly change
the autotests behavior. That's a goal for the future.
Test Plan: 100% tests passed, 0 tests failed out of 147
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21746
icc-effect-5.17.5
parent
26d7996e54
commit
73fa7df1fc
|
@ -75,7 +75,8 @@ void DontCrashGlxgearsTest::testGlxgears()
|
||||||
QVERIFY(decoration);
|
QVERIFY(decoration);
|
||||||
|
|
||||||
// send a mouse event to the position of the close button
|
// send a mouse event to the position of the close button
|
||||||
QPointF pos = decoration->rect().topRight() + QPointF(-decoration->borderRight() * 2, decoration->borderRight() * 2);
|
// TODO: position is dependent on the decoration in use. We should use a static target instead, a fake deco for autotests.
|
||||||
|
QPointF pos = decoration->rect().topRight() + QPointF(-decoration->borderTop() / 2, decoration->borderTop() / 2);
|
||||||
QHoverEvent event(QEvent::HoverMove, pos, pos);
|
QHoverEvent event(QEvent::HoverMove, pos, pos);
|
||||||
QCoreApplication::instance()->sendEvent(decoration, &event);
|
QCoreApplication::instance()->sendEvent(decoration, &event);
|
||||||
// mouse press
|
// mouse press
|
||||||
|
|
|
@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "kwin_wayland_test.h"
|
#include "kwin_wayland_test.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
#include "decorations/decorationbridge.h"
|
||||||
|
#include "decorations/settings.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "shell_client.h"
|
#include "shell_client.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
|
@ -37,8 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KWayland/Server/shell_interface.h>
|
#include <KWayland/Server/shell_interface.h>
|
||||||
#include <KWayland/Server/xdgdecoration_interface.h>
|
#include <KWayland/Server/xdgdecoration_interface.h>
|
||||||
|
|
||||||
#include <KDecoration2/Decoration>
|
|
||||||
#include <KDecoration2/DecoratedClient>
|
#include <KDecoration2/DecoratedClient>
|
||||||
|
#include <KDecoration2/Decoration>
|
||||||
|
#include <KDecoration2/DecorationSettings>
|
||||||
|
|
||||||
using namespace KWin;
|
using namespace KWin;
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
|
@ -120,6 +123,10 @@ void TestMaximized::testMaximizedPassedToDeco()
|
||||||
QVERIFY(decoration);
|
QVERIFY(decoration);
|
||||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||||
|
|
||||||
|
// When there are no borders, there is no change to them when maximizing.
|
||||||
|
// TODO: we should test both cases with fixed fake decoration for autotests.
|
||||||
|
const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None;
|
||||||
|
|
||||||
// now maximize
|
// now maximize
|
||||||
QVERIFY(sizeChangedSpy.isEmpty());
|
QVERIFY(sizeChangedSpy.isEmpty());
|
||||||
QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged);
|
QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged);
|
||||||
|
@ -134,11 +141,14 @@ void TestMaximized::testMaximizedPassedToDeco()
|
||||||
QCOMPARE(sizeChangedSpy.first().first().toSize(), QSize(1280, 1024 - decoration->borderTop()));
|
QCOMPARE(sizeChangedSpy.first().first().toSize(), QSize(1280, 1024 - decoration->borderTop()));
|
||||||
Test::render(surface.data(), sizeChangedSpy.first().first().toSize(), Qt::red);
|
Test::render(surface.data(), sizeChangedSpy.first().first().toSize(), Qt::red);
|
||||||
QVERIFY(geometryShapeChangedSpy.wait());
|
QVERIFY(geometryShapeChangedSpy.wait());
|
||||||
QCOMPARE(geometryShapeChangedSpy.count(), 2);
|
|
||||||
|
// If no borders, there is only the initial geometry shape change, but none through border resizing.
|
||||||
|
QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 2 : 1);
|
||||||
|
|
||||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
||||||
QCOMPARE(maximizedChangedSpy.count(), 1);
|
QCOMPARE(maximizedChangedSpy.count(), 1);
|
||||||
QCOMPARE(maximizedChangedSpy.last().first().toBool(), true);
|
QCOMPARE(maximizedChangedSpy.last().first().toBool(), true);
|
||||||
QCOMPARE(bordersChangedSpy.count(), 1);
|
QCOMPARE(bordersChangedSpy.count(), hasBorders ? 1 : 0);
|
||||||
QCOMPARE(decoration->borderLeft(), 0);
|
QCOMPARE(decoration->borderLeft(), 0);
|
||||||
QCOMPARE(decoration->borderBottom(), 0);
|
QCOMPARE(decoration->borderBottom(), 0);
|
||||||
QCOMPARE(decoration->borderRight(), 0);
|
QCOMPARE(decoration->borderRight(), 0);
|
||||||
|
@ -149,15 +159,15 @@ void TestMaximized::testMaximizedPassedToDeco()
|
||||||
|
|
||||||
Test::render(surface.data(), QSize(100, 50), Qt::red);
|
Test::render(surface.data(), QSize(100, 50), Qt::red);
|
||||||
QVERIFY(geometryShapeChangedSpy.wait());
|
QVERIFY(geometryShapeChangedSpy.wait());
|
||||||
QCOMPARE(geometryShapeChangedSpy.count(), 4);
|
QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 4 : 2);
|
||||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||||
QCOMPARE(maximizedChangedSpy.count(), 2);
|
QCOMPARE(maximizedChangedSpy.count(), 2);
|
||||||
QCOMPARE(maximizedChangedSpy.last().first().toBool(), false);
|
QCOMPARE(maximizedChangedSpy.last().first().toBool(), false);
|
||||||
QCOMPARE(bordersChangedSpy.count(), 2);
|
QCOMPARE(bordersChangedSpy.count(), hasBorders ? 2 : 0);
|
||||||
QVERIFY(decoration->borderTop() != 0);
|
QVERIFY(decoration->borderTop() != 0);
|
||||||
QVERIFY(decoration->borderLeft() != 0);
|
QVERIFY(decoration->borderLeft() != !hasBorders);
|
||||||
QVERIFY(decoration->borderRight() != 0);
|
QVERIFY(decoration->borderRight() != !hasBorders);
|
||||||
QVERIFY(decoration->borderBottom() != 0);
|
QVERIFY(decoration->borderBottom() != !hasBorders);
|
||||||
|
|
||||||
QCOMPARE(sizeChangedSpy.count(), 2);
|
QCOMPARE(sizeChangedSpy.count(), 2);
|
||||||
QCOMPARE(sizeChangedSpy.last().first().toSize(), QSize(100, 50));
|
QCOMPARE(sizeChangedSpy.last().first().toSize(), QSize(100, 50));
|
||||||
|
|
|
@ -22,13 +22,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "abstract_client.h"
|
#include "abstract_client.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
#include "decorations/decorationbridge.h"
|
||||||
|
#include "decorations/settings.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "shell_client.h"
|
#include "shell_client.h"
|
||||||
#include "scripting/scripting.h"
|
#include "scripting/scripting.h"
|
||||||
|
|
||||||
|
#include <KDecoration2/DecoratedClient>
|
||||||
#include <KDecoration2/Decoration>
|
#include <KDecoration2/Decoration>
|
||||||
|
#include <KDecoration2/DecorationSettings>
|
||||||
|
|
||||||
#include <KWayland/Client/connection_thread.h>
|
#include <KWayland/Client/connection_thread.h>
|
||||||
#include <KWayland/Client/compositor.h>
|
#include <KWayland/Client/compositor.h>
|
||||||
|
@ -579,10 +583,15 @@ void QuickTilingTest::testQuickTilingTouchMoveXdgShell()
|
||||||
kwinApp()->platform()->touchUp(0, timestamp++);
|
kwinApp()->platform()->touchUp(0, timestamp++);
|
||||||
QVERIFY(!workspace()->moveResizeClient());
|
QVERIFY(!workspace()->moveResizeClient());
|
||||||
|
|
||||||
|
|
||||||
|
// When there are no borders, there is no change to them when quick-tiling.
|
||||||
|
// TODO: we should test both cases with fixed fake decoration for autotests.
|
||||||
|
const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None;
|
||||||
|
|
||||||
QCOMPARE(quickTileChangedSpy.count(), 1);
|
QCOMPARE(quickTileChangedSpy.count(), 1);
|
||||||
QTEST(c->quickTileMode(), "expectedMode");
|
QTEST(c->quickTileMode(), "expectedMode");
|
||||||
QVERIFY(configureRequestedSpy.wait());
|
QVERIFY(configureRequestedSpy.wait());
|
||||||
QTRY_COMPARE(configureRequestedSpy.count(), 5);
|
QTRY_COMPARE(configureRequestedSpy.count(), hasBorders ? 5 : 4);
|
||||||
QCOMPARE(false, configureRequestedSpy.last().first().toSize().isEmpty());
|
QCOMPARE(false, configureRequestedSpy.last().first().toSize().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "kwin_wayland_test.h"
|
#include "kwin_wayland_test.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
#include "decorations/decorationbridge.h"
|
||||||
|
#include "decorations/settings.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
@ -28,7 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <QDBusConnection>
|
#include <KDecoration2/DecoratedClient>
|
||||||
|
#include <KDecoration2/Decoration>
|
||||||
|
#include <KDecoration2/DecorationSettings>
|
||||||
|
|
||||||
#include <KWayland/Client/connection_thread.h>
|
#include <KWayland/Client/connection_thread.h>
|
||||||
#include <KWayland/Client/compositor.h>
|
#include <KWayland/Client/compositor.h>
|
||||||
|
@ -45,6 +49,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KWayland/Server/shell_interface.h>
|
#include <KWayland/Server/shell_interface.h>
|
||||||
#include <KWayland/Server/xdgdecoration_interface.h>
|
#include <KWayland/Server/xdgdecoration_interface.h>
|
||||||
|
|
||||||
|
#include <QDBusConnection>
|
||||||
|
|
||||||
// system
|
// system
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -74,6 +80,7 @@ private Q_SLOTS:
|
||||||
void testMinimizeActiveWindow();
|
void testMinimizeActiveWindow();
|
||||||
void testFullscreen_data();
|
void testFullscreen_data();
|
||||||
void testFullscreen();
|
void testFullscreen();
|
||||||
|
|
||||||
void testFullscreenRestore_data();
|
void testFullscreenRestore_data();
|
||||||
void testFullscreenRestore();
|
void testFullscreenRestore();
|
||||||
void testUserCanSetFullscreen_data();
|
void testUserCanSetFullscreen_data();
|
||||||
|
@ -81,6 +88,7 @@ private Q_SLOTS:
|
||||||
void testUserSetFullscreenWlShell();
|
void testUserSetFullscreenWlShell();
|
||||||
void testUserSetFullscreenXdgShell_data();
|
void testUserSetFullscreenXdgShell_data();
|
||||||
void testUserSetFullscreenXdgShell();
|
void testUserSetFullscreenXdgShell();
|
||||||
|
|
||||||
void testMaximizedToFullscreenWlShell_data();
|
void testMaximizedToFullscreenWlShell_data();
|
||||||
void testMaximizedToFullscreenWlShell();
|
void testMaximizedToFullscreenWlShell();
|
||||||
void testMaximizedToFullscreenXdgShell_data();
|
void testMaximizedToFullscreenXdgShell_data();
|
||||||
|
@ -776,9 +784,15 @@ void TestShellClient::testMaximizedToFullscreenWlShell()
|
||||||
QVERIFY(fullscreenChangedSpy.wait());
|
QVERIFY(fullscreenChangedSpy.wait());
|
||||||
if (decoMode == ServerSideDecoration::Mode::Server) {
|
if (decoMode == ServerSideDecoration::Mode::Server) {
|
||||||
QVERIFY(sizeChangeRequestedSpy.wait());
|
QVERIFY(sizeChangeRequestedSpy.wait());
|
||||||
// fails as we don't correctly call setMaximize(false)
|
|
||||||
|
// TODO: we should test both cases with fixed fake decoration for autotests.
|
||||||
|
const bool hasBorders = Decoration::DecorationBridge::self()->settings()->borderSize() != KDecoration2::BorderSize::None;
|
||||||
|
|
||||||
|
// fails if we have borders as we don't correctly call setMaximize(false)
|
||||||
// but realistically the only toolkits that support the deco also use XDGShell
|
// but realistically the only toolkits that support the deco also use XDGShell
|
||||||
QEXPECT_FAIL("wlShell - deco", "With decoration incorrect geometry requested", Continue);
|
if (hasBorders) {
|
||||||
|
QEXPECT_FAIL("wlShell - deco", "With decoration incorrect geometry requested", Continue);
|
||||||
|
}
|
||||||
QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50));
|
QCOMPARE(sizeChangeRequestedSpy.last().first().toSize(), QSize(100, 50));
|
||||||
}
|
}
|
||||||
// TODO: should switch to fullscreen once it's updated
|
// TODO: should switch to fullscreen once it's updated
|
||||||
|
|
|
@ -147,7 +147,7 @@ void XWaylandInputTest::testPointerEnterLeave()
|
||||||
Xcb::Atom atom(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW"), false, c.data());
|
Xcb::Atom atom(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW"), false, c.data());
|
||||||
|
|
||||||
xcb_window_t w = xcb_generate_id(c.data());
|
xcb_window_t w = xcb_generate_id(c.data());
|
||||||
const QRect windowGeometry = QRect(0, 0, 10, 20);
|
const QRect windowGeometry = QRect(0, 0, 100, 200);
|
||||||
const uint32_t values[] = {
|
const uint32_t values[] = {
|
||||||
XCB_EVENT_MASK_ENTER_WINDOW |
|
XCB_EVENT_MASK_ENTER_WINDOW |
|
||||||
XCB_EVENT_MASK_LEAVE_WINDOW
|
XCB_EVENT_MASK_LEAVE_WINDOW
|
||||||
|
|
Loading…
Reference in New Issue