add a regression test for the fractional canvas size - #12293
Open
HuzaifaChaudary wants to merge 1 commit into
Open
add a regression test for the fractional canvas size#12293HuzaifaChaudary wants to merge 1 commit into
HuzaifaChaudary wants to merge 1 commit into
Conversation
retinaScale kept reporting a change when the chart size had a decimal in it. the canvas stores whole pixels only so the value written back never matched the value it was compared against and every resize looked like a real one. the floor added in 12142 fixed that but nothing guarded it so this pins the second call returning false.
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.
while looking at #12269 i went to find why 4.5.1 behaves differently from 4.5.0 on a responsive chart and it comes down to
retinaScale.in 4.5.1 the canvas dimensions are written straight from
round1:canvas.widthandcanvas.heightare unsigned long so the browser truncates whatever is assigned to them. when the container measures to a fraction the stored value can never equal the value it is compared against. the check is then true on every call andretinaScalekeeps reporting that the size changed.i measured it in chrome headless:
this matters because
_resizeuses the return value as its early exit:so on 4.5.1 a fractional size makes every attach and every resize fall through to
_doResizeinstead of stopping there. that is the path in the stack trace on #12269.#12142 already fixed this by flooring the canvas dimensions but it landed without a test and it is not in a release yet. this adds the missing guard so the behaviour does not slip back. putting the floor back out makes the new test fail with
Expected true to be falseon the second call.no source change here.