Skip to content

Truly independent web browser

UI/Qt: Run platform-independent Qt tests on all platforms

Timothy Flynn65a94b28dfe4
diff --git a/Tests/UI/Qt/CMakeLists.txt b/Tests/UI/Qt/CMakeLists.txt
index 0faeee0f1f1..17bad8d15ae 100644
--- a/Tests/UI/Qt/CMakeLists.txt
+++ b/Tests/UI/Qt/CMakeLists.txt
@@ -16,8 +16,6 @@ else()
ladybird_test_suite(UI/Qt)
endif()
-target_sources(TestUIQt PRIVATE TestBackingStoreRelease.cpp)
-
add_library(QtEventLoopTestMain OBJECT
QtEventLoopTestMain.cpp
"${LADYBIRD_SOURCE_DIR}/Libraries/LibTest/AssertionHandler.cpp"
@@ -39,17 +37,23 @@ if (NOT Qt6_FOUND)
endif()
set(TEST_SOURCES
+ TestBackingStoreRelease.cpp
TestChromeIcons.cpp
TestHiddenPageSizing.cpp
+ TestJavaScriptDialog.cpp
TestNativeTextEditingLineEdit.cpp
+ TestNativeWindowContainerFocus.cpp
TestPerformanceMonitorWidget.cpp
+ TestPermissionPromptPopover.cpp
TestProcessManagerWindow.cpp
TestScreenshotSelectionOverlay.cpp
TestScreenshotViewer.cpp
TestSelectDropdown.cpp
TestSiteSettingsPopover.cpp
+ TestStringUtils.cpp
TestWebCompatReportReview.cpp
TestWebContentViewInputMethod.cpp
+ TestWindowCloseCoordinator.cpp
)
# Crash reports are only saved on macOS and Linux.
@@ -59,16 +63,6 @@ if (APPLE OR LINUX)
)
endif()
-if (LINUX)
- list(APPEND TEST_SOURCES
- TestJavaScriptDialog.cpp
- TestNativeWindowContainerFocus.cpp
- TestPermissionPromptPopover.cpp
- TestStringUtils.cpp
- TestWindowCloseCoordinator.cpp
- )
-endif()
-
target_sources(TestUIQt PRIVATE ${TEST_SOURCES})
set_property(SOURCE TestProcessManagerWindow.cpp APPEND PROPERTY COMPILE_DEFINITIONS TEST_RESOURCE_ROOT="${LADYBIRD_SOURCE_DIR}/Base/res")
diff --git a/UI/Qt/MacWindow.mm b/UI/Qt/MacWindow.mm
index ba8e0e577ba..ec34e536b06 100644
--- a/UI/Qt/MacWindow.mm
+++ b/UI/Qt/MacWindow.mm
@@ -637,6 +637,8 @@ void round_appkit_view_corners(QWidget& widget, qreal radius, QColor const& bord
void stack_appkit_view_below(QWidget& widget, QWidget& sibling)
{
+ if (QGuiApplication::platformName() != "cocoa")
+ return;
auto* view = reinterpret_cast<NSView*>(widget.winId());
auto* sibling_view = reinterpret_cast<NSView*>(sibling.winId());
if (!view || !sibling_view || !sibling_view.superview)
@@ -646,6 +648,8 @@ void stack_appkit_view_below(QWidget& widget, QWidget& sibling)
void round_appkit_view_bottom_corners(QWidget& widget, qreal radius)
{
+ if (QGuiApplication::platformName() != "cocoa")
+ return;
auto* view = reinterpret_cast<NSView*>(widget.winId());
if (!view)
return;
@@ -660,6 +664,8 @@ void round_appkit_view_bottom_corners(QWidget& widget, qreal radius)
void set_appkit_view_opacity(QWidget& widget, qreal opacity)
{
+ if (QGuiApplication::platformName() != "cocoa")
+ return;
auto* view = reinterpret_cast<NSView*>(widget.winId());
if (!view)
return;