8dae91c2ca
Protect pending edits on window close, keep save-as paths and drafts consistent, copy relative image resources, reject oversized table imports without truncation, and preserve independent preview scrolling during refresh. Archive rendered MHTML resources with portable references and embedded local fonts. Preserve existing outputs on export cancellation or failure. Convert editor match positions and filter directory results in linear passes. Include the previously completed editor image/table/history improvements, undoable replacement, export snapshots, shared page settings, and cancellable PDF/Word export workflow. Update documentation and version to 0.3.1. Validation: 142 pytest cases passed; GUI smoke, improvements integration, and offline MHTML/scroll reliability smoke checks passed.
22 lines
888 B
Python
22 lines
888 B
Python
"""Keep one QApplication alive, matching the desktop application's lifecycle."""
|
|
import os
|
|
|
|
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
|
os.environ.setdefault("QTWEBENGINE_DISABLE_SANDBOX", "1")
|
|
os.environ.setdefault("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu --no-sandbox --log-level=3")
|
|
|
|
import pytest
|
|
from PySide6.QtWidgets import QApplication
|
|
from PySide6.QtGui import QFontDatabase
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def qt_application():
|
|
app = QApplication.instance() or QApplication([])
|
|
# Windows' offscreen plugin has no system font database. Register the same
|
|
# font used by PDF headers so the test exercises real glyph embedding.
|
|
if os.name == "nt" and not QFontDatabase.families():
|
|
QFontDatabase.addApplicationFont(os.path.join(os.environ.get("WINDIR", "C:/Windows"), "Fonts", "msyh.ttc"))
|
|
yield app
|
|
app.processEvents()
|