aboutsummaryrefslogtreecommitdiff
path: root/libs/plugin_python/tests/python/test_qt_widgets.py
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
commit7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch)
tree27fb39be241fdb5ac2734c574de678977d1856d0 /libs/plugin_python/tests/python/test_qt_widgets.py
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/plugin_python/tests/python/test_qt_widgets.py')
-rw-r--r--libs/plugin_python/tests/python/test_qt_widgets.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/libs/plugin_python/tests/python/test_qt_widgets.py b/libs/plugin_python/tests/python/test_qt_widgets.py
new file mode 100644
index 0000000..057f34e
--- /dev/null
+++ b/libs/plugin_python/tests/python/test_qt_widgets.py
@@ -0,0 +1,62 @@
+from PyQt6.QtWidgets import QWidget
+
+import mobase_tests.qt_widgets as m
+
+
+class PyWidget(QWidget):
+ def heightForWidth(self, a0: int) -> int:
+ return a0 * 3 + 4
+
+
+class PyCustomWidget(m.CustomWidget):
+ def __init__(self, name: str):
+ super().__init__(name)
+
+ def heightForWidth(self, value: int) -> int:
+ return value * 6 - 5
+
+
+def test_qt_widget():
+ # own cpp
+ w = m.make_widget_own_cpp("w1")
+ assert m.is_alive("w1")
+ assert m.is_owned_cpp("w1")
+
+ del w
+ assert m.is_alive("w1")
+
+ # own py
+ w = m.make_widget_own_py("w2")
+ assert m.is_alive("w2")
+ assert not m.is_owned_cpp("w2")
+
+ del w
+ assert not m.is_alive("w2")
+
+ # transfer to C++
+ w = PyWidget()
+ m.send_to_cpp("w3", w)
+
+ # delete the reference w - this should NOT delete the underlying object since it
+ # was transferred to C++
+ del w
+ assert m.is_alive("w3")
+ assert m.is_owned_cpp("w3")
+
+ # if the Python object is dead (BAD!), this will crash horrible
+ assert m.heightForWidth("w3", 4) == 4 * 3 + 4
+
+ # CustomWidget as a qholder, so the construction itself transfers the ownership
+ # to C++
+ w = PyCustomWidget("w4")
+ w.set_parent_cpp()
+ assert m.is_alive("w4")
+ assert m.heightForWidth("w4", 7) == 6 * 7 - 5
+ assert w.heightForWidth(7) == 6 * 7 - 5
+
+ # can call function not defined and not bound through the delegate
+ assert not w.hasHeightForWidth()
+
+ del w
+ assert m.is_alive("w4")
+ assert m.heightForWidth("w4", 7) == 6 * 7 - 5