Skip to content

Commit

Permalink
test: refactor font handling in tests
Browse files Browse the repository at this point in the history
- remove `#[cfg_attr(target_os = "windows", ignore)]` from the `parley_line_breaking_and_font_fallback` test
- update the `lines` vector in the `font_styles` test function
- add a conditional block for `lines` vector when not on `windows` in `font_styles` function
  • Loading branch information
falcucci committed Sep 20, 2024
1 parent 48d1e6c commit f7dfabd
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ fn text_layout_bounds() {
assert_no_regressions(325, 35, scene);
}

#[cfg_attr(target_os = "windows", ignore)]
#[test]
fn parley_line_breaking_and_font_fallback() {
let mut scene = Scene::new();
Expand Down Expand Up @@ -312,7 +311,7 @@ fn font_styles() {
synthesis: Synthesis,
}

let lines = vec![
let mut lines = vec![
(
"FiraCode Normal",
vec![StyleProperty::FontStack(FontStack::Source(
Expand Down Expand Up @@ -424,22 +423,6 @@ fn font_styles() {
},
},
),
(
"CaskaydiaCove Nerd Font Italic",
vec![
StyleProperty::FontStack(FontStack::Source("CaskaydiaCove Nerd Font")),
StyleProperty::FontStyle(FontStyle::Italic),
],
Expected {
fullname: "CaskaydiaCove NF Italic".into(),
attributes: Attributes::new(Stretch::NORMAL, Weight::NORMAL, Style::Italic),
synthesis: Synthesis {
vars: vec![],
embolden: false,
skew: 0.0.into(),
},
},
),
(
"Monaspace Xenon Var",
vec![StyleProperty::FontStack(FontStack::Source(
Expand Down Expand Up @@ -663,6 +646,25 @@ fn font_styles() {
},
),
];

#[cfg(not(target_os = "windows"))]
lines.push((
"CaskaydiaCove Nerd Font Italic",
vec![
StyleProperty::FontStack(FontStack::Source("CaskaydiaCove Nerd Font")),
StyleProperty::FontStyle(FontStyle::Italic),
],
Expected {
fullname: "CaskaydiaCove NF Italic".into(),
attributes: Attributes::new(Stretch::NORMAL, Weight::NORMAL, Style::Italic),
synthesis: Synthesis {
vars: vec![],
embolden: false,
skew: 0.0.into(),
},
},
));

let layout = shaper.layout_within_with(
&lines
.iter()
Expand Down

0 comments on commit f7dfabd

Please sign in to comment.