mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 21:12:57 -05:00
Tests: the unhinted-face sample test checks hinting is off in both themes
hinting_off turns hinting off in the light and the dark style of a context. The test now reads both styles as well as the global one, so a switch that changes only the current theme fails it.
This commit is contained in:
1 parent
8a1ce23c36
commit
bb4a3fc3d8
1 file changed
+10
-2
@@ -134,12 +134,20 @@ fn a_face_without_hinting_instructions_draws_its_sample() {
|
||||
fixture.settle();
|
||||
let texts = fixture.texts().iter().map(|t| t.text.clone()).collect::<Vec<_>>();
|
||||
let (fixture_has_glyph, nonempty_glyph) = *sample.lock().unwrap();
|
||||
tx.send((texts, fixture.ctx().global_style().visuals.text_options.font_hinting, fixture_has_glyph, nonempty_glyph)).ok()
|
||||
let ctx = fixture.ctx();
|
||||
let hinting = [
|
||||
ctx.global_style().visuals.text_options.font_hinting,
|
||||
ctx.style_of(egui::Theme::Light).visuals.text_options.font_hinting,
|
||||
ctx.style_of(egui::Theme::Dark).visuals.text_options.font_hinting,
|
||||
];
|
||||
tx.send((texts, hinting, fixture_has_glyph, nonempty_glyph)).ok()
|
||||
});
|
||||
let (texts, hinting, fixture_has_glyph, nonempty_glyph) =
|
||||
let (texts, [hinting, light_hinting, dark_hinting], fixture_has_glyph, nonempty_glyph) =
|
||||
rx.recv_timeout(std::time::Duration::from_secs(300)).unwrap_or_else(|e| panic!("drawing the sample: {e}"));
|
||||
assert!(texts.iter().any(|t| t == "\u{5d1}"), "the sample is the letter, in the face: {texts:?}");
|
||||
assert!(!hinting, "a context the app adopts draws text without hinting");
|
||||
assert!(!light_hinting, "the light theme draws text without hinting");
|
||||
assert!(!dark_hinting, "the dark theme draws text without hinting");
|
||||
assert!(fixture_has_glyph, "the sample's face maps U+05D1");
|
||||
assert!(nonempty_glyph, "the sample is one rasterized glyph for U+05D1");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user