Skip to content

Simplify golden PNG comparators and unify i18n completeness checks - #2981

Merged
kitlangton merged 1 commit into
devfrom
simplify-comparators-and-i18n
Nov 27, 2026
Merged

kitlangton merged 1 commit into
devfrom
simplify-comparators-and-i18n

Conversation

@kitlangton

Copy link
Copy Markdown
Collaborator

Consolidates the five duplicated golden PNG comparators and unifies translation completeness, uniqueness, and placeholder checks across every supported interface language.

Before

  • Five test modules (rune_ui/tests.rs, meeting_capsules.rs, capture_capsule/tests.rs, screenshot_thumbnail/tests.rs, screenshot_thumbnail/editor/tests.rs) each re-implemented PNG decoding, channel tolerance (12), mismatch limits (w * h / 500), HEX_UPDATE_GOLDENS / HEX_GOLDEN_RENDERS handling, and -actual.png output.
  • Completeness, placeholder, and uniqueness tests in src/desktop/i18n.rs checked only the 6-column all_translations() table (except two ad-hoc overrides). Per-language test blocks in french.rs, portuguese.rs, russian.rs, and hungarian.rs skipped the 16 overflow sections merged by screenshots::merged(), and those four files carried 12–15 stale keys each while sitting at the 1,500-line ceiling.

After

  • src/rune_ui/offscreen.rs owns one #[cfg(test)] compare_golden helper used by all five golden suites, preserving /tmp/rune-settings-*-actual.png for check-linux.yml and release.yml uploads and the exact message format scripts/check-onboarding.sh parses, plus a unit test covering tolerance, pixel limits, size changes, and missing goldens.
  • src/desktop/i18n.rs enforces completeness, uniqueness, and {} / {name} placeholder preservation across all 11 non-English languages (6-column table, French, Portuguese, Russian, Hungarian including all 16 overflow sections, and Traditional Chinese) and rejects stale keys in the four standalone tables. All four standalone files drop below 1,490 non-test lines.

Verification

Check Result
cargo fmt --all --check pass
python3 scripts/code-shape.py --check pass (0 hard problems)
cargo clippy --locked --bin hex --tests -- -D warnings pass
scripts/check i18n offscreen capture_capsule::tests::capture_capsule_goldens 34 passed, 0 failed

Read: src/rune_ui/offscreen.rs and src/desktop/i18n.rs.

@kitlangton
kitlangton merged commit 27366ae into dev Nov 27, 2026
4 checks passed
@kitlangton
kitlangton deleted the simplify-comparators-and-i18n branch November 27, 2026 19:49
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.

1 participant