Skip to content

Fix unit preference changes for open documents - #189

Open
Anteriousis wants to merge 2 commits into
10-X-eng:mainfrom
Anteriousis:bugfix/issue-182-unit-preferences
Open

Fix unit preference changes for open documents#189
Anteriousis wants to merge 2 commits into
10-X-eng:mainfrom
Anteriousis:bugfix/issue-182-unit-preferences

Conversation

@Anteriousis

@Anteriousis Anteriousis commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

The unit preference change now updates the active document's unit system when project units are not being ignored, while preserving the view-only behavior when "Ignore project unit system" is enabled. A regression test covers changing units with an open document.

Verification

  • For code changes, a test failed before the implementation and passes afterward; for non-code changes, the PR explains why TDD does not apply.
  • The PR lists the exact build and test commands and their results.

The focused regression test failed against the pre-fix implementation and passes afterward:

  • pixi run cmake --build build/debug --target UnitSettings_Tests_run --parallel 8
  • pixi run ctest --test-dir build/debug -R UnitSettings_Tests_run --output-on-failure

Also verified the existing QuantitySpinBox_Tests_run test passes.

Issues

Fixes #182

Before and After Images

No visual changes; screenshots are not applicable.

Only update the active document when the selected global unit preference changes. Preserve project units when applying unrelated preferences or disabling IgnoreProjectSchema. Expand Qt coverage to seven scenarios.

Red: the unchanged-preference and restore-project-units cases failed against the PR implementation before the fix. Green: both test executables pass after the fix.

Validation: pixi run cmake --build build/debug --target UnitSettings_Tests_run QuantitySpinBox_Tests_run --parallel 8 (passed)

Validation: pixi run ctest --test-dir build/debug -R "^(UnitSettings|QuantitySpinBox)_Tests_run$" --output-on-failure (2/2 passed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If you change units it breaks everything

2 participants