From 7d6bac5f2b509e9f1e32c2be20e77451e4fd12c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 29 Sep 2024 18:45:32 +0200 Subject: [PATCH] macOS: Remove checks for macHasAccessToWindowsServer We do have access to the window server, as reported by the CGSessionCopyCurrentDictionary() API. As most of our UI tests do require window server access in some form, let's remove the existing checks, as they should no longer be needed the way we run CI these days. Change-Id: I9ac18bbcc67abf0705c8b4e071dd5f2de0fb5092 Reviewed-by: Timur Pocheptsov --- .../widgets/kernel/qwidget/tst_qwidget.cpp | 23 ------------------- .../widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 16 ------------- 2 files changed, 39 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 0de06713e4c..37a1f32ca31 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -85,17 +85,6 @@ static HWND winHandleOf(const QWidget *w) # define Q_CHECK_PAINTEVENTS #endif -#ifdef Q_OS_MACOS -#include -bool macHasAccessToWindowsServer() -{ - SecuritySessionId mySession; - SessionAttributeBits sessionInfo; - SessionGetInfo(callerSecuritySession, &mySession, &sessionInfo); - return (sessionInfo & sessionHasGraphicAccess); -} -#endif - #if defined(Q_OS_WIN) static inline void setWindowsAnimationsEnabled(bool enabled) { @@ -3563,15 +3552,7 @@ void tst_QWidget::showMinimizedKeepsFocus() window.showNormal(); QVERIFY(QTest::qWaitForWindowActive(&window)); -#ifdef Q_OS_MACOS - if (!macHasAccessToWindowsServer()) - QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); -#endif QTRY_COMPARE(window.focusWidget(), firstchild); -#ifdef Q_OS_MACOS - if (!macHasAccessToWindowsServer()) - QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); -#endif QTRY_COMPARE(QApplication::focusWidget(), firstchild); } } @@ -9636,10 +9617,6 @@ void tst_QWidget::doubleRepaint() QSKIP("QTBUG-52974"); #endif -#if defined(Q_OS_MACOS) - if (!macHasAccessToWindowsServer()) - QSKIP("Not having window server access causes the wrong number of repaints to be issues"); -#endif UpdateWidget widget; widget.setPalette(simplePalette()); widget.setWindowTitle(QLatin1String(QTest::currentTestFunction())); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index ef00dcaac0f..7a2335896ce 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -413,18 +413,6 @@ void tst_QMdiArea::subWindowActivated() } } -#ifdef Q_OS_MAC -#include -bool macHasAccessToWindowsServer() -{ - SecuritySessionId mySession; - SessionAttributeBits sessionInfo; - SessionGetInfo(callerSecuritySession, &mySession, &sessionInfo); - return (sessionInfo & sessionHasGraphicAccess); -} -#endif - - void tst_QMdiArea::subWindowActivated2() { if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) @@ -481,10 +469,6 @@ void tst_QMdiArea::subWindowActivated2() // Check that we only emit _one_ signal and the active window // is unchanged after showMinimized/showNormal. mdiArea.showMinimized(); -#if defined (Q_OS_MAC) - if (!macHasAccessToWindowsServer()) - QEXPECT_FAIL("", "showMinimized doesn't really minimize if you don't have access to the server", Abort); -#endif #ifdef Q_OS_MAC QSKIP("QTBUG-25298: This test is unstable on Mac."); #endif