fix(dsh): preserve acrylic and restore durable native model settings
Core regression / Python core and release configuration (push) Successful in 15s
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 11:41:50 +08:00
1 parent 3cec9adc5f
commit 374e1cd5bf
11 files changed
+262 -17

No files matched your search

+43 -1
View File
@@ -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('--dsh-switch',action='store_true',help='Measure live Acrylic after entering the actual DSH WebEngine page')
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,9 @@ def main():
assert window.property('acrylicEnabled'),'Native Acrylic not available under current system policy'
report['native_enabled']=True
def capture(name):
report.setdefault('surfaces',{})[name]={
'hwnd':int(window.winId()),'translucent':window.testAttribute(Qt.WidgetAttribute.WA_TranslucentBackground),
'alpha':window.windowHandle().format().alphaBufferSize(),'acrylic':window.property('acrylicEnabled')}
settle(.7)
QToolTip.hideText();settle(.12)
geo=window.geometry();scale=screen.devicePixelRatio()
@@ -121,6 +125,40 @@ 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.dsh_switch:
from PySide6.QtTest import QTest
QTest.mouseClick(window.dsh_navigation,Qt.MouseButton.LeftButton)
deadline=time.monotonic()+120
while time.monotonic()<deadline:
settle(.1)
if window._dsh_view is not None and window._dsh_view._started:break
assert window._dsh_view is not None and window._dsh_view._started,'DSH did not start'
# READY precedes the Chromium load; require the real visible page.
loaded=[]
window._dsh_view.web.page().runJavaScript("document.body?.innerText?.includes('DSH助手')",loaded.append)
deadline=time.monotonic()+60
while time.monotonic()<deadline:
settle(.1)
if loaded and loaded[-1]:break
if loaded:
loaded.clear()
window._dsh_view.web.page().runJavaScript("document.body?.innerText?.includes('DSH助手')",loaded.append)
assert loaded and loaded[-1],'Official DSH UI did not load'
capture('dsh-before-return')
QTest.mouseClick(window.task_center_navigation,Qt.MouseButton.LeftButton)
settle(.5)
background.phase=0;background.update();capture('returned-backdrop-a')
background.phase=1;background.update();capture('returned-backdrop-b')
returned=ImageChops.difference(captures['returned-backdrop-a'],captures['returned-backdrop-b'])
assert report['surfaces']['native-app-backdrop-a']['hwnd']==report['surfaces']['returned-backdrop-a']['hwnd'],report
report['after_dsh_sidebar_difference']=mean(returned.crop(sidebar))
report['after_dsh_header_difference']=mean(returned.crop(header))
report['after_dsh_table_difference']=mean(returned.crop(table))
(out/'surface-probe.json').write_text(json.dumps(report,indent=2),encoding='utf8')
assert report['after_dsh_sidebar_difference']>2,report
assert report['after_dsh_header_difference']>2,report
assert report['after_dsh_table_difference']<1.5,report
report['real_dsh_switch_restored_acrylic']=True
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()
@@ -158,7 +196,11 @@ def main():
window._finish_run();window._update_gates()
window.project_options_button.setChecked(True);settle(.2)
report['options_exposed']=window.run_panel.copy_value_check.isVisible()
window.plan_panel.discard_all();window.close();settle(.3);store.close();logging.shutdown()
window.plan_panel.discard_all();window.close()
deadline=time.monotonic()+15
while window.isVisible() and time.monotonic()<deadline:settle(.1)
assert not window.isVisible(),'Window did not finish shutdown'
settle(.3);store.close();logging.shutdown()
background.close();app.processEvents()
(out/'acceptance.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
print(json.dumps(report,ensure_ascii=True))