From bf4fcdc26ac92f776d3233a08c2edff7ea99286d Mon Sep 17 00:00:00 2001 From: James Maes Date: Sun, 11 Oct 2026 04:25:11 -0500 Subject: [PATCH] test(print): measure precise font scale in actual PDFs Refs #12, #13 Co-Authored-By: Codex (GPT-6) Signed-off-by: James Maes --- docs/SESSION-STATE.md | 13 +++++++++---- docs/TODO.md | 2 +- .../AppTests.PrintGeometry.cs | 13 ++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/SESSION-STATE.md b/docs/SESSION-STATE.md index 6a5e7ec..c9321b6 100644 --- a/docs/SESSION-STATE.md +++ b/docs/SESSION-STATE.md @@ -39,11 +39,16 @@ width versus full page and actual optional border rows. New helper edits actual native options, including padding NumberBox; all generated PDF/PNG bytes retained. Signedd0a225d / CI38127089763 finishes native/published53/54, zero skips. Actual saved custom-width/border/full-page case passes. Font/padding case fails -before PDF output at the fourth requested zoom wait; installed channels are not +before PDF output at a requested zoom wait; installed channels are not reached. Exact expected/actual glyph rectangles and native state are now retained -on failure; all original assertions remain. Retained red log and published TRX: +on failure. Diagnostic6e17674 proves the second step: initial35px,121% actual44px, +expected42.35px from multiplying an already-rounded UIA text box. The new PDF +case now requires actual increasing screen glyphs and completed native percentage, +plus bounded final screen growth; precise standard/matched font ratios remain +asserted against real PDF glyph bands. No PDF/state assertion is removed. +Retained red log and published TRX: artifacts/print-geometry-native-38127089763.log and -artifacts/print-geometry-installed-38127089763. New diagnostic head requires54 +artifacts/print-geometry-installed-38127089763. Corrected head requires54 native/published and53 per installed channel. No local GUI input or new dependency. ADR-0003 remains proposed; full font/padding/paired-find acceptance is pending. @@ -83,7 +88,7 @@ Superseded diagnostic jobs are not fixed-head acceptance proof. ## Next steps -1. Diagnose exact fourth-zoom geometry; require expanded full gates and retained PDF/TRX evidence. +1. Verify actual PDF font/padding/find after the diagnosed UIA font rounding; require expanded full gates and retained PDF/TRX evidence. 2. Complete source raw-heading audit and broader zoom/theme/find/collapse proof. 3. Complete print #12 output/state acceptance, windows/recents/activation and remaining theme/render/link parity. 4. Finish standards inventory; exact signed stable/dev artifacts remain deferred. diff --git a/docs/TODO.md b/docs/TODO.md index 815679b..6c85969 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -40,7 +40,7 @@ - [ ] Verify actual zoom glyph/key/reload/theme/find/collapse behavior in native, published and both installed channels. - [x] Implement print-only themes/options, native Windows print UI and explicit PDF save (issue #12); core363/100% lines; no new renderer dependency. - [x] Verify original3 focused native print cases on ec5f98f/38125751638: both cancels, real default/themed PDF pixels and unchanged actual glyph/view/source/collapse state. -- [x] Implement actual PDF font/padding/width/border comparisons and successful-export paired-find preservation; d0a225d native/published width/borders pass, fourth zoom wait fails before font/padding output. +- [x] Implement actual PDF font/padding/width/border comparisons and successful-export paired-find preservation; d0a225d native/published width/borders pass, zoom wait fails before font/padding output. Diagnostic6e17674 confirms rounded UIA metrics; corrected case measures precise font ratios in actual PDFs. - [x] Verify clean original3 print cases in full300e145: native/published52 each, installed stable/dev51 each, zero failures/skips; real PDFs and update apply/restart retained. - [ ] Verify actual native print cancellation, saved PDF image/background/font/layout output and unchanged reading/source/find/collapse state in all channels. - [ ] Add multiple document windows, recent files and Windows activation/file associations. diff --git a/tests/MarkdownViewr.Windows.UiTests/AppTests.PrintGeometry.cs b/tests/MarkdownViewr.Windows.UiTests/AppTests.PrintGeometry.cs index d061382..4ba193b 100644 --- a/tests/MarkdownViewr.Windows.UiTests/AppTests.PrintGeometry.cs +++ b/tests/MarkdownViewr.Windows.UiTests/AppTests.PrintGeometry.cs @@ -23,11 +23,18 @@ public partial class AppTests double height = session.WaitForElement("mv-heading-0").BoundingRectangle.Height; for(int step = 0; step < 4; step++) { + double previous = session.WaitForElement("mv-heading-0").BoundingRectangle.Height; session.ClickElement("ZoomInButton"); - double expected = height * Math.Pow(1.1, step + 1); - _output.WriteLine(FormattableString.Invariant($"Print zoom step={step + 1}; original height={height}; expected={expected}; actual={session.WaitForElement("mv-heading-0").BoundingRectangle}; reset={session.WaitForElement("ZoomResetButton").Name}.")); - WaitForZoomGlyph(session, expected); + string percentage = Math.Round(Math.Pow(1.1, step + 1) * 100).ToString(System.Globalization.CultureInfo.InvariantCulture); + session.WaitFor(() => + { + AutomationElement heading = session.WaitForElement("mv-heading-0"); + AutomationElement reset = session.WaitForElement("ZoomResetButton"); + return heading.BoundingRectangle.Height > previous && reset.IsEnabled && string.Equals(reset.Name, "Actual size (" + percentage + "%)", StringComparison.Ordinal) ? heading : null; + }, "the real larger heading at the completed requested zoom step"); } + // UIA text boxes use rounded font metrics (35px becomes 44px at 121%); exact font scale is measured in the PDF below. + Assert.InRange(session.WaitForElement("mv-heading-0").BoundingRectangle.Height / height, 1.35, 1.6); session.InvokeMenuItem("View", "SourceToggle"); session.InvokeMenuItem("Edit", "FindMenuItem"); session.EnterText("FindText", "paired needle");