Skip to content

test(rendering): check the text cache against each shaping input - #2739

Open
notkainoa wants to merge 2 commits into
CapSoftware:mainfrom
notkainoa:test/text-shape-key-inputs
Open

notkainoa wants to merge 2 commits into
CapSoftware:mainfrom
notkainoa:test/text-shape-key-inputs

Conversation

@notkainoa

@notkainoa notkainoa commented Oct 20, 2026 •

Copy link
Copy Markdown

Follow-up to #2524. The text cache is already on main, so that PR conflicts. This is only the test you asked for.

The existing test only checks that changing the words throws the old layout away. This one changes font size, family, weight, italic, letter spacing, alignment, line height, and wrap width one at a time on a warmed layer, and compares the pixels to a fresh layer. Dropping any of those from the cache key fails the test.

No speed change.

cargo test -p cap-rendering --lib reused_layouts_follow_each_shaping_input -- --ignored passes. cargo clippy -p cap-rendering --lib --tests -- -D warnings is clean.

Made with Cursor

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking test reliability concern.

Findings

  1. P2 Installed fonts change test results ▶
Fix with agent prompt
### Issue 1
crates/rendering/src/layers/text.rs:1102-1105
The `expected != base_pixels` check depends on the host's installed fonts. If two requested choices resolve to the same face, this assertion fails even when cached and fresh layouts match. `new_font_system()` scans system fonts, but the test supplies no fixed regular, bold, italic, or monospace faces. Supply a fixed font set so this test checks cache behavior rather than the host's font collection.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds an ignored GPU test that compares a warmed text layer with a fresh layer after eight shaping edits.

  • The text cache test checks each shaping input against a fresh render.

Reviews (1) · Last reviewed commit: "test(rendering): check the text cache ag..." · Reviewed by Greptile

Main's reuse test only edits the string. Changing font, spacing, alignment, line height, or wrap width one at a time catches a cache key that drops one of those.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread crates/rendering/src/layers/text.rs Outdated
Comment on lines +1102 to +1105
assert!(
expected != base_pixels,
"{name} edit should change the output"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Installed fonts change test results

The expected != base_pixels check depends on the host's installed fonts. If two requested choices resolve to the same face, this assertion fails even when cached and fresh layouts match. new_font_system() scans system fonts, but the test supplies no fixed regular, bold, italic, or monospace faces. Supply a fixed font set so this test checks cache behavior rather than the host's font collection.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/layers/text.rs
Line: 1102-1105

Comment:
**Installed fonts change test results**

The `expected != base_pixels` check depends on the host's installed fonts. If two requested choices resolve to the same face, this assertion fails even when cached and fresh layouts match. `new_font_system()` scans system fonts, but the test supplies no fixed regular, bold, italic, or monospace faces. Supply a fixed font set so this test checks cache behavior rather than the host's font collection.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d3de3eb.

Family, weight, and italic no longer have to change the pixels. Those only look different when the machine has a separate face, and this test uses the system fonts. Each of those edits now fails unless the previous buffer stays unused and the warmed layer's pixels match a fresh layer. Dropping family, weight, or italic from the cache key reuses the old buffer, so previous_buffers is empty and the test fails.

Font size, letter spacing, alignment, line height, and wrap width still have to change the pixels. Those move the glyphs on any font that can draw the string.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks @notkainoa! Greptile is at 4/5 here. We only merge once Greptile reaches 5/5, so please address its findings in the summary above (or reply to them if you think one is wrong), then comment @greptileai review to re-score.

Family, weight, and italic fail when the previous buffer is reused. Edits that move glyphs still have to change the pixels.

Co-authored-by: Cursor <cursoragent@cursor.com>
@notkainoa

Copy link
Copy Markdown
Author

@greptileai review

This branch has not been deployed

No deployments
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.

2 participants