feat: support item value policies and migrated multi-file BOM import
Core regression / Python core and release configuration (push) Successful in 17s
Core regression / JavaScript syntax (push) Successful in 2s
Core regression / Python core and release configuration (pull_request) Successful in 14s
Core regression / JavaScript syntax (pull_request) Successful in 3s

This commit is contained in:
阿白叔 committed 2026-11-05 11:26:35 +08:00
1 parent 9316cf4fc4
commit 8b5509d64f
29 files changed
+1418 -63

No files matched your search

+51
View File
@@ -21,6 +21,57 @@ def test_mapping_dialog_exposes_custom_value_nc_and_optional_cell(qtbot):
assert dialog.target_cell=='' and '可选' in dialog.cell_combo.itemText(0)
def test_target_table_exposes_item_value_mode_selector(qtbot):
from pathlib import Path
from dx_productivity.trial_task_center.target_plan import ComponentTarget, TargetPlanRow
from dx_productivity.trial_task_center.ui.target_table import TargetTable
table = TargetTable()
qtbot.addWidget(table)
row = TargetPlanRow(ComponentTarget(Path('C:/board.prj'), 'MAIN', '1', 'u1', 'R1', 'OLD', '10nF'),
True, 'NEW')
table.populate((row,))
assert table.model().index(0, 10).data() == 'inherit'
assert table.model().setData(table.model().index(0, 10), 'part_label')
assert table.rows()[0].value_mode == 'part_label'
assert not table.rows()[0].custom_value_enabled
assert table.model().setData(table.model().index(0, 10), 'custom')
assert table.rows()[0].value_mode == 'custom' and table.rows()[0].custom_value_enabled
from PySide6.QtCore import Qt
assert table.model().setData(table.model().index(0, 7), Qt.CheckState.Unchecked,
Qt.ItemDataRole.CheckStateRole)
assert table.rows()[0].value_mode == 'inherit' and not table.rows()[0].custom_value_enabled
assert table.plan_model.headerData(10, Qt.Orientation.Horizontal, Qt.ItemDataRole.ToolTipRole)
def test_target_value_editor_commits_selection_and_escape_cancels(qtbot):
from pathlib import Path
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QComboBox
from dx_productivity.trial_task_center.target_plan import ComponentTarget, TargetPlanRow
from dx_productivity.trial_task_center.ui.target_table import TargetTable
table = TargetTable()
qtbot.addWidget(table)
table.resize(1400, 200)
table.populate((TargetPlanRow(ComponentTarget(Path('C:/board.prj'), 'MAIN', '1', 'u1',
'R1', 'OLD', '10nF'), True, 'NEW'),))
table.show()
index = table.model().index(0, 10)
table.edit(index)
editor = table.findChild(QComboBox)
assert editor.currentText() == 'inherit'
editor.setCurrentText('part_number')
qtbot.keyClick(editor, Qt.Key.Key_Tab)
assert table.rows()[0].value_mode == 'part_number'
table.edit(index)
editor = next(e for e in table.findChildren(QComboBox) if e.isVisible())
editor.setCurrentText('custom')
qtbot.keyClick(editor, Qt.Key.Key_Escape)
assert table.rows()[0].value_mode == 'part_number'
def test_small_window_keeps_splitters_and_opens_log_in_disposable_window(ui,qtbot):
w=ui.window;w.resize(980,700);qtbot.wait(30)
assert w.width()==980 and w.height()==700