Skip to content

Commit

Permalink
[autotest] Add workaround for broken no-XRandr in screen edge test
Browse files Browse the repository at this point in the history
With Qt 5.5 the physicalSize of a screen is broken if the X system does
not provide the XRandR extension. This caused our screen edge test to
fail on the CI system (Xvfb) due to approach window being based on the
dpi.

The problem itself is addressed for Qt in:
https://codereview.qt-project.org/126808

This change just worksaround till the change has made it into our CI
system (at which point the expected fails will break).

Reviewed-By: David Edmundson
  • Loading branch information
mgraesslin committed Sep 30, 2015
1 parent 8073d85 commit eda4f61
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autotests/CMakeLists.txt
Expand Up @@ -270,6 +270,7 @@ set( testScreenEdges_SRCS
../screens.cpp
../screenedge.cpp
../virtualdesktops.cpp
../xcbutils.cpp # init of extensions
)
kconfig_add_kcfg_files(testScreenEdges_SRCS ../settings.kcfgc)
qt5_add_dbus_interface( testScreenEdges_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../org.freedesktop.ScreenSaver.xml screenlocker_interface)
Expand All @@ -286,6 +287,13 @@ target_link_libraries(testScreenEdges
KF5::GlobalAccel
KF5::WindowSystem
XCB::XCB
XCB::RANDR
XCB::XFIXES
XCB::SYNC
XCB::COMPOSITE
XCB::DAMAGE
XCB::GLX
XCB::SHM
)

add_test(kwin_testScreenEdges testScreenEdges)
Expand Down
10 changes: 10 additions & 0 deletions autotests/test_screen_edges.cpp
Expand Up @@ -305,6 +305,11 @@ void TestScreenEdges::testCreatingInitialEdges()
// approach windows for edges not created as screen too small
s->updateLayout();
auto edgeWindows = s->windows();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
if (!Xcb::Extensions::self()->isRandrAvailable()) {
QEXPECT_FAIL("", "Broken on no xrandr systems in Qt 5.5", Abort);
}
#endif
QCOMPARE(edgeWindows.size(), 12);

auto testWindowGeometry = [&](int index) {
Expand Down Expand Up @@ -423,6 +428,11 @@ void TestScreenEdges::testCallback()
auto it = std::find_if(edges.constBegin(), edges.constEnd(), [](Edge *e) {
return e->isScreenEdge() && e->isLeft() && e->approachGeometry().bottom() < 768;
});
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
if (!Xcb::Extensions::self()->isRandrAvailable()) {
QEXPECT_FAIL("", "Broken on no xrandr systems in Qt 5.5", Abort);
}
#endif
QVERIFY(it != edges.constEnd());

xcb_enter_notify_event_t event;
Expand Down

0 comments on commit eda4f61

Please sign in to comment.