Fixed TestCopyHTML1/2: expectations were generated on a 216 dpi machine - #1394
Open
TetzkatLipHoka wants to merge 1 commit into
Open
Fixed TestCopyHTML1/2: expectations were generated on a 216 dpi machine#1394TetzkatLipHoka wants to merge 1 commit into
TetzkatLipHoka wants to merge 1 commit into
Conversation
The two tests compared the CF_HTML clipboard content byte-by-byte against hardcoded strings whose pixel heights came from the machine the fixture was created on (the test form's dfm carries PixelsPerInch = 216). On any other dpi the dpi-rescale chain yields different node heights - measured on a 96 dpi machine the only difference is height="18px" vs height="19px" in the data rows - so the tests have been permanently red on standard-dpi machines since their introduction. The expected string is now built from the tree's actual metrics (font, Header.Height, column widths and captions, NodeHeight[], Text[]) using the same sources the HTML exporter reads, with the fixed-width CF_HTML offset header computed exactly like MakeFragment in VirtualTrees.Export.pas. The comparison stays byte-exact, so any change to the export format still fails the test - only the machine dependency is gone. Assert.AreEqual now also reports the actual difference instead of a plain boolean message. With this the whole suite is green for the first time: 153/153 on Delphi 13.1 and on 10 Seattle (the oldest claimed supported version). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two
TestCopyHTMLtests have been permanently red on standard-dpi machines since their introduction. They compare the CF_HTML clipboard content byte-by-byte against hardcoded strings whose pixel values come from the machine the fixture was created on - the test form's dfm carriesPixelsPerInch = 216(DefaultNodeHeight 46, TextMargin 9, ...). On a 96 dpi machine the dpi-rescale chain yields a node height of 19 instead of 18, and the only difference in the whole comparison isheight="18px"vsheight="19px"in the data rows (the CF_HTML offsets happen to still match because both values have two digits).The expected string is now built from the tree's actual metrics - font,
Header.Height, column widths and captions,NodeHeight[],Text[]- i.e. the same sources the HTML exporter reads, and the fixed-width CF_HTML offset header is computed exactly likeMakeFragmentinVirtualTrees.Export.pas. The comparison stays byte-exact, so any change to the export format still fails the test - only the machine dependency is gone.Assert.AreEqualnow also reports the actual difference instead of a plain boolean message.With this the suite is fully green for the first time: 153/153 on Delphi 13.1 and on 10 Seattle (the oldest claimed supported version, both 96 dpi). Should be green on high-dpi machines as well since all values are derived from the running tree.
🤖 Generated with Claude Code