diff --git a/tests/regression.rs b/tests/regression.rs index 556cbe8a..0708e7d9 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -1001,6 +1001,25 @@ fn test_draw_text() { } } +#[test] +#[cfg(feature = "text")] +fn test_draw_text_outside_bounds() { + let font_bytes = include_bytes!("data/fonts/DejaVuSans.ttf"); + let font = ab_glyph::FontRef::try_from_slice(font_bytes).unwrap(); + + let background = Luma::black(); + let mut img = GrayImage::from_pixel(300, 300, background); + + let text = "Hello world!"; + let scale = 12.4; + let newline_offset = scale * 1.2; + let (x, y) = (50, 100); + for i in 0..16 { + let y_mod = y + (i as f32 * newline_offset) as i32; + imageproc::drawing::draw_text_mut(&mut img, Luma::white(), x, y_mod, scale, &font, text); + } +} + #[test] #[cfg(feature = "text")] fn test_draw_text_with_alpha() {