Skip to content

Commit

Permalink
fix: termwiz underline color test (#1094)
Browse files Browse the repository at this point in the history
Fixes code that doesn't compile in the termwiz tests when
underline-color feature is enabled.
  • Loading branch information
joshka committed May 11, 2024
1 parent aa4260f commit b30411d
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/backend/termwiz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ mod tests {
}

#[test]
#[cfg(not(feature = "underline-color"))]
fn from_cell_attribute_for_style() {
// default
assert_eq!(
Expand All @@ -599,20 +600,6 @@ mod tests {
),
Style::new().fg(Color::Reset).bg(Color::Indexed(31))
);
// underline color
#[cfg(feature = "underline-color")]
assert_eq!(
Style::from(
CellAttributes::default()
.set_underline_color(AnsiColor::Red)
.set
.to_owned()
),
Style::new()
.fg(Color::Reset)
.bg(Color::Reset)
.underline_color(Color::Red)
);
// underlined
assert_eq!(
Style::from(
Expand Down Expand Up @@ -657,4 +644,21 @@ mod tests {
Style::new().fg(Color::Reset).bg(Color::Reset).hidden()
);
}

#[test]
#[cfg(feature = "underline-color")]
fn from_cell_attributes_with_underline_color() {
// underline color
assert_eq!(
Style::from(
CellAttributes::default()
.set_underline_color(AnsiColor::Red)
.to_owned()
),
Style::new()
.fg(Color::Reset)
.bg(Color::Reset)
.underline_color(Color::Indexed(9))
);
}
}

0 comments on commit b30411d

Please sign in to comment.