Add checking if using eglfs

We are using eglfs in VxWorks which make 3 few testcases fail, because eglfs windows are fullscreen by default.
This is the same solution as in qt5 in tag 5.12.6 from commit with hash 39027ef076c.

[...] EGLFS forces the first top-level window - either a QWidget or a QQuickView - to become fullscreen. [...]
from: https://doc.qt.io/qt-6/embedded-linux.html

Change-Id: I3ab3208b3c7c1b2e27d879bac1ee0679f48109e2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Marcin Zdunek 2023-10-19 11:35:21 +02:00
parent 51c75ae2ff
commit c706011dc0

View File

@ -22,6 +22,12 @@
Q_LOGGING_CATEGORY(lcTests, "qt.gui.tests")
static bool isPlatformEglFS()
{
static const bool isEglFS = !QGuiApplication::platformName().compare(QLatin1String("eglfs"), Qt::CaseInsensitive);
return isEglFS;
}
class tst_QWindow: public QObject
{
Q_OBJECT
@ -473,11 +479,16 @@ void tst_QWindow::resizeEventAfterResize()
// Make sure we get a resizeEvent after calling resize
window.resize(m_testWindowSize);
if (isPlatformEglFS())
QEXPECT_FAIL("", "eglfs windows are fullscreen by default.", Continue);
QTRY_COMPARE(window.received(QEvent::Resize), 2);
}
void tst_QWindow::exposeEventOnShrink_QTBUG54040()
{
if (isPlatformEglFS())
QSKIP("", "eglfs windows are fullscreen by default.", Continue);
Window window;
window.setGeometry(QRect(m_availableTopLeft + QPoint(80, 80), m_testWindowSize));
window.setTitle(QTest::currentTestFunction());
@ -660,6 +671,8 @@ void tst_QWindow::childWindowPositioning_data()
void tst_QWindow::childWindowPositioning()
{
if (isPlatformEglFS())
QSKIP("eglfs does not support child windows.");
const QPoint topLeftOrigin(0, 0);
ColoredWindow topLevelWindowFirst(Qt::green);
@ -2131,6 +2144,10 @@ void tst_QWindow::initialSize()
w.setTitle(QLatin1String(QTest::currentTestFunction()));
w.setWidth(m_testWindowSize.width());
w.showNormal();
if (isPlatformEglFS())
QEXPECT_FAIL("", "eglfs windows are fullscreen by default.", Continue);
QTRY_COMPARE(w.width(), m_testWindowSize.width());
QTRY_VERIFY(w.height() > 0);
}
@ -2142,6 +2159,8 @@ void tst_QWindow::initialSize()
w.showNormal();
const QSize expectedSize = testSize;
if (isPlatformEglFS())
QEXPECT_FAIL("", "eglfs windows are fullscreen by default.", Continue);
QTRY_COMPARE(w.size(), expectedSize);
}
}
@ -2317,6 +2336,10 @@ void tst_QWindow::modalWindowPosition()
window.setModality(Qt::WindowModal);
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
if (isPlatformEglFS())
QEXPECT_FAIL("", "eglfs windows are fullscreen by default.", Continue);
QCOMPARE(window.geometry(), origGeo);
}
@ -2345,6 +2368,9 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109()
if (isPlatformOffscreenOrMinimal())
QSKIP("Can't test window focusing on offscreen/minimal");
if (isPlatformEglFS())
QSKIP("QCursor::setPos() is not supported on this platform");
const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center();
const int childOffset = 16;
@ -2525,6 +2551,8 @@ void tst_QWindow::spuriousMouseMove()
QSKIP("No enter events sent");
if (platformName == QLatin1String("wayland"))
QSKIP("Setting mouse cursor position is not possible on Wayland");
if (isPlatformEglFS())
QSKIP("QCursor::setPos() is not supported on this platform");
const QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
const QPoint center = screenGeometry.center();
QCursor::setPos(center);
@ -2946,6 +2974,9 @@ void tst_QWindow::enterLeaveOnWindowShowHide()
if (isPlatformWayland())
QSKIP("Can't set cursor position and qWaitForWindowActive on Wayland");
if (isPlatformEglFS())
QSKIP("QCursor::setPos() is not supported on this platform");
QFETCH(Qt::WindowType, windowType);
class Window : public QWindow