From b86e4e315a2ac7d8a3d05587389d0237b6576881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD=E5=8F=94?= <11794527+absfan@user.noreply.gitee.com> Date: Wed, 11 Nov 2026 16:22:14 +0800 Subject: [PATCH] test: simulate all UI buttons and handle log folder errors --- ...26-11-11-button-simulation-validation.json | 1065 +++++++++++++++++ docs/releases/2026-11-11-button-simulation.md | 76 ++ src/cbb_refresh_verify/ui/main_window.py | 6 +- tests/button_simulation.py | 77 ++ tests/test_all_buttons.py | 573 +++++++++ 5 files changed, 1796 insertions(+), 1 deletion(-) create mode 100644 docs/releases/2026-11-11-button-simulation-validation.json create mode 100644 docs/releases/2026-11-11-button-simulation.md create mode 100644 tests/button_simulation.py create mode 100644 tests/test_all_buttons.py diff --git a/docs/releases/2026-11-11-button-simulation-validation.json b/docs/releases/2026-11-11-button-simulation-validation.json new file mode 100644 index 0000000..47303e7 --- /dev/null +++ b/docs/releases/2026-11-11-button-simulation-validation.json @@ -0,0 +1,1065 @@ +{ + "date": "2026-11-11", + "baseline": "42e87190263453c8e3a7001d5768741b3b3a2c38", + "scope": "All owned UI buttons, checkbox options, result actions, navigation tabs, and dialog confirmation choices", + "full_suite": { + "tests": 1835, + "errors": 0, + "failures": 0, + "skipped": 0, + "seconds": 343.789 + }, + "windows_ui_suite": { + "tests": 276, + "errors": 0, + "failures": 0, + "skipped": 0, + "seconds": 69.125 + }, + "buttons": [ + { + "id": "BackupRecoveryDialog.browse_button", + "label": "选择…", + "file": "src\\cbb_refresh_verify\\ui\\backup_recovery_dialog.py", + "line": 38, + "status": "PASS", + "expected": "真实备份工程选择框打开/取消", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[False]", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[True]" + ] + }, + { + "id": "BackupRecoveryDialog.restore_button", + "label": "恢复并校验", + "file": "src\\cbb_refresh_verify\\ui\\backup_recovery_dialog.py", + "line": 40, + "status": "PASS", + "expected": "无效来源拒绝;确认/拒绝;显示受控恢复结果", + "clicked_signals": 10, + "tests": [ + "tests/test_all_buttons.py::test_recovery_cancel_queue_never_calls_native_restore", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[False]", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[True]", + "tests/test_backup_recovery_dialog.py::test_backup_dialog_keeps_ui_responsive_and_cannot_close_during_restore", + "tests/test_backup_recovery_dialog.py::test_backup_dialog_requires_a_project_and_passes_selected_target", + "tests/test_backup_recovery_dialog.py::test_unhandled_worker_error_notifies_main_window_of_unsafe_result", + "tests/test_manual_backup_ui.py::test_restore_prompts_for_manual_backup_before_starting_worker", + "tests/test_ui_filters.py::test_open_backup_dialog_cannot_restore_target_that_became_ready" + ] + }, + { + "id": "BackupRecoveryDialog.close_button", + "label": "关闭", + "file": "src\\cbb_refresh_verify\\ui\\backup_recovery_dialog.py", + "line": 42, + "status": "PASS", + "expected": "空闲关闭恢复窗口", + "clicked_signals": 4, + "tests": [ + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_all_buttons.py::test_recovery_cancel_queue_never_calls_native_restore", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[False]", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[True]" + ] + }, + { + "id": "BackupRecoveryDialog.cancel_queue_button", + "label": "取消排队", + "file": "src\\cbb_refresh_verify\\ui\\backup_recovery_dialog.py", + "line": 44, + "status": "PASS", + "expected": "取消等待票据,不调用恢复后端", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_recovery_cancel_queue_never_calls_native_restore" + ] + }, + { + "id": "MainWindow.native_lm_verify_check", + "label": "使用 Library Manager 原生 Verify(Win10 兼容测试)", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 164, + "status": "PASS", + "expected": "勾选状态切换,原生 Verify 选项保持独立", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles" + ] + }, + { + "id": "MainWindow.advanced_toggle", + "label": "高级设置", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 168, + "status": "PASS", + "expected": "展开和收起高级设置", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles", + "tests/test_ui.py::test_ui_removes_current_cbb_controls_and_hides_advanced_settings" + ] + }, + { + "id": "MainWindow.select_visible_button", + "label": "选择可见项", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 195, + "status": "PASS", + "expected": "只勾选可见条目", + "clicked_signals": 29, + "tests": [ + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-selected_batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-selected_batch_button]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[add]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[remove]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[update]", + "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles", + "tests/test_all_buttons.py::test_native_backup_entry_starts_once_and_reenables_after_receipt", + "tests/test_maintenance_ui.py::test_old_checkpoint_does_not_force_maintenance_or_disable_verify[foreign]", + "tests/test_maintenance_ui.py::test_old_checkpoint_does_not_force_maintenance_or_disable_verify[malformed]", + "tests/test_maintenance_ui.py::test_old_checkpoint_does_not_force_maintenance_or_disable_verify[valid]", + "tests/test_management_ui.py::test_management_can_select_ready_and_capability_disabled_explanation", + "tests/test_management_ui.py::test_previous_unsafe_result_allows_retry_and_requires_matching_release_proof", + "tests/test_manual_backup_ui.py::test_batch_prompts_once_for_manual_backup_and_cancel_does_not_start[verify_all]", + "tests/test_manual_backup_ui.py::test_batch_prompts_once_for_manual_backup_and_cancel_does_not_start[verify_selected]", + "tests/test_native_backup.py::test_native_backup_can_use_current_non_ready_row_without_checkbox", + "tests/test_native_backup.py::test_native_backup_ui_keeps_catalog_interactive_and_refreshes_after_close", + "tests/test_native_backup.py::test_native_launch_failure_does_not_poison_other_features", + "tests/test_navigation_tabs.py::test_three_horizontal_sections_keep_one_catalog_and_only_their_actions", + "tests/test_reimport_recovery.py::test_failed_repair_offers_copy_import_bound_to_failed_target", + "tests/test_ui_filters.py::test_large_catalog_local_filter_and_selection_remain_responsive[3000]", + "tests/test_ui_filters.py::test_large_catalog_local_filter_and_selection_remain_responsive[381]", + "tests/test_ui_filters.py::test_management_selection_includes_ready_and_missing_but_hiding_clears_checks", + "tests/test_ui_filters.py::test_verify_all_and_selected_only_target_visible_non_ready_with_projects" + ] + }, + { + "id": "MainWindow.clear_selection_button", + "label": "清空选择", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 196, + "status": "PASS", + "expected": "清空勾选", + "clicked_signals": 5, + "tests": [ + "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles", + "tests/test_ui_filters.py::test_large_catalog_local_filter_and_selection_remain_responsive[3000]", + "tests/test_ui_filters.py::test_large_catalog_local_filter_and_selection_remain_responsive[381]", + "tests/test_ui_filters.py::test_maintenance_defaults_to_visible_eligible_and_ready_only_checks_do_not_fallback", + "tests/test_ui_filters.py::test_management_selection_includes_ready_and_missing_but_hiding_clears_checks" + ] + }, + { + "id": "MainWindow.load_button", + "label": "读取 CBB", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 202, + "status": "PASS", + "expected": "读取当前库并更新清单", + "clicked_signals": 44, + "tests": [ + "tests/test_all_buttons.py::test_invalidated_catalog_buttons_ignore_clicks", + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[logs_button-directory]", + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[logs_button-shell]", + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[recovery_button-shell]", + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-selected_batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-selected_batch_button]", + "tests/test_all_buttons.py::test_main_library_chooser_real_open_and_cancel[False]", + "tests/test_all_buttons.py::test_main_library_chooser_real_open_and_cancel[True]", + "tests/test_all_buttons.py::test_main_logs_and_evidence_buttons_open_the_correct_paths", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[add]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[remove]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[update]", + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[False]", + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[True]", + "tests/test_all_buttons.py::test_management_confirm_cancel_execute_stop_and_repeated_click", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-update]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-update]", + "tests/test_all_buttons.py::test_native_backup_entry_starts_once_and_reenables_after_receipt", + "tests/test_all_buttons.py::test_recovery_cancel_queue_never_calls_native_restore", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[False]", + "tests/test_all_buttons.py::test_recovery_real_source_chooser_and_confirmation_options[True]", + "tests/test_all_buttons.py::test_residual_busy_repeated_clicks_and_stop_release", + "tests/test_all_buttons.py::test_residual_force_buttons_require_actual_confirmation[16384]", + "tests/test_all_buttons.py::test_residual_force_buttons_require_actual_confirmation[4194304]", + "tests/test_all_buttons.py::test_residual_native_cancel_confirm_and_decline[16384]", + "tests/test_all_buttons.py::test_residual_native_cancel_confirm_and_decline[65536]", + "tests/test_all_buttons.py::test_residual_refresh_details_confirm_and_close", + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[16384-6]", + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[4194304-2]", + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[65536-7]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[batch_close]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[batch_copy]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_copy]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_release]", + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items" + ] + }, + { + "id": "MainWindow.browse_button", + "label": "选择", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 203, + "status": "PASS", + "expected": "真实选择框打开/取消;取消不触发读取", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_main_library_chooser_real_open_and_cancel[False]", + "tests/test_all_buttons.py::test_main_library_chooser_real_open_and_cancel[True]" + ] + }, + { + "id": "MainWindow.selected_batch_button", + "label": "批量校验已选", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 204, + "status": "PASS", + "expected": "真实确认/拒绝;仅执行可见非 READY 已选项", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-selected_batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-selected_batch_button]", + "tests/test_ui.py::test_loaded_library_shows_selectable_rows_and_selected_batch_action" + ] + }, + { + "id": "MainWindow.batch_button", + "label": "校验可见非 READY", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 205, + "status": "PASS", + "expected": "真实确认/拒绝;只执行可见非 READY 项", + "clicked_signals": 4, + "tests": [ + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-batch_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-batch_button]", + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[False]", + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items" + ] + }, + { + "id": "MainWindow.icdb_repair_button", + "label": "ICDB 批量检查", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 206, + "status": "PASS", + "expected": "开始独立 ICDB 检查,不启用自动 Repair", + "clicked_signals": 9, + "tests": [ + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[16384-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_check_buttons_have_real_confirm_and_cancel_paths[65536-icdb_repair_button]", + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[True]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_copy]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_release]", + "tests/test_ui.py::test_global_icdb_action_confirms_and_excludes_ready_rows", + "tests/test_ui.py::test_global_icdb_failure_preserves_untargeted_ready_and_stops_queue", + "tests/test_ui.py::test_global_icdb_progress_and_check_summary" + ] + }, + { + "id": "MainWindow.backup_restore_button", + "label": "从备份恢复 CBB…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 208, + "status": "PASS", + "expected": "为当前非 READY 目标打开备份恢复窗口", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_backup_recovery_dialog.py::test_main_window_opens_non_ready_dialog_and_failure_retains_ready_untargeted" + ] + }, + { + "id": "MainWindow.reimport_button", + "label": "选择工程副本恢复失败项…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 210, + "status": "PASS", + "expected": "副本恢复仍绑定失败 CBB", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_copy]", + "tests/test_reimport_recovery.py::test_declining_reimport_confirmation_does_not_check_release_or_write", + "tests/test_reimport_recovery.py::test_main_stop_during_recovery_release_cancels_import" + ] + }, + { + "id": "MainWindow.stop_button", + "label": "当前项完成后停止", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 213, + "status": "PASS", + "expected": "设置停止标志,后续目标不再执行", + "clicked_signals": 5, + "tests": [ + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[False]", + "tests/test_background_queue_regressions.py::test_stop_whole_queue_does_not_resume_background_checks", + "tests/test_reimport_recovery.py::test_main_stop_during_recovery_release_cancels_import", + "tests/test_review381_queue_release.py::test_repeat_verify_then_stop_then_delayed_release_click_never_starts_work", + "tests/test_ui.py::test_batch_does_not_block_ui_and_stop_skips_next_item" + ] + }, + { + "id": "MainWindow.logs_button", + "label": "打开日志目录", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 214, + "status": "PASS", + "expected": "打开正确目录;目录及系统打开失败时显示错误", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[logs_button-directory]", + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[logs_button-shell]", + "tests/test_all_buttons.py::test_main_logs_and_evidence_buttons_open_the_correct_paths" + ] + }, + { + "id": "MainWindow.recovery_button", + "label": "打开异常证据", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 215, + "status": "PASS", + "expected": "打开正确证据路径;系统打开失败时显示错误", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_log_and_evidence_buttons_report_external_failure[recovery_button-shell]", + "tests/test_all_buttons.py::test_main_logs_and_evidence_buttons_open_the_correct_paths" + ] + }, + { + "id": "MainWindow.native_backup_button", + "label": "版本历史与备份…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 274, + "status": "PASS", + "expected": "只启动一次;收到关闭回执后恢复可用", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_native_backup_entry_starts_once_and_reenables_after_receipt", + "tests/test_native_backup.py::test_native_backup_ui_keeps_catalog_interactive_and_refreshes_after_close", + "tests/test_native_backup.py::test_native_launch_failure_does_not_poison_other_features" + ] + }, + { + "id": "MainWindow.icdb_stop_button", + "label": "停止检查", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 280, + "status": "PASS", + "expected": "停止当前后台检查,不再打开后续项", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_main_stop_buttons_stop_additional_items[True]" + ] + }, + { + "id": "MainWindow.add_button", + "label": "新增 CBB…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 298, + "status": "PASS", + "expected": "打开新增操作窗口", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[add]" + ] + }, + { + "id": "MainWindow.update_button", + "label": "用工程替换已选 CBB…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 299, + "status": "PASS", + "expected": "打开所选目标的更新窗口", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[update]" + ] + }, + { + "id": "MainWindow.remove_button", + "label": "移除已选…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 300, + "status": "PASS", + "expected": "打开所选目标的移除窗口", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[remove]", + "tests/test_management_ui.py::test_management_can_select_ready_and_capability_disabled_explanation", + "tests/test_management_ui.py::test_previous_unsafe_result_allows_retry_and_requires_matching_release_proof" + ] + }, + { + "id": "MainWindow.release_library_button", + "label": "释放残留会话…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 311, + "status": "PASS", + "expected": "打开当前库的释放预览", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_management_ui.py::test_historical_record_does_not_prevent_catalog_load_and_offers_checked_release" + ] + }, + { + "id": "MainWindow.queue_release_button", + "label": "查看残留会话…", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 317, + "status": "PASS", + "expected": "打开等待库的释放预览,关闭面板不误解锁任务", + "clicked_signals": 8, + "tests": [ + "tests/test_review326_queue_guidance.py::test_queued_action_has_visible_release_entry_and_resumes_after_proof", + "tests/test_review381_queue_release.py::test_repeated_click_and_close_reuse_one_panel_without_unlocking_the_task" + ] + }, + { + "id": "MainWindow.runtime_log_toggle", + "label": "查看运行日志", + "file": "src\\cbb_refresh_verify\\ui\\main_window.py", + "line": 321, + "status": "PASS", + "expected": "显示/隐藏运行输出", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles" + ] + }, + { + "id": "ManagementDialog.sources_button", + "label": "选择来源工程…", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 69, + "status": "PASS", + "expected": "真实工程选择框打开/取消并更新来源行", + "clicked_signals": 4, + "tests": [ + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-update]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-update]" + ] + }, + { + "id": "ManagementDialog.auto_verify", + "label": "本批次上传后自动校验", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 72, + "status": "PASS", + "expected": "切换本批次自动校验选项", + "clicked_signals": 4, + "tests": [ + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-update]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-update]" + ] + }, + { + "id": "ManagementDialog.release_wait_button", + "label": "查看残留会话…", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 77, + "status": "PASS", + "expected": "传出等待释放的目标库", + "clicked_signals": 1, + "tests": [ + "tests/test_review326_queue_guidance.py::test_management_wait_shows_same_block_and_emits_release_target" + ] + }, + { + "id": "ManagementDialog.logs_button", + "label": "查看日志", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 83, + "status": "PASS", + "expected": "显示/隐藏管理日志", + "clicked_signals": 9, + "tests": [ + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-update]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-update]", + "tests/test_reimport_recovery.py::test_recovery_dialog_keeps_internal_details_in_optional_log" + ] + }, + { + "id": "ManagementDialog.execute_button", + "label": "预览并确认执行…", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 91, + "status": "PASS", + "expected": "真实确认/拒绝,重复点击不重复执行", + "clicked_signals": 11, + "tests": [ + "tests/test_all_buttons.py::test_management_confirm_cancel_execute_stop_and_repeated_click", + "tests/test_management_ui.py::test_management_dialog_preview_confirmation_and_result_status", + "tests/test_manual_backup_ui.py::test_management_prompts_for_manual_backup_and_cancel_starts_nothing[add]", + "tests/test_manual_backup_ui.py::test_management_prompts_for_manual_backup_and_cancel_starts_nothing[remove]", + "tests/test_manual_backup_ui.py::test_management_prompts_for_manual_backup_and_cancel_starts_nothing[update]", + "tests/test_reimport_recovery.py::test_declining_reimport_confirmation_does_not_check_release_or_write", + "tests/test_reimport_recovery.py::test_main_stop_during_recovery_release_cancels_import", + "tests/test_reimport_recovery.py::test_recovery_uses_background_release_then_existing_management", + "tests/test_review326_queue_guidance.py::test_management_wait_shows_same_block_and_emits_release_target" + ] + }, + { + "id": "ManagementDialog.stop_button", + "label": "当前项结束后停止", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 93, + "status": "PASS", + "expected": "设置管理任务停止标志", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_management_confirm_cancel_execute_stop_and_repeated_click" + ] + }, + { + "id": "ManagementDialog.close_button", + "label": "关闭", + "file": "src\\cbb_refresh_verify\\ui\\management_dialog.py", + "line": 95, + "status": "PASS", + "expected": "空闲关闭,执行中禁用点击不打断任务", + "clicked_signals": 11, + "tests": [ + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[add]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[remove]", + "tests/test_all_buttons.py::test_main_management_buttons_open_the_requested_operation[update]", + "tests/test_all_buttons.py::test_management_confirm_cancel_execute_stop_and_repeated_click", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[False-update]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-add]", + "tests/test_all_buttons.py::test_management_source_chooser_and_auto_verify_toggle[True-update]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[batch_copy]", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_copy]" + ] + }, + { + "id": "PcbRestoreDialog.manual_button", + "label": "最后手动保存", + "file": "src\\cbb_refresh_verify\\ui\\pcb_restore_dialog.py", + "line": 18, + "status": "PASS", + "expected": "只选择最后手动保存版本,关闭不覆盖已有选择", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_version_choice_buttons_choose_only_the_clicked_version[manual_button-last_user_saved]", + "tests/test_pcb_restore_prompt.py::test_version_dialog_shows_dates_and_explicit_choices" + ] + }, + { + "id": "PcbRestoreDialog.auto_button", + "label": "自动保存", + "file": "src\\cbb_refresh_verify\\ui\\pcb_restore_dialog.py", + "line": 19, + "status": "PASS", + "expected": "只选择自动保存版本,关闭不覆盖已有选择", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_version_choice_buttons_choose_only_the_clicked_version[auto_button-autosave]" + ] + }, + { + "id": "PcbRestoreDialog.cancel_button", + "label": "取消", + "file": "src\\cbb_refresh_verify\\ui\\pcb_restore_dialog.py", + "line": 22, + "status": "PASS", + "expected": "取消选择,不默认回退版本", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_version_choice_buttons_choose_only_the_clicked_version[cancel_button-cancel]" + ] + }, + { + "id": "ResidualReleaseDialog.refresh_button", + "label": "重新检查", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 44, + "status": "PASS", + "expected": "重新扫描预览,不执行释放", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_residual_refresh_details_confirm_and_close" + ] + }, + { + "id": "ResidualReleaseDialog.confirm_button", + "label": "确认释放", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 45, + "status": "PASS", + "expected": "传递当前确认范围,显示实际释放结果", + "clicked_signals": 9, + "tests": [ + "tests/test_all_buttons.py::test_residual_busy_repeated_clicks_and_stop_release", + "tests/test_all_buttons.py::test_residual_refresh_details_confirm_and_close", + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items", + "tests/test_management_ui.py::test_historical_record_does_not_prevent_catalog_load_and_offers_checked_release", + "tests/test_residual_release_dialog.py::test_confirm_releases_full_plan_and_only_emits_actual_library_proof", + "tests/test_residual_release_dialog.py::test_released_batch_can_resume_only_its_unexecuted_items", + "tests/test_review326_queue_guidance.py::test_release_mapping_cleanup_finishes_before_waiting_ticket_resumes", + "tests/test_review348_release_comparison.py::test_confirmed_scope_and_execution_divergence_are_visible", + "tests/test_review_release_followup.py::test_ui_reports_missing_evidence_but_propagates_valid_library_release" + ] + }, + { + "id": "ResidualReleaseDialog.prompt_button", + "label": "处理保存提示…", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 46, + "status": "PASS", + "expected": "真实是/否/取消,传递对应保存选择", + "clicked_signals": 3, + "tests": [ + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[16384-6]", + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[4194304-2]", + "tests/test_all_buttons.py::test_residual_save_prompt_buttons_preserve_the_users_choice[65536-7]" + ] + }, + { + "id": "ResidualReleaseDialog.details_button", + "label": "查看原生提示…", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 47, + "status": "PASS", + "expected": "显示原生提示全文和详细信息", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_residual_refresh_details_confirm_and_close", + "tests/test_review_release_followup.py::test_ui_native_cancel_is_explicit_and_details_are_readable" + ] + }, + { + "id": "ResidualReleaseDialog.cancel_native_button", + "label": "请求原生取消…", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 48, + "status": "PASS", + "expected": "真实确认/拒绝后发送受控取消请求", + "clicked_signals": 5, + "tests": [ + "tests/test_all_buttons.py::test_residual_native_cancel_confirm_and_decline[16384]", + "tests/test_all_buttons.py::test_residual_native_cancel_confirm_and_decline[65536]", + "tests/test_review_release_followup.py::test_native_cancel_completion_propagates_actual_release_to_parent", + "tests/test_review_release_followup.py::test_ui_native_cancel_is_explicit_and_details_are_readable" + ] + }, + { + "id": "ResidualReleaseDialog.force_button", + "label": "强制结束客户端…", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 49, + "status": "PASS", + "expected": "真实确认/取消后传递强制标志;未调用实际强杀", + "clicked_signals": 5, + "tests": [ + "tests/test_all_buttons.py::test_residual_force_buttons_require_actual_confirmation[16384]", + "tests/test_all_buttons.py::test_residual_force_buttons_require_actual_confirmation[4194304]", + "tests/test_residual_release_dialog.py::test_force_close_is_explicit_and_cancel_does_not_release", + "tests/test_residual_release_dialog.py::test_force_confirmation_excludes_shared_servers" + ] + }, + { + "id": "ResidualReleaseDialog.close_button", + "label": "关闭", + "file": "src\\cbb_refresh_verify\\ui\\residual_release_dialog.py", + "line": 52, + "status": "PASS", + "expected": "空闲关闭;执行中请求停止并等待当前项返回", + "clicked_signals": 6, + "tests": [ + "tests/test_all_buttons.py::test_main_backup_restore_and_release_entries", + "tests/test_all_buttons.py::test_residual_busy_repeated_clicks_and_stop_release", + "tests/test_all_buttons.py::test_residual_refresh_details_confirm_and_close", + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_release]", + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items" + ] + }, + { + "id": "Result.batch_release", + "label": "查看残留并释放…", + "status": "PASS", + "expected": "从批量失败结果打开当前库释放入口", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items", + "tests/test_residual_release_dialog.py::test_released_batch_can_resume_only_its_unexecuted_items" + ] + }, + { + "id": "Result.batch_resume", + "label": "继续未执行项", + "status": "PASS", + "expected": "释放确认后只执行此前未执行的目标", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_result_release_and_resume_buttons_run_only_unexecuted_items", + "tests/test_residual_release_dialog.py::test_released_batch_can_resume_only_its_unexecuted_items" + ] + }, + { + "id": "Result.batch_copy", + "label": "选择副本恢复…", + "status": "PASS", + "expected": "兼容维护结果中的副本恢复仍绑定失败工程", + "clicked_signals": 1, + "tests": [ + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[batch_copy]" + ] + }, + { + "id": "Result.icdb_release", + "label": "查看残留并释放…", + "status": "PASS", + "expected": "从 ICDB 结果打开对应库释放入口", + "clicked_signals": 2, + "tests": [ + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_release]", + "tests/test_background_icdb.py::test_completed_old_library_result_does_not_release_new_library" + ] + }, + { + "id": "Result.icdb_copy", + "label": "选择副本恢复…", + "status": "PASS", + "expected": "从 ICDB 结果打开对应失败工程的副本恢复", + "clicked_signals": 4, + "tests": [ + "tests/test_all_buttons.py::test_result_recovery_and_release_entries_stay_bound_to_failed_cbb[icdb_copy]", + "tests/test_reimport_recovery.py::test_changing_library_invalidates_old_reimport_offer", + "tests/test_reimport_recovery.py::test_failed_repair_offers_copy_import_bound_to_failed_target", + "tests/test_review345_ui_cli.py::test_repeated_icdb_results_preserve_latest_recovery_task" + ] + } + ], + "owned_buttons_total": 48, + "owned_buttons_missing": [], + "tabs": [ + { + "label": "检验", + "index": 0, + "status": "PASS", + "test": "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles" + }, + { + "label": "ICDB 维护", + "index": 1, + "status": "PASS", + "test": "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles" + }, + { + "label": "中心库管理", + "index": 2, + "status": "PASS", + "test": "tests/test_all_buttons.py::test_main_navigation_selection_and_toggles" + } + ], + "qt_dialog_choices": [ + "MessageBox[CBB 校验结果].Close", + "MessageBox[CBB 校验结果].Ok", + "MessageBox[CBB 校验结果].查看残留并释放…", + "MessageBox[CBB 校验结果].选择副本恢复…", + "MessageBox[ICDB 批量检查].No", + "MessageBox[ICDB 批量检查].Yes", + "MessageBox[ICDB 批量检查结果].Ok", + "MessageBox[ICDB 批量检查结果].查看残留并释放…", + "MessageBox[ICDB 批量检查结果].选择副本恢复…", + "MessageBox[关闭工程前保存].Cancel", + "MessageBox[关闭工程前保存].No", + "MessageBox[关闭工程前保存].Yes", + "MessageBox[强制结束客户端].Cancel", + "MessageBox[强制结束客户端].Yes", + "MessageBox[确认从备份恢复].No", + "MessageBox[确认从备份恢复].Yes", + "MessageBox[确认批量校验].No", + "MessageBox[确认批量校验].Yes", + "MessageBox[确认管理操作].No", + "MessageBox[确认管理操作].Yes", + "MessageBox[继续未执行项].继续未执行项", + "MessageBox[请求原生取消].No", + "MessageBox[请求原生取消].Yes", + "QFileDialog[为当前行选择同名更新来源].Cancel", + "QFileDialog[为当前行选择同名更新来源].Open", + "QFileDialog[选择中心库].Cancel", + "QFileDialog[选择中心库].Open", + "QFileDialog[选择健康备份工程].Cancel", + "QFileDialog[选择健康备份工程].Open", + "QFileDialog[选择完整来源工程].Cancel", + "QFileDialog[选择完整来源工程].Open" + ], + "clicked_signals": 281, + "platform": "windows", + "desktop": "CbbButtonAudit_d180db2ce9", + "screenshots": { + "MainWindow:CBB 刷新校验:0:True": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\e15d9bf9e25c.png", + "sha256": "15654fc631c830cba76c33ef48d0bffb2f3444dd9af0a4b4df41b37234e99919" + }, + "MainWindow:CBB 刷新校验:0:False": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\552c6dc7f2e6.png", + "sha256": "46280c295bb9cba61ce950f8341bc673a5560e290a31b5e9c4b3b07f1458037e" + }, + "QFileDialog:选择中心库": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\05ad8e80af64.png", + "sha256": "5db245c79ef7511e88b1b534eabac07b9a7f95961bd1b6509a8df1748d0895c9" + }, + "QMessageBox:确认批量校验": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\0b4c1fe14e78.png", + "sha256": "982cbddfdce333aadab6e877f735298430f751b097eb3de0ae1fe0fc61c656e7" + }, + "MainWindow:CBB 刷新校验:1:True": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\a11b25788424.png", + "sha256": "347a13eb856e7ed5a3036e547792c818eb5a75649cf16c1c602a0c044d4837ee" + }, + "QMessageBox:ICDB 批量检查": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\9145572e1f83.png", + "sha256": "52fc19e7d551bd970e58923c51d0a3c4a8369c7a5dc9053410ba04a830102308" + }, + "QMessageBox:CBB 校验结果": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\ac1af820023b.png", + "sha256": "c601cae42c96dbca591a598f0a8cce7ea87d1b1e39e6ae86ff153790d159a4c2" + }, + "QMessageBox:ICDB 批量检查结果": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\50564da6946b.png", + "sha256": "4d29b9053cd238868e9e11b2f0f2a138ce1113d314a22c161dfc6bc2435801c9" + }, + "MainWindow:CBB 刷新校验:2:True": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\9c6c333d40ea.png", + "sha256": "d47e518c6956cbd9ca7c855a9de1bc0e3034afc93a2a949618cc73be38db4a65" + }, + "ManagementDialog:新增 CBB": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\bb9440d9c0bc.png", + "sha256": "15bd7d7fc3f4b396d9f7c1c59db0e3f9c605b691f7fae4e62800da73bea62c4c" + }, + "ManagementDialog:同名更新 CBB": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\5af2360c7e48.png", + "sha256": "78a6130d919daf88d850feda0d47feccc452360d3b6538de51ad0a1837198e83" + }, + "ManagementDialog:移除 CBB": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\3e7c94aefd21.png", + "sha256": "5dab8a6b55c8c2617573222a3898eb4d45dae9619ec31ae5d03eb5f0b63ed517" + }, + "BackupRecoveryDialog:从备份恢复 CBB": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\9091a738cdcb.png", + "sha256": "f490361d2c1e2da2f3f3a2ad5c454c01278e8ff1b6fc2f7e6645726de91d2a97" + }, + "ResidualReleaseDialog:释放残留会话": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\ee9979ee3a59.png", + "sha256": "7f6dd333775f76def252a7fc5d505886a1d4f30b2ff648459002a965e45812fa" + }, + "QFileDialog:选择完整来源工程": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\583e8e273a93.png", + "sha256": "92f3a2f635716f55169abba799add8845262b56341a0feccd1bd01adb479b416" + }, + "QFileDialog:为当前行选择同名更新来源": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\4b1a69dd7c19.png", + "sha256": "92f3a2f635716f55169abba799add8845262b56341a0feccd1bd01adb479b416" + }, + "QMessageBox:确认管理操作": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\9a7734c2766b.png", + "sha256": "350c591530bb930a9f6a1a17cbf2a6913c78378be4d491643afc889641de26cc" + }, + "QFileDialog:选择健康备份工程": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\3e85f6c566c9.png", + "sha256": "7616d7a8efeb8ad64e0c692e0276204cb0344e4b14b811da3ad09891a811eee8" + }, + "QMessageBox:确认从备份恢复": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\2060590bcdb9.png", + "sha256": "23be2c006640b15c7d8886f5daa2d33d545b4e6a7f7b9a5e00b19684c767a25c" + }, + "PcbRestoreDialog:选择 PCB 恢复版本": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\74eb878511a5.png", + "sha256": "f6ae7638b55c7b4776ce64c6e26d7375523aff5381d4a44c8f42531e3cd4932d" + }, + "QMessageBox:原生会话状态": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\1a47806f6221.png", + "sha256": "70dd72e5e1278f084b7637f6f46c2cf7afa9db5ae2db0b6f8d809e984e1043c7" + }, + "QMessageBox:关闭工程前保存": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\08a9b1cd8989.png", + "sha256": "2028038c14bf503da383920844399b527bde2bafeeeb35db6fe576b82f2a781c" + }, + "QMessageBox:请求原生取消": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\402fd4f81cf3.png", + "sha256": "02d50637bcf5aa10b44ed47633ee41df2513d822821e36cddc9076594f89db55" + }, + "QMessageBox:强制结束客户端": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\9c0d183bd0ea.png", + "sha256": "ef8b2d1a5d7f21a5dd70dafd8262cb89fc188acd81f25dd97cd2f0b93ce6f728" + }, + "QMessageBox:继续未执行项": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\766c174e8861.png", + "sha256": "45e774d16e30363c351b45172acceddefc4e2f53c4042764ab1581358453416b" + }, + "ManagementDialog:从副本恢复 CBB": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\3cc74faad025.png", + "sha256": "d8ffa6482f1b99ddc2d0e63edbc9d6264082034131a4f357bc5fdb5a5e13711f" + }, + "MainWindow:CBB 刷新校验:1:False": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\a321fca2a1b1.png", + "sha256": "dbe3d55a9898d35f6d1d1dcfd0e1b4dda1a541c90089890e50fea2d4a4ae8542" + }, + "MainWindow:CBB 刷新校验:2:False": { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\screenshots\\4e8dcb3bfa53.png", + "sha256": "abcb11a9070b5e052df215c9c924ce25e5329cce68d2a23c1f3d09c98913c9ca" + } + }, + "regression_before_fix": { + "tests": 3, + "errors": 2, + "failures": 2, + "skipped": 0, + "seconds": 1.561 + }, + "fixed_issue": "open_logs directory/shell errors escaped into the Qt event loop; now uses existing UI error reporting", + "test_harness_calibration": "Initial prototype had teardown, checkbox hit-position, and path-type assertion errors; corrected before final validation. Initial XML retained.", + "tested_files_sha256": { + "src/cbb_refresh_verify/ui/main_window.py": "30a70f28355cf4f353cf256da2871b8ba0ca42ea52d1e2661d79082ea5d8f8c4", + "tests/button_simulation.py": "3278868565853001103557d5f7ada42b11b05c03feb9032deed0327b6609de2b", + "tests/test_all_buttons.py": "897ae449a15fe36fb6198a947575609346d5ce1a22c0a8c4d2950b9f00035d4f" + }, + "compileall_passed": true, + "diff_check_passed": true, + "independent_review": "No concrete findings; no tests/native operations executed by reviewer", + "local_readonly_capabilities": { + "remove": { + "supported": true, + "reason": "已验证 CleanWGLib/F4;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。" + }, + "add": { + "supported": true, + "reason": "已验证 EE7.9.5 原生导入及完整工程复读;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。" + }, + "update": { + "supported": true, + "reason": "已验证同名原生替换:移除并重新导入;操作前请手动备份。" + } + }, + "candidate_rebuilt": true, + "candidate_executable": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\dist\\CbbRefreshVerify-Background\\CbbRefreshVerify.exe", + "bundle_verification": { + "module_count": 62, + "source_and_frozen_code_equal": true, + "source_sha256_checked": true, + "packaged_assets_equal": true, + "exe_icon_images_equal": true, + "executable_sha256": "90c10e9d0dc0e6fafea256bee309f1d05491690583029d3cd6a22577605347ee" + }, + "frozen_smoke": { + "gui": { + "status": "passed", + "exit_code": 0 + }, + "verify-worker": { + "exit_code": 1, + "status": "passed", + "evidence": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\smoke-31cf1d71\\verify-worker" + }, + "management-worker": { + "exit_code": 2, + "status": "passed", + "evidence": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\smoke-31cf1d71\\management-worker" + }, + "owner-probe": { + "exit_code": 0, + "status": "passed", + "evidence": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\smoke-31cf1d71\\owner-probe" + }, + "dialog-agent": { + "status": "passed", + "exit_code": 0, + "scope": "empty PID set, observe only" + }, + "module_origins": { + "status": "passed", + "module_count": 62, + "source_root": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795-review-stack\\src" + }, + "version": "0.2.4b2" + }, + "initial_build_failure": "C: full during COLLECT; not accepted. Only owned incomplete build moved to F:, rebuilt and verified.", + "native_mentor_writers_used": false, + "field_library_modified": false, + "icdb_repair_accepted": false, + "windows10_verified": false, + "cross_machine_shared_library_verified": false, + "merged": false, + "artifacts": [ + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\windows-all.json", + "sha256": "3e7d5871cb15d9e2da6cf27ca680f32855d8af29974975e5e2bf8e06f40ae53e" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\windows-all.xml", + "sha256": "f5891102adcd188674bc9c01d01f0f08ff31236de25ca4dc13fee60fc5efaaac" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\full.xml", + "sha256": "5b842660d121fd1717b3e6e2c358fff282a124f895291cdd52de5de0ddf72f96" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\log-red.xml", + "sha256": "a4bb48b89e28f776e43c8a9df1f85b15053cd6e8328b7e866a5e6d85e0936de3" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\button-matrix.json", + "sha256": "30d449c7477e44312058a436dc27684b94f3c4a8c4d59ad83599a52761471cf8" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\button-matrix.md", + "sha256": "ffd80bdadf949b61398276a30adf47bfdfdd64bb668019f8e3b13da6aaf11f3d" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\new-initial.xml", + "sha256": "0caf8ee571ef5f3a9194051c7c6170b50557ebca9326716ca7c6986263ce83a2" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\ui-evidence\\complete-red.xml", + "sha256": "d399b4ce605fa4c570d655b3ce2900593cf12a345f0b0797804ba1483517b582" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\bundle-verification.json", + "sha256": "c9b18971fba400ba5473acd3089072ecfd3efd67b76ec2c6248ae5008cf23a5b" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\source-sha256.json", + "sha256": "3c7c8b4f4c8c113cb6a6b481cab38a7d0adf615ba2f0d1e11c199ab9e28fb13f" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\local-capabilities.json", + "sha256": "0cee38bec69ac2e9e4bbe35a4fd9611dc7701a5fd9c8648668d2ccfcb9884ad7" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\build-first-failed-C-space.log", + "sha256": "29c730560d8772ef53232899b31b13eb2ca3fb3506ceac6d5ab2ac9336c13c7f" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\build-first-failure.json", + "sha256": "9fab4b30af806cb59d5af4ad04a40595c317e55e17ce9c3e6529398b2c495e3e" + }, + { + "path": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\button-audit-20261111\\smoke-31cf1d71\\result.json", + "sha256": "20a22b1318dce18d0035b95f1301d4da5ad7f88b463a27890de17ccc0bd27dfb" + } + ] +} diff --git a/docs/releases/2026-11-11-button-simulation.md b/docs/releases/2026-11-11-button-simulation.md new file mode 100644 index 0000000..da8705d --- /dev/null +++ b/docs/releases/2026-11-11-button-simulation.md @@ -0,0 +1,76 @@ +# 2026-11-11:逐按钮模拟操作验证 + +基线:42e87190263453c8e3a7001d5768741b3b3a2c38。 + +全量 Python 测试 **1,835 passed**,只有既有的 STA COM 模式警告;Windows 私有桌面的界面组 **276 passed** 并正常退出。记录了 **281 次点击信号**、**78 种控件标识**和 **28 张代表性截图**。新增测试包含真实 Qt 文件选择和确认按钮、连点、停止、取消、窗口关闭和动态结果入口。 + +## 逐按钮模拟操作结果 + +Windows 原生 Qt 控件,独立私有桌面。48 个应用按钮/复选项全部触发点击信号,另验证 3 个菜单页签;276 项界面相关测试通过。 + +文件选择和确认框使用真实 Qt 对话框及其按钮;原生读写、恢复、保存、取消、强制结束均使用隔离替身。通过表示界面连接、参数、状态及错误处理通过,不表示真实 Mentor 操作通过。 + +| 控件 | 按钮 | 结果 | 验证点 | +| --- | --- | --- | --- | +| BackupRecoveryDialog.browse_button | 选择… | 通过 | 真实备份工程选择框打开/取消 | +| BackupRecoveryDialog.restore_button | 恢复并校验 | 通过 | 无效来源拒绝;确认/拒绝;显示受控恢复结果 | +| BackupRecoveryDialog.close_button | 关闭 | 通过 | 空闲关闭恢复窗口 | +| BackupRecoveryDialog.cancel_queue_button | 取消排队 | 通过 | 取消等待票据,不调用恢复后端 | +| MainWindow.native_lm_verify_check | 使用 Library Manager 原生 Verify(Win10 兼容测试) | 通过 | 勾选状态切换,原生 Verify 选项保持独立 | +| MainWindow.advanced_toggle | 高级设置 | 通过 | 展开和收起高级设置 | +| MainWindow.select_visible_button | 选择可见项 | 通过 | 只勾选可见条目 | +| MainWindow.clear_selection_button | 清空选择 | 通过 | 清空勾选 | +| MainWindow.load_button | 读取 CBB | 通过 | 读取当前库并更新清单 | +| MainWindow.browse_button | 选择 | 通过 | 真实选择框打开/取消;取消不触发读取 | +| MainWindow.selected_batch_button | 批量校验已选 | 通过 | 真实确认/拒绝;仅执行可见非 READY 已选项 | +| MainWindow.batch_button | 校验可见非 READY | 通过 | 真实确认/拒绝;只执行可见非 READY 项 | +| MainWindow.icdb_repair_button | ICDB 批量检查 | 通过 | 开始独立 ICDB 检查,不启用自动 Repair | +| MainWindow.backup_restore_button | 从备份恢复 CBB… | 通过 | 为当前非 READY 目标打开备份恢复窗口 | +| MainWindow.reimport_button | 选择工程副本恢复失败项… | 通过 | 副本恢复仍绑定失败 CBB | +| MainWindow.stop_button | 当前项完成后停止 | 通过 | 设置停止标志,后续目标不再执行 | +| MainWindow.logs_button | 打开日志目录 | 通过 | 打开正确目录;目录及系统打开失败时显示错误 | +| MainWindow.recovery_button | 打开异常证据 | 通过 | 打开正确证据路径;系统打开失败时显示错误 | +| MainWindow.native_backup_button | 版本历史与备份… | 通过 | 只启动一次;收到关闭回执后恢复可用 | +| MainWindow.icdb_stop_button | 停止检查 | 通过 | 停止当前后台检查,不再打开后续项 | +| MainWindow.add_button | 新增 CBB… | 通过 | 打开新增操作窗口 | +| MainWindow.update_button | 用工程替换已选 CBB… | 通过 | 打开所选目标的更新窗口 | +| MainWindow.remove_button | 移除已选… | 通过 | 打开所选目标的移除窗口 | +| MainWindow.release_library_button | 释放残留会话… | 通过 | 打开当前库的释放预览 | +| MainWindow.queue_release_button | 查看残留会话… | 通过 | 打开等待库的释放预览,关闭面板不误解锁任务 | +| MainWindow.runtime_log_toggle | 查看运行日志 | 通过 | 显示/隐藏运行输出 | +| ManagementDialog.sources_button | 选择来源工程… | 通过 | 真实工程选择框打开/取消并更新来源行 | +| ManagementDialog.auto_verify | 本批次上传后自动校验 | 通过 | 切换本批次自动校验选项 | +| ManagementDialog.release_wait_button | 查看残留会话… | 通过 | 传出等待释放的目标库 | +| ManagementDialog.logs_button | 查看日志 | 通过 | 显示/隐藏管理日志 | +| ManagementDialog.execute_button | 预览并确认执行… | 通过 | 真实确认/拒绝,重复点击不重复执行 | +| ManagementDialog.stop_button | 当前项结束后停止 | 通过 | 设置管理任务停止标志 | +| ManagementDialog.close_button | 关闭 | 通过 | 空闲关闭,执行中禁用点击不打断任务 | +| PcbRestoreDialog.manual_button | 最后手动保存 | 通过 | 只选择最后手动保存版本,关闭不覆盖已有选择 | +| PcbRestoreDialog.auto_button | 自动保存 | 通过 | 只选择自动保存版本,关闭不覆盖已有选择 | +| PcbRestoreDialog.cancel_button | 取消 | 通过 | 取消选择,不默认回退版本 | +| ResidualReleaseDialog.refresh_button | 重新检查 | 通过 | 重新扫描预览,不执行释放 | +| ResidualReleaseDialog.confirm_button | 确认释放 | 通过 | 传递当前确认范围,显示实际释放结果 | +| ResidualReleaseDialog.prompt_button | 处理保存提示… | 通过 | 真实是/否/取消,传递对应保存选择 | +| ResidualReleaseDialog.details_button | 查看原生提示… | 通过 | 显示原生提示全文和详细信息 | +| ResidualReleaseDialog.cancel_native_button | 请求原生取消… | 通过 | 真实确认/拒绝后发送受控取消请求 | +| ResidualReleaseDialog.force_button | 强制结束客户端… | 通过 | 真实确认/取消后传递强制标志;未调用实际强杀 | +| ResidualReleaseDialog.close_button | 关闭 | 通过 | 空闲关闭;执行中请求停止并等待当前项返回 | +| Result.batch_release | 查看残留并释放… | 通过 | 从批量失败结果打开当前库释放入口 | +| Result.batch_resume | 继续未执行项 | 通过 | 释放确认后只执行此前未执行的目标 | +| Result.batch_copy | 选择副本恢复… | 通过 | 兼容维护结果中的副本恢复仍绑定失败工程 | +| Result.icdb_release | 查看残留并释放… | 通过 | 从 ICDB 结果打开对应库释放入口 | +| Result.icdb_copy | 选择副本恢复… | 通过 | 从 ICDB 结果打开对应失败工程的副本恢复 | + +每项对应的测试编号、点击次数、完整事件记录及代表性截图见同目录 button-matrix.json / windows-all.json。 + +本轮额外修复:打开日志目录时,目录创建失败或系统拒绝打开不再向 Qt 事件循环抛出未处理异常,改用现有错误提示。 + +未验证:真实 Mentor 写库、ICDB 修复、Windows 10、跨机器共享库。 + +## 验证边界与构建记录 + +实际原生写库、历史回退、保存、原生取消及强制结束均使用隔离替身。未触碰现场工程或中心库,未证明 ICDB 原生修复成功;Windows 10 和跨机器共享库仍未验收。 + +首次候选构建因 C 盘空间不足在收集文件阶段失败,未计为通过。本轮未完成构建已迁至 F 盘继续,原候选和测试证据保留。最终构建及冻结验证结果见相邻验证 JSON。 + +逐按钮的测试编号与点击次数、界面 XML、截图路径和文件哈希保存在相邻验证 JSON 及其引用的本机证据中。截图只提供代表性界面,逐项结论以测试断言和点击记录为依据。 diff --git a/src/cbb_refresh_verify/ui/main_window.py b/src/cbb_refresh_verify/ui/main_window.py index 2daa573..52e54e8 100644 --- a/src/cbb_refresh_verify/ui/main_window.py +++ b/src/cbb_refresh_verify/ui/main_window.py @@ -1688,7 +1688,11 @@ class MainWindow(QWidget): self.busy = False; self._update() def open_logs(self): - self.data_root.mkdir(parents=True, exist_ok=True); os.startfile(str(self.data_root)) + try: + self.data_root.mkdir(parents=True, exist_ok=True) + os.startfile(str(self.data_root)) + except Exception as error: + self._display_error(error) def recover(self): if not self.recovery_path: return diff --git a/tests/button_simulation.py b/tests/button_simulation.py new file mode 100644 index 0000000..4ea369f --- /dev/null +++ b/tests/button_simulation.py @@ -0,0 +1,77 @@ +"""Real Qt click helpers; external native writers stay outside these UI tests.""" +from contextlib import contextmanager + +from PySide6.QtCore import QPoint, QTimer, Qt +from PySide6.QtWidgets import QApplication, QCheckBox, QDialogButtonBox, QFileDialog, QMessageBox + + +def press(qtbot, button): + assert button.isVisible(), button.text() + assert button.isEnabled(), button.text() + if isinstance(button, QCheckBox): + qtbot.mouseClick(button, Qt.LeftButton, pos=QPoint(8, button.height()//2)) + else: + qtbot.mouseClick(button, Qt.LeftButton) + + +def tab(qtbot, window, index): + qtbot.mouseClick(window.section_tabs, Qt.LeftButton, + pos=window.section_tabs.tabRect(index).center()) + assert window.section_stack.currentIndex() == index + + +@contextmanager +def modal_click(qtbot, standard=None, *, file=None, cancel_file=False): + """Answer the real nested dialog by clicking its actual button.""" + timer = QTimer() + deadline = QTimer() + deadline.setSingleShot(True) + seen, errors = [], [] + prepared = False + + def answer(): + nonlocal prepared + dialog = QApplication.activeModalWidget() + try: + if standard is not None and isinstance(dialog, QMessageBox): + button = dialog.button(standard) + if button is None: + return + elif isinstance(dialog, QFileDialog) and (file is not None or cancel_file): + box = dialog.findChild(QDialogButtonBox) + if not cancel_file and not prepared: + dialog.setDirectory(str(file.parent)) + dialog.selectFile(str(file)) + prepared = True + return + button = box.button(QDialogButtonBox.Cancel if cancel_file else QDialogButtonBox.Open) + else: + return + if button is None or not button.isEnabled(): + return + seen.append(dialog.windowTitle()) + timer.stop() + press(qtbot, button) + except Exception as error: + errors.append(str(error)) + timer.stop() + if dialog is not None: + dialog.reject() + + def timeout(): + errors.append('The expected modal button did not become available') + dialog = QApplication.activeModalWidget() + if dialog is not None: + dialog.reject() + + timer.timeout.connect(answer) + deadline.timeout.connect(timeout) + timer.start(10) + deadline.start(4000) + try: + yield seen + finally: + timer.stop() + deadline.stop() + assert not errors, errors + assert len(seen) == 1, seen diff --git a/tests/test_all_buttons.py b/tests/test_all_buttons.py new file mode 100644 index 0000000..e6844a8 --- /dev/null +++ b/tests/test_all_buttons.py @@ -0,0 +1,573 @@ +"""Click every owned control; use real dialogs and controlled native outcomes.""" +from pathlib import Path +from threading import Event +from types import SimpleNamespace +import json + +import pytest +from PySide6.QtCore import Qt +from PySide6.QtWidgets import QMessageBox, QPushButton, QTextEdit +from shiboken6 import isValid + +from button_simulation import modal_click, press, tab +from cbb_refresh_verify.management import Capability, ManagementRequest, ManagementResult +from cbb_refresh_verify.models import CbbRecord, LibraryReadResult +from cbb_refresh_verify.verify_runner import VerifyRequest, VerifyResult + + +@pytest.fixture +def controls(qtbot, tmp_path, monkeypatch, qapp): + import cbb_refresh_verify.ui.main_window as ui + from cbb_refresh_verify import library_lock + old_native = qapp.testAttribute(Qt.AA_DontUseNativeDialogs) + qapp.setAttribute(Qt.AA_DontUseNativeDialogs, True) + library = tmp_path/'library.lmc' + library.touch() + source = tmp_path/'Beta.prj' + source.write_text('KEY iCDBDir "database"\n', encoding='utf-8') + state = SimpleNamespace(library=library, source=source, reads=[], runs=[], opened=[], + entered=Event(), finish=Event(), native=[], result=None) + state.finish.set() + records = (CbbRecord('Ready', 'Power', status='READY'), + CbbRecord('Beta', 'Power', status='PENDING'), CbbRecord('Gamma', 'Analog', status='UNKNOWN')) + lease = SimpleNamespace(mentor_path=library, display_path=library, drive='', remote_root='', + close=lambda: None, retain_for_recovery=lambda: None) + + def verify(request): + state.runs.append(request) + state.entered.set() + assert state.finish.wait(5) + return state.result or VerifyResult('CHECKED' if request.maintenance else 'PASS') + + monkeypatch.setattr(ui, 'preflight_skip_reason', lambda *_: None) + monkeypatch.setattr(ui.os, 'startfile', lambda path: state.opened.append(Path(path))) + monkeypatch.setattr(library_lock, 'inspect_residual_sessions', + lambda path: dict(library=str(path), sessions=[])) + adapter = SimpleNamespace(capabilities=lambda: {op: Capability(True, 'validated fixture') + for op in ('add', 'update', 'remove')}) + window = ui.MainWindow(reader=lambda path: (state.reads.append(path) or LibraryReadResult(records)), + verifier=verify, data_root=tmp_path/'data', path_lease_factory=lambda _: lease, + status_refresher=lambda names, _: {name:'PENDING' for name in names}, management_adapter=adapter) + state.window = window + window.show() + window.lmc_edit.setText(str(library)) + press(qtbot, window.load_button) + qtbot.waitUntil(lambda: not window.busy) + yield state + state.finish.set() + window.stop.set() + if window._icdb_active(): + window.icdb_task.cancel() + window.native_queue.wake() + if window._closing: + qtbot.waitUntil(lambda: not isValid(window) or not window.isVisible()) + if isValid(window): + window.deleteLater() + qtbot.waitUntil(lambda: not isValid(window)) + qapp.setAttribute(Qt.AA_DontUseNativeDialogs, old_native) + return + dialog = getattr(window, 'management_dialog', None) + if dialog is not None and isValid(dialog): + dialog.stop.set() + qtbot.waitUntil(lambda: not window.busy or (dialog is not None and not dialog.busy)) + for child in window.findChildren(QMessageBox): + if isValid(child): + child.close() + for name in ('management_dialog', 'backup_dialog', 'release_dialog'): + child = getattr(window, name, None) + if child is not None and isValid(child): + qtbot.waitUntil(lambda child=child: not child.busy) + child.close() + qtbot.waitUntil(lambda: not window.busy and not window._icdb_active()) + window.close() + qtbot.waitUntil(lambda: not isValid(window) or not window.isVisible()) + if isValid(window): + window.deleteLater() + qtbot.waitUntil(lambda: not isValid(window)) + qapp.setAttribute(Qt.AA_DontUseNativeDialogs, old_native) + + +def test_main_navigation_selection_and_toggles(controls, qtbot): + w = controls.window + for index in (2, 1, 0, 2, 0): + tab(qtbot, w, index) + press(qtbot, w.select_visible_button) + assert len(w.selected_records()) == 3 + press(qtbot, w.clear_selection_button) + assert w.selected_records() == () + press(qtbot, w.advanced_toggle) + assert w.advanced_panel.isVisible() + original = w.native_lm_verify_check.isChecked() + press(qtbot, w.native_lm_verify_check) + assert w.native_lm_verify_check.isChecked() != original + press(qtbot, w.native_lm_verify_check) + press(qtbot, w.advanced_toggle) + assert not w.advanced_panel.isVisible() + press(qtbot, w.runtime_log_toggle) + assert w.output.isVisible() + press(qtbot, w.runtime_log_toggle) + assert not w.output.isVisible() + + +@pytest.mark.parametrize('cancel', [True, False]) +def test_main_library_chooser_real_open_and_cancel(controls, qtbot, cancel): + w = controls.window + before = len(controls.reads) + with modal_click(qtbot, file=None if cancel else controls.library, cancel_file=cancel): + press(qtbot, w.browse_button) + qtbot.waitUntil(lambda: not w.busy) + assert len(controls.reads) == before + (0 if cancel else 1) + press(qtbot, w.load_button) + qtbot.waitUntil(lambda: not w.busy) + assert len(controls.reads) == before + (1 if cancel else 2) + + +def test_main_logs_and_evidence_buttons_open_the_correct_paths(controls, qtbot): + w = controls.window + press(qtbot, w.logs_button) + evidence = controls.library.parent/'evidence' + evidence.mkdir() + w.recovery_path = evidence + w.recovery_button.setEnabled(True) + press(qtbot, w.recovery_button) + assert controls.opened == [w.data_root, evidence] + + +@pytest.mark.parametrize('attribute', ['selected_batch_button', 'batch_button', 'icdb_repair_button']) +@pytest.mark.parametrize('answer', [QMessageBox.No, QMessageBox.Yes]) +def test_main_check_buttons_have_real_confirm_and_cancel_paths(controls, qtbot, attribute, answer): + w = controls.window + if attribute == 'icdb_repair_button': + tab(qtbot, w, 1) + w.search_edit.setText('Beta') + press(qtbot, w.select_visible_button) + with modal_click(qtbot, answer): + press(qtbot, getattr(w, attribute)) + qtbot.waitUntil(lambda: not w.busy and not w._icdb_active()) + assert [request.block_name for request in controls.runs] == ([] if answer == QMessageBox.No else ['Beta']) + if controls.runs: + assert controls.runs[0].auto_repair is False + summary = w.summary + details = next((b for b in summary.findChildren(QPushButton) if 'Details' in b.text()), None) + assert details is not None + press(qtbot, details) + assert summary.findChild(QTextEdit).isVisible() + press(qtbot, summary.button(QMessageBox.Ok)) + assert not isValid(summary) or not summary.isVisible() + + +@pytest.mark.parametrize('background', [True, False]) +def test_main_stop_buttons_stop_additional_items(controls, qtbot, background): + w = controls.window + controls.finish.clear() + if background: + tab(qtbot, w, 1) + button = w.icdb_repair_button if background else w.batch_button + try: + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, button) + qtbot.waitUntil(controls.entered.is_set) + stop = w.icdb_stop_button if background else w.stop_button + press(qtbot, stop) + assert (w.icdb_task.stop if background else w.stop).is_set() + finally: + controls.finish.set() + qtbot.waitUntil(lambda: not w.busy and not w._icdb_active()) + assert [request.block_name for request in controls.runs] == ['Beta'] + + +@pytest.mark.parametrize('operation', ['add', 'update', 'remove']) +def test_main_management_buttons_open_the_requested_operation(controls, qtbot, operation): + w = controls.window + tab(qtbot, w, 2) + w.search_edit.setText('Beta') + press(qtbot, w.select_visible_button) + press(qtbot, getattr(w, operation+'_button')) + dialog = w.management_dialog + assert dialog.operation == operation and w.busy + if operation != 'add': + assert [request.name for request in dialog.requests()] == ['Beta'] + press(qtbot, dialog.close_button) + qtbot.waitUntil(lambda: not w.busy) + + +def test_main_backup_restore_and_release_entries(controls, qtbot): + w = controls.window + tab(qtbot, w, 1) + w.search_edit.setText('Beta') + press(qtbot, w.select_visible_button) + press(qtbot, w.backup_restore_button) + assert w.backup_dialog.block_combo.currentText() == 'Beta' + press(qtbot, w.backup_dialog.close_button) + tab(qtbot, w, 2) + press(qtbot, w.release_library_button) + qtbot.waitUntil(lambda: not w.release_dialog.busy) + assert w.release_dialog.plan['library'] == str(controls.library) + press(qtbot, w.release_dialog.close_button) + qtbot.waitUntil(lambda: not w.busy) + + +def test_native_backup_entry_starts_once_and_reenables_after_receipt(controls, qtbot): + w = controls.window + tab(qtbot, w, 1) + w.search_edit.setText('Beta') + press(qtbot, w.select_visible_button) + job = controls.library.parent/'request.json' + job.write_text('{}', encoding='utf-8') + ended = Event() + session = SimpleNamespace(library=controls.library, block='Beta', job=job, + process=SimpleNamespace(poll=lambda: 0 if ended.is_set() else None)) + w.native_backup_launcher = lambda request: (controls.native.append(request) or session) + press(qtbot, w.native_backup_button) + qtbot.waitUntil(lambda: not w.busy) + for _ in range(5): + qtbot.mouseClick(w.native_backup_button, Qt.LeftButton) + assert len(controls.native) == 1 and not w.native_backup_button.isEnabled() + job.with_name('result.json').write_text(json.dumps(dict(status='CLOSED', safe_to_continue=True, + library=str(controls.library), block='Beta', restore_confirmed=False)), encoding='utf-8') + ended.set() + qtbot.waitUntil(lambda: w._native_backup_session is None and not w.busy, timeout=3000) + assert w.native_backup_button.isEnabled() + assert 'PASS' not in w.cbb_table.item(w._row_by_name['Beta'], 3).text() + + +@pytest.mark.parametrize('operation', ['add', 'update']) +@pytest.mark.parametrize('cancel', [True, False]) +def test_management_source_chooser_and_auto_verify_toggle(controls, qtbot, operation, cancel): + from cbb_refresh_verify.ui.management_dialog import ManagementDialog + req = ManagementRequest(operation, controls.library, '' if operation == 'add' else 'Beta') + dialog = ManagementDialog([req]) + qtbot.addWidget(dialog) + dialog.show() + with modal_click(qtbot, file=None if cancel else controls.source, cancel_file=cancel): + press(qtbot, dialog.sources_button) + assert dialog.table.rowCount() == (0 if operation == 'add' and cancel else 1) + if not cancel: + assert dialog.requests()[0].source == controls.source + checked = dialog.auto_verify.isChecked() + press(qtbot, dialog.auto_verify) + assert dialog.auto_verify.isChecked() != checked + press(qtbot, dialog.logs_button) + assert dialog.output.isVisible() + press(qtbot, dialog.logs_button) + assert not dialog.output.isVisible() + press(qtbot, dialog.close_button) + assert not dialog.isVisible() + + +def test_management_confirm_cancel_execute_stop_and_repeated_click(controls, qtbot): + from cbb_refresh_verify.ui.management_dialog import ManagementDialog + entered, finish = Event(), Event() + calls = [] + def runner(requests, **kwargs): + calls.extend(requests) + entered.set() + assert finish.wait(5) + return [ManagementResult('remove', controls.library, 'Beta', 'Logical-Physical', None, + False, 'complete', 'REMOVED', True)] + dialog = ManagementDialog([ManagementRequest('remove', controls.library, 'Beta')], runner=runner) + qtbot.addWidget(dialog) + dialog.show() + with modal_click(qtbot, QMessageBox.No): + press(qtbot, dialog.execute_button) + assert calls == [] and not dialog.executed + try: + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, dialog.execute_button) + qtbot.waitUntil(entered.is_set) + for _ in range(5): + qtbot.mouseClick(dialog.execute_button, Qt.LeftButton) + qtbot.mouseClick(dialog.close_button, Qt.LeftButton) + assert len(calls) == 1 and dialog.isVisible() + press(qtbot, dialog.stop_button) + assert dialog.stop.is_set() + finally: + finish.set() + qtbot.waitUntil(lambda: not dialog.busy) + assert '已移除' in dialog.status_label.text() + press(qtbot, dialog.close_button) + + +@pytest.mark.parametrize('cancel', [True, False]) +def test_recovery_real_source_chooser_and_confirmation_options(controls, qtbot, cancel): + from cbb_refresh_verify.ui.backup_recovery_dialog import BackupRecoveryDialog + calls = [] + def recover(request, source, **kwargs): + calls.append((request.block_name, source)) + return VerifyResult('PASS') + dialog = BackupRecoveryDialog(['Beta'], + lambda name: VerifyRequest(controls.library, name, controls.library.parent/'evidence'), recoverer=recover) + qtbot.addWidget(dialog) + dialog.show() + with modal_click(qtbot, file=None if cancel else controls.source, cancel_file=cancel): + press(qtbot, dialog.browse_button) + if cancel: + assert dialog.source_edit.text() == '' + else: + assert Path(dialog.source_edit.text()) == controls.source + if cancel: + press(qtbot, dialog.restore_button) + assert '有效' in dialog.status_label.text() and not dialog.busy + else: + with modal_click(qtbot, QMessageBox.No): + press(qtbot, dialog.restore_button) + assert calls == [] + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, dialog.restore_button) + qtbot.waitUntil(lambda: not dialog.busy) + assert calls == [('Beta', controls.source)] + assert '恢复完成' in dialog.status_label.text() + press(qtbot, dialog.close_button) + assert not dialog.isVisible() + + +def test_recovery_cancel_queue_never_calls_native_restore(controls, qtbot): + from cbb_refresh_verify.operation_queue import NativeQueue + from cbb_refresh_verify.ui.backup_recovery_dialog import BackupRecoveryDialog + calls = [] + queue = NativeQueue() + queue.active = True + dialog = BackupRecoveryDialog(['Beta'], + lambda name: VerifyRequest(controls.library, name, controls.library.parent/'evidence'), + recoverer=lambda *a, **k: calls.append(a)) + dialog.native_queue = queue + qtbot.addWidget(dialog) + dialog.show() + dialog.source_edit.setText(str(controls.source)) + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, dialog.restore_button) + qtbot.waitUntil(dialog.cancel_queue_button.isEnabled) + press(qtbot, dialog.cancel_queue_button) + qtbot.waitUntil(lambda: not dialog.busy) + assert calls == [] and dialog.stop.is_set() + press(qtbot, dialog.close_button) + + +@pytest.mark.parametrize('attribute, expected', [('manual_button','last_user_saved'), + ('auto_button','autosave'), ('cancel_button','cancel')]) +def test_version_choice_buttons_choose_only_the_clicked_version(qtbot, attribute, expected): + from cbb_refresh_verify.pcb_restore_prompt import RestoreChoice + from cbb_refresh_verify.ui.pcb_restore_dialog import PcbRestoreDialog + choice = RestoreChoice('Beta', 'fixture.lmc', [dict(kind=kind, enabled=True, date='2026/11/11 10:00') + for kind in ('last_user_saved','autosave')]) + dialog = PcbRestoreDialog(choice) + qtbot.addWidget(dialog) + dialog.show() + press(qtbot, getattr(dialog, attribute)) + assert choice.decision == expected + dialog.close() + assert choice.decision == expected + + +@pytest.fixture +def residual(controls, qtbot, monkeypatch): + from cbb_refresh_verify import library_lock, residual_sessions + from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog + row = dict(project='Beta', name='ExpeditionPCB.exe', pid=10, detail='fixture session', + scope_confirmed=True, owner_sid='S-1-fixture', session_id=1, force_user_confirmed=True, + image='C:/Fixture/ExpeditionPCB.exe', created_handle='fixture-created', + native_activity=dict(status='IDLE', detail='fixture returned'), + desktops=['CbbFixture'], windows=[dict(title='Fixture native prompt', output='Fixture details')], + prompt=dict(text='Save the changed fixture?'), cancel_prompt=dict(text='Cancel fixture')) + plan = dict(library=str(controls.library), sessions=[row]) + state = SimpleNamespace(scans=[], releases=[], cancels=[], saves=[], row=row, plan=plan, + entered=Event(), finish=Event(), hold=False) + def inspect(library): + state.scans.append(library) + return plan + def release(actual, folder, **kwargs): + state.releases.append(kwargs) + if state.hold: + state.entered.set() + assert state.finish.wait(5) + return dict(status='PARTIAL', sessions=[dict(row, release_status='WAITING', consent_allowed=True)]) + def cancel(actual, library, folder, **kwargs): + state.cancels.append(actual) + return dict(status='PARTIAL', detail='Fixture cancel received', + sessions=[dict(row, release_status='WAITING')]) + monkeypatch.setattr(library_lock, 'inspect_residual_sessions', inspect) + monkeypatch.setattr(library_lock, 'release_residual_sessions', release) + monkeypatch.setattr(residual_sessions, 'request_native_cancel', cancel) + monkeypatch.setattr(residual_sessions, 'answer_save_question', + lambda actual, code: state.saves.append((actual['pid'], code))) + dialog = ResidualReleaseDialog(controls.library, controls.library.parent/'release-evidence') + qtbot.addWidget(dialog) + dialog.show() + qtbot.waitUntil(lambda: not dialog.busy) + state.dialog = dialog + yield state + state.finish.set() + qtbot.waitUntil(lambda: not dialog.busy) + + +def test_residual_refresh_details_confirm_and_close(residual, qtbot): + d = residual.dialog + press(qtbot, d.refresh_button) + qtbot.waitUntil(lambda: not d.busy) + assert len(residual.scans) == 2 and d.table.rowCount() == 1 + press(qtbot, d.details_button) + details = d.native_details + assert 'Fixture native prompt' in details.detailedText() + expand = next(b for b in details.findChildren(QPushButton) if 'Details' in b.text()) + press(qtbot, expand) + assert details.findChild(QTextEdit).isVisible() + press(qtbot, details.button(QMessageBox.Ok)) + press(qtbot, d.confirm_button) + qtbot.waitUntil(lambda: not d.busy) + assert len(residual.releases) == 1 and residual.releases[0]['force'] is False + assert d.table.item(0, 6).text() == '允许' + assert d.table.item(0, 7).text() == '未释放' + press(qtbot, d.close_button) + assert not d.isVisible() + + +@pytest.mark.parametrize('answer, code', [(QMessageBox.Yes,6),(QMessageBox.No,7),(QMessageBox.Cancel,2)]) +def test_residual_save_prompt_buttons_preserve_the_users_choice(residual, qtbot, answer, code): + d = residual.dialog + with modal_click(qtbot, answer): + press(qtbot, d.prompt_button) + qtbot.waitUntil(lambda: not d.busy) + assert residual.saves == [(10, code)] + assert d.isVisible() and residual.releases == [] + + +@pytest.mark.parametrize('answer', [QMessageBox.No,QMessageBox.Yes]) +def test_residual_native_cancel_confirm_and_decline(residual, qtbot, answer): + d = residual.dialog + with modal_click(qtbot, answer): + press(qtbot, d.cancel_native_button) + qtbot.waitUntil(lambda: not d.busy) + assert len(residual.cancels) == (1 if answer == QMessageBox.Yes else 0) + assert residual.releases == [] + + +@pytest.mark.parametrize('answer', [QMessageBox.Cancel,QMessageBox.Yes]) +def test_residual_force_buttons_require_actual_confirmation(residual, qtbot, answer): + d = residual.dialog + with modal_click(qtbot, answer): + press(qtbot, d.force_button) + qtbot.waitUntil(lambda: not d.busy) + assert [call['force'] for call in residual.releases] == ([True] if answer == QMessageBox.Yes else []) + + +def test_residual_busy_repeated_clicks_and_stop_release(residual, qtbot): + d = residual.dialog + residual.hold = True + try: + press(qtbot, d.confirm_button) + qtbot.waitUntil(residual.entered.is_set) + for _ in range(5): + qtbot.mouseClick(d.confirm_button, Qt.LeftButton) + qtbot.mouseClick(d.refresh_button, Qt.LeftButton) + assert len(residual.releases) == 1 and len(residual.scans) == 1 + press(qtbot, d.close_button) + assert d.stop.is_set() and d.isVisible() + finally: + residual.finish.set() + qtbot.waitUntil(lambda: not d.busy) + press(qtbot, d.close_button) + + +def test_result_release_and_resume_buttons_run_only_unexecuted_items(controls, qtbot, monkeypatch): + from cbb_refresh_verify import library_lock + w = controls.window + controls.result = VerifyResult('FAIL', safe_to_continue=False, stderr='Fixture release unconfirmed') + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, w.batch_button) + qtbot.waitUntil(lambda: not w.busy) + assert [request.block_name for request in controls.runs] == ['Beta'] + assert not w._resume_batch_action.isEnabled() + proof = dict(status='RELEASE_CONFIRMED', library=str(controls.library), evidence_path='fixture-proof.json') + monkeypatch.setattr(library_lock, 'release_residual_sessions', + lambda *a, **k: dict(status='RELEASE_CONFIRMED', proof=proof, sessions=[])) + press(qtbot, w._residual_release_action) + qtbot.waitUntil(lambda: not w.release_dialog.busy) + press(qtbot, w.release_dialog.confirm_button) + qtbot.waitUntil(lambda: not w.release_dialog.busy) + press(qtbot, w.release_dialog.close_button) + qtbot.waitUntil(lambda: not w.busy) + controls.result = VerifyResult('PASS') + press(qtbot, w._resume_batch_action) + qtbot.waitUntil(lambda: not w.busy) + assert [request.block_name for request in controls.runs] == ['Beta','Gamma'] + + +@pytest.mark.parametrize('entry', ['icdb_copy', 'icdb_release', 'batch_copy', 'batch_close']) +def test_result_recovery_and_release_entries_stay_bound_to_failed_cbb(controls, qtbot, entry): + from dataclasses import replace + from test_reimport_recovery import failed_repair + w = controls.window + if entry.startswith('icdb'): + tab(qtbot, w, 1) + w.search_edit.setText('Beta') + controls.result = failed_repair(controls.library.parent/'failure.json', safe=entry=='icdb_copy') + with modal_click(qtbot, QMessageBox.Yes): + press(qtbot, w.icdb_repair_button) + qtbot.waitUntil(lambda: not w._icdb_active()) + label = '查看残留并释放…' if entry=='icdb_release' else '选择副本恢复…' + press(qtbot, next(b for b in w.icdb_summary.buttons() if b.text()==label)) + else: + # This is the supported legacy maintenance-result shape; current UI + # maintenance uses the independent IcdbCheckTask route above. + req = replace(w._request('Beta'), maintenance=True) + w._batch_requests = (req,) + w._batch_records = {'Beta':w._records_by_name['Beta']} + w._batch_done(([failed_repair(controls.library.parent/'failure.json',safe=True)], None)) + w._update() + if entry=='batch_close': + summary = w.summary + press(qtbot, summary.button(QMessageBox.Close)) + assert not isValid(summary) or not summary.isVisible() + return + press(qtbot, w._reimport_summary_action) + if entry=='icdb_release': + qtbot.waitUntil(lambda: not w.release_dialog.busy) + assert w.release_dialog.library == controls.library + press(qtbot, w.release_dialog.close_button) + else: + dialog = w.management_dialog + assert [req.name for req in dialog.requests()] == ['Beta'] + assert Path(dialog.recovery_from['Beta']) == controls.library.parent/'failure.json' + press(qtbot, dialog.close_button) + qtbot.waitUntil(lambda: not w.busy) + if entry=='icdb_copy': + tab(qtbot,w,1) + press(qtbot,w.reimport_button) + assert [req.name for req in w.management_dialog.requests()] == ['Beta'] + press(qtbot,w.management_dialog.close_button) + + +def test_invalidated_catalog_buttons_ignore_clicks(controls, qtbot): + w = controls.window + w.lmc_edit.setText('not-loaded.lmc') + for index, attributes in [(0,['selected_batch_button','batch_button']), + (1,['icdb_repair_button','native_backup_button','backup_restore_button']), + (2,['add_button','update_button','remove_button'])]: + tab(qtbot,w,index) + for attribute in attributes: + button = getattr(w,attribute) + assert not button.isEnabled() + qtbot.mouseClick(button,Qt.LeftButton) + assert controls.runs == [] and controls.native == [] + assert getattr(w,'management_dialog',None) is None + + +@pytest.mark.parametrize('attribute, failure', [('logs_button','shell'), + ('logs_button','directory'),('recovery_button','shell')]) +def test_log_and_evidence_buttons_report_external_failure(controls,qtbot,monkeypatch,attribute,failure): + import cbb_refresh_verify.ui.main_window as ui + def fail(path): + raise OSError('Fixture shell access denied') + w = controls.window + if failure=='shell': + monkeypatch.setattr(ui.os,'startfile',fail) + expected = 'Fixture shell access denied' + else: + w.data_root = controls.source/'logs' + expected = 'Beta.prj' + if attribute=='recovery_button': + w.recovery_path = controls.library.parent + w.recovery_button.setEnabled(True) + press(qtbot,getattr(w,attribute)) + assert expected in w.status_label.text() + assert controls.opened == []