Repository navigation
Compare the controls of the macOS look with AppKit in CI - #1111
Open
beetlebugorg wants to merge 2 commits into
Open
beetlebugorg wants to merge 2 commits into
beetlebugorg wants to merge 2 commits into
Conversation
src/tests/aqua_pixels.zig renders each control of aqua-macos.css in each state, light and dark, at the frame and the scale of its render by zig build native-ref, and compares the pixels with that render. The score of a case is the fraction of pixels that differ at the best shift of up to 4 pixels, and a case fails above its limit. The test writes a report and a picture of each case, AppKit next to ztk. With no ZTK_NATIVE_REF in the environment it is skipped. The job pixel-macos of CI runs native-ref and the test on a macOS runner, and keeps the report in the summary and the pictures as an artifact. The limits are the scores on macOS 27 plus 0.05.
cacheDisplayInRect gives the render in the color space of the screen, so on a display with a wide gamut the accent #007aff of AppKit came out as #2f77f6, and the pixel harness counted each pixel of the accent as a difference. ztk draws in sRGB, so native-ref now converts each render to sRGB, where the accent is #007aff. The limits of the harness are the new scores plus 0.05: the default button falls from 0.92 to 0.33, and the selected segment from 0.31 to 0.03.
This branch has not been deployed
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.
Closes #1072. Part of #154. Stacked on #1110 (#1071 part 2).
Step 5 of the macOS part of
docs/dev/native-look.md: the pixel harness.src/tests/aqua_pixels.zigreads the output folder ofzig build native-reffromZTK_NATIVE_REF. For each control and state in the regular size, light and dark, it reads the frame frommeasures.jsonand the scale frompixels_wide, makes the same ttk widget on the headless backend with Core Text, and compares the pixels with the AppKit render placed over the window color of ztk. The score of a case is the fraction of pixels with a channel more than 40 apart, at the best shift of up to 4 pixels. A case fails above its limit.report.md(one row for each case) andcompare/NAME.png(AppKit at the left, ztk at the right). WithoutZTK_NATIVE_REFthe test is skipped, sozig build testdoes not change.pixel-macosof CI (macOS runner, on a change of code) runs native-ref and the test, puts the report in the summary of the job with the version of macOS, and keeps the pictures as the artifactpixel-macos.The cases: the push button (rest, disabled, default), the check box, the radio button, and the switch (rest, on, disabled), the slider (rest, on, disabled), the pop-up and the pull-down button, the text field, and the combo box (rest, disabled), the segmented control (rest, on, disabled), the progress bar, the tab view (rest, disabled), and the box. Not in it, with the reason:
The color space:
cacheDisplayInRectrenders in the color space of the screen, andscreencapturetoo. On a display with a wide gamut, the accent of AppKit,controlAccentColor= #007aff in sRGB (light and dark, from AppKit), comes out as #2f77f6 to #3478f6. ztk draws in sRGB, so native-ref now converts each render to sRGB (second commit), where the AppKit render of the default button is exactly #007aff. The fallback accent of the sheet (#007aff) is right, and a real window usescontrolAccentColorfrom the backend (appkit.zigaccentColor,--system-accent), so the choice of the user wins. The grays of the captures do not change in sRGB.What the scores show on macOS 27, for the next steps:
The report on macOS 27.0 (26A428):
CI runs the job on main and on the schedule (a pull request runs only the quick jobs); this report is from a run on the Mac.
Lines: estimate 250, actual +300 −3.