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

This commit is contained in:
阿白叔 committed 2026-11-03 10:53:40 +08:00
1 parent e9454cf01f
commit ba1d50cdfc
4 files changed
+74 -3

No files matched your search

+38 -2
View File
@@ -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()]