Skip to content

glifo: Add basic sanity unit tests for atlas caching#1630

Merged
LaurenzV merged 6 commits into
mainfrom
laurenz/atlas_tests
May 22, 2026
Merged

glifo: Add basic sanity unit tests for atlas caching#1630
LaurenzV merged 6 commits into
mainfrom
laurenz/atlas_tests

Conversation

@LaurenzV
Copy link
Copy Markdown
Collaborator

@LaurenzV LaurenzV commented May 8, 2026

As was evidenced in #1605, it is pretty easy to make changes to the caching logic and then accidentally break the whole caching mechanism.

To hopefully provide some safe-guarding against this, this PR adds 6 unit tests, each ensuring that the different configurations for outline/bitmap/COLR glyphs result in the expected usage of the cache. In case atlas caching is disabled, the cache should stay untouched. In case it's enabled, the glyphs should actually end up landing in the cache.

@LaurenzV LaurenzV requested a review from grebmeg May 8, 2026 07:57
Copy link
Copy Markdown
Collaborator

@grebmeg grebmeg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding tests!

Comment thread glifo/src/glyph.rs
Comment thread glifo/src/glyph.rs
Comment thread glifo/src/glyph.rs
fn bitmap_glyph_is_not_cached_when_atlas_cache_is_disabled() {
ensure_no_cache(TestGlyphKind::Bitmap);
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it’s worth adding tests for stroke outlines to verify that they are not cached, regardless of whether caching is enabled or disabled?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@laurenz-canva laurenz-canva force-pushed the laurenz/atlas_tests branch from 5ad5ec1 to c9669e5 Compare May 22, 2026 05:57
@LaurenzV LaurenzV enabled auto-merge May 22, 2026 17:43
@LaurenzV LaurenzV added this pull request to the merge queue May 22, 2026
Merged via the queue into main with commit d087856 May 22, 2026
17 checks passed
@LaurenzV LaurenzV deleted the laurenz/atlas_tests branch May 22, 2026 18:06
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