use retroglyph_core::Rect;
use retroglyph_core::Style;
use crate::Surface;
#[allow(clippy::redundant_pub_crate)]
pub(crate) const TL: char = '┌'; #[allow(clippy::redundant_pub_crate)]
pub(crate) const TR: char = '┐'; #[allow(clippy::redundant_pub_crate)]
pub(crate) const BL: char = '└'; #[allow(clippy::redundant_pub_crate)]
pub(crate) const BR: char = '┘'; #[allow(clippy::redundant_pub_crate)]
pub(crate) const H: char = '─'; #[allow(clippy::redundant_pub_crate)]
pub(crate) const V: char = '│';
pub fn fill_rect(surface: &mut Surface<'_>, rect: Rect, ch: char, style: Style) {
surface.fill_rect(rect, ch, style);
}
#[cfg(test)]
mod tests {
use retroglyph_core::{Grid, Pos};
use super::*;
#[test]
fn fill_rect_overwrites_the_whole_rectangle() {
let area = Rect::new(0, 0, 6, 4);
let rect = Rect::new(1, 1, 4, 2);
let mut grid = Grid::new(6, 4);
fill_rect(
&mut Surface::new(&mut grid, area, 0),
rect,
'#',
Style::new(),
);
for y in 1..3 {
for x in 1..5 {
assert_eq!(grid[Pos::new(x, y)].glyph(), '#');
}
}
assert_eq!(grid[Pos::new(0, 0)].glyph(), ' ');
}
}