fix-ui-preserve-acrylic-after-browser-navigation
Core regression / Python core and release configuration (push) Successful in 17s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 15s
Core regression / JavaScript syntax (pull_request) Successful in 3s
Core regression / Python core and release configuration (push) Successful in 17s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 15s
Core regression / JavaScript syntax (pull_request) Successful in 3s
This commit is contained in:
1 parent
e9454cf01f
commit
ba1d50cdfc
4 files changed
+74
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# Issue #16: Acrylic after returning from the browser workspace
|
||||
|
||||
Scope: UI rendering only. Provider/model configuration, runtime protocol, tools and task operations are unchanged.
|
||||
|
||||
The browser workspace previously shared its native composition parent with the Acrylic main window. Showing a real QWebEngineView made the parent surface opaque; hiding the browser did not restore the live backdrop. The alpha-buffer size, transparency attribute and Acrylic property still reported enabled. Reapplying Windows composition alone did not fix the rendering.
|
||||
|
||||
The browser workspace now uses `WA_NativeWindow` so Chromium composes into its own child native surface. This keeps its opaque browser background separate from the task-center backdrop and retains the existing stacked-page navigation.
|
||||
|
||||
Validation on Windows 11 build 26200, 125% scaling:
|
||||
|
||||
- Regression test uses a real QWebEngineView and checks its native composition parent. It failed before the fix and passed afterward.
|
||||
- `python -m pytest -q tests/ui --tb=short --junitxml=build/issue16-ui-tests.xml`: **172 passed**.
|
||||
- `python tools/accept_acrylic_ui.py --output build/issue16-final --webengine-roundtrip`: passed. The test uses sample projects and an owned changing backdrop. It displays a local HTML page in real Chromium, without launching the Harness server, model requests or CAD.
|
||||
- Before the fix, changing the background after returning produced a sidebar pixel difference of **0.0**. After the fix, two consecutive round trips each produced **20.79** (threshold > 2); the solid table difference stayed **0.0** (threshold < 1.5).
|
||||
- With reduced transparency enabled, the same navigation produced a sidebar difference of **0.0** as expected. Search, empty results, solid fallback, 980×700 layout and visible stop controls also passed.
|
||||
- An initial focused run reported one existing Qt fixture teardown race (`TrialTaskCenterWindow already deleted`); the subsequent complete UI run passed without errors.
|
||||
|
||||
Screenshots and machine-readable results are local artifacts under `build/issue16-final/`. No release package was built. PR #15 is synchronized with main `3cec9ad`; unrelated main-workspace changes were left untouched.
|
||||
@@ -5,7 +5,7 @@ import json
|
||||
import codecs
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import QProcess, QProcessEnvironment, QTimer, QUrl, Signal
|
||||
from PySide6.QtCore import QProcess, QProcessEnvironment, QTimer, QUrl, Signal, Qt
|
||||
from PySide6.QtWebEngineCore import QWebEnginePage, QWebEngineProfile, QWebEngineSettings
|
||||
from PySide6.QtWebEngineWidgets import QWebEngineView
|
||||
from PySide6.QtWidgets import QLabel, QPushButton, QVBoxLayout, QWidget
|
||||
@@ -37,6 +37,10 @@ class NativeHarnessView(QWidget):
|
||||
|
||||
def __init__(self, data_root: Path, parent=None):
|
||||
super().__init__(parent)
|
||||
# Give Chromium its own native composition boundary. Otherwise its
|
||||
# texture compositor turns the shared Acrylic top-level surface opaque,
|
||||
# even after this workspace is hidden again.
|
||||
self.setAttribute(Qt.WidgetAttribute.WA_NativeWindow)
|
||||
self.setObjectName('dshNativeWorkspace')
|
||||
self.setStyleSheet('QWidget#dshNativeWorkspace {background:white;}')
|
||||
self.data_root = Path(data_root)
|
||||
|
||||
@@ -93,6 +93,19 @@ def test_repeated_refresh_does_not_reconfigure_composition(qtbot):
|
||||
assert len(backend.calls)==1
|
||||
|
||||
|
||||
def test_webengine_has_its_own_native_composition_parent(qtbot, tmp_path):
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QVBoxLayout
|
||||
from dx_productivity.trial_task_center.ui.dsh_native import NativeHarnessView
|
||||
window=QWidget();qtbot.addWidget(window)
|
||||
window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||
view=NativeHarnessView(tmp_path,window)
|
||||
QVBoxLayout(window).addWidget(view)
|
||||
window.show()
|
||||
# The browser must compose into its child HWND, not the Acrylic HWND.
|
||||
assert view.web.nativeParentWidget() is view
|
||||
|
||||
|
||||
def test_deferred_material_refresh_never_uses_a_destroyed_window(qtbot,qapp):
|
||||
from PySide6.QtCore import QCoreApplication,QEvent
|
||||
window=QWidget() # This test owns destruction rather than pytest-qt teardown.
|
||||
|
||||
@@ -16,8 +16,8 @@ import time
|
||||
|
||||
os.environ.pop('QT_QPA_PLATFORM',None)
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src'))
|
||||
from PySide6.QtCore import Qt,QRectF
|
||||
from PySide6.QtGui import QColor,QFont,QPainter,QLinearGradient,QPen
|
||||
from PySide6.QtCore import Qt,QRectF,QPoint
|
||||
from PySide6.QtGui import QColor,QFont,QPainter,QLinearGradient,QPen,QCursor
|
||||
from PySide6.QtWidgets import QApplication,QWidget,QToolTip
|
||||
from PIL import ImageGrab,ImageChops,ImageStat
|
||||
from dx_productivity.trial_task_center.store import TaskStore
|
||||
@@ -29,6 +29,7 @@ from dx_productivity.trial_task_center.target_plan import ComponentTarget,Target
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output',type=Path,default=Path('build/acrylic-acceptance'))
|
||||
parser.add_argument('--webengine-roundtrip',action='store_true')
|
||||
args=parser.parse_args();out=args.output.resolve();out.mkdir(parents=True,exist_ok=True)
|
||||
app=QApplication([]);app.setFont(QFont('Microsoft YaHei UI',9))
|
||||
def settle(seconds=.2):
|
||||
@@ -80,6 +81,7 @@ def main():
|
||||
assert window.property('acrylicEnabled'),'Native Acrylic not available under current system policy'
|
||||
report['native_enabled']=True
|
||||
def capture(name):
|
||||
QCursor.setPos(window.mapToGlobal(QPoint(12,12)))
|
||||
settle(.7)
|
||||
QToolTip.hideText();settle(.12)
|
||||
geo=window.geometry();scale=screen.devicePixelRatio()
|
||||
@@ -121,6 +123,31 @@ def main():
|
||||
assert report['right_header_backdrop_difference']>2,report
|
||||
assert report['right_execution_backdrop_difference']>2,report
|
||||
assert report['opaque_table_backdrop_difference']<1.5,report
|
||||
if args.webengine_roundtrip:
|
||||
from dx_productivity.trial_task_center.ui.dsh_native import NativeHarnessView
|
||||
report['before_webengine_surface']={'alpha':window.windowHandle().format().alphaBufferSize(),
|
||||
'translucent':window.testAttribute(Qt.WidgetAttribute.WA_TranslucentBackground),
|
||||
'acrylic':window.property('acrylicEnabled'),'contrast':window.property('highContrastFallback')}
|
||||
def create_view():
|
||||
view=NativeHarnessView(root/'dsh',window)
|
||||
view.start=lambda:None # Real Chromium surface; no server, model or CAD.
|
||||
view.web.setHtml('<html><body>Owned DSH WebEngine surface</body></html>')
|
||||
return view
|
||||
window._create_dsh_view=create_view
|
||||
for index in range(2):
|
||||
window.dsh_action.trigger();settle(2)
|
||||
window.task_center_action.trigger();settle(1)
|
||||
report['after_webengine_surface']={'alpha':window.windowHandle().format().alphaBufferSize(),
|
||||
'translucent':window.testAttribute(Qt.WidgetAttribute.WA_TranslucentBackground),
|
||||
'acrylic':window.property('acrylicEnabled'),'contrast':window.property('highContrastFallback')}
|
||||
background.phase=0;background.update();capture(f'roundtrip-{index}-a')
|
||||
background.phase=1;background.update();capture(f'roundtrip-{index}-b')
|
||||
delta=ImageChops.difference(captures[f'roundtrip-{index}-a'],captures[f'roundtrip-{index}-b'])
|
||||
report[f'roundtrip_{index}_sidebar_difference']=mean(delta.crop(sidebar))
|
||||
report[f'roundtrip_{index}_table_difference']=mean(delta.crop(table))
|
||||
(out/'roundtrip-probe.json').write_text(json.dumps(report,indent=2),encoding='utf8')
|
||||
assert report[f'roundtrip_{index}_sidebar_difference']>2,report
|
||||
assert report[f'roundtrip_{index}_table_difference']<1.5,report
|
||||
window.plan_panel.find_text.setText('RV');window.plan_panel.find()
|
||||
report['visible_search_feedback']=window.plan_panel.find_result.isVisible()
|
||||
assert '2 / 6'in window.plan_panel.find_result.text()
|
||||
@@ -136,6 +163,15 @@ def main():
|
||||
report['solid_sidebar_mean']=ImageStat.Stat(solid.crop(sidebar)).mean
|
||||
assert min(report['solid_sidebar_mean'])>200,report
|
||||
report['solid_fallback']=True
|
||||
if args.webengine_roundtrip:
|
||||
window.dsh_action.trigger();settle(.3)
|
||||
window.task_center_action.trigger();settle(.3)
|
||||
assert not window.property('acrylicEnabled')
|
||||
background.phase=0;background.update();capture('roundtrip-solid-a')
|
||||
background.phase=1;background.update();capture('roundtrip-solid-b')
|
||||
delta=ImageChops.difference(captures['roundtrip-solid-a'],captures['roundtrip-solid-b'])
|
||||
report['roundtrip_reduced_sidebar_difference']=mean(delta.crop(sidebar))
|
||||
assert report['roundtrip_reduced_sidebar_difference']<1.5,report
|
||||
window.reduced_transparency_button.setChecked(False);settle(.3)
|
||||
window.resize(980,700);capture('native-app-compact')
|
||||
report['compact_size']=[window.width(),window.height()]
|
||||
|
||||
Reference in new issue
Block a user