Skip to content

Commit e89255f

Browse files
committed
PySide: Add WebView for macOS
- caused by wrong condition check in 83603fe Pick-to: 6.8 Fixes: PYSIDE-2964 Change-Id: I1b5c441cd7448898e44f8d829b91202e68168666 Reviewed-by: Friedemann Kleint <[email protected]>
1 parent e5d047a commit e89255f

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

sources/pyside6/cmake/PySideHelpers.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ macro(collect_optional_modules)
133133
WebEngineQuick WebSockets HttpServer)
134134
find_package(Qt${QT_MAJOR_VERSION}WebEngineQuick)
135135
# for Windows and Linux, QtWebView depends on QtWebEngine to render content
136-
if ((WIN32 OR UNIX) AND NOT APPLE AND Qt${QT_MAJOR_VERSION}WebEngineQuick_FOUND)
136+
if(Qt${QT_MAJOR_VERSION}WebEngineQuick_FOUND OR APPLE)
137137
list(APPEND ALL_OPTIONAL_MODULES WebView)
138138
endif()
139139
list(APPEND ALL_OPTIONAL_MODULES 3DCore 3DRender 3DInput 3DLogic 3DAnimation 3DExtras)

sources/pyside6/tests/QtWebView/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (C) 2023 The Qt Company Ltd.
2-
# SPDX-License-Identifier: BSD-3-Clause
1+
# Copyright (C) 2024 The Qt Company Ltd.
2+
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3+
4+
PYSIDE_TEST(test_webview.py)
35

4-
# Tests to be added later
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"files": ["test_webview.py"]
3+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) 2024 The Qt Company Ltd.
2+
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3+
from __future__ import annotations
4+
5+
'''Unit test for WebView'''
6+
7+
import os
8+
import sys
9+
import unittest
10+
from pathlib import Path
11+
12+
# Append the necessary paths to sys.path
13+
sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
14+
from init_paths import init_test_paths
15+
init_test_paths(False)
16+
17+
from PySide6.QtWebView import QtWebView
18+
19+
from helper.usesqapplication import UsesQApplication
20+
21+
22+
class QWebViewTestCase(UsesQApplication):
23+
def test_webview_exists(self):
24+
# Initialize QtWebView
25+
QtWebView.initialize()
26+
27+
# Check if QtWebView can be initialized
28+
self.assertTrue(QtWebView is not None)
29+
print("QtWebView is available in PySide6.")
30+
31+
32+
if __name__ == "__main__":
33+
unittest.main()

0 commit comments

Comments
 (0)