From 92e71a9fce72e9d60468e6a411ddd33400ed9be6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 1 Nov 2026 08:49:19 -0800 Subject: [PATCH] Type: test that the four anti-aliasing methods draw the same text four different ways --- crates/render/src/tests/typeedges.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/render/src/tests/typeedges.rs b/crates/render/src/tests/typeedges.rs index f1fb75458..0d2b91053 100644 --- a/crates/render/src/tests/typeedges.rs +++ b/crates/render/src/tests/typeedges.rs @@ -77,6 +77,14 @@ fn each_method_draws_the_share_of_each_pixel_it_defines() { assert!(wrong.is_empty(), "{m:?}: (pixel, Sharp, drawn) {wrong:?}"); } assert_eq!(partial(&alphas(&page(TypeAntiAlias::None, None), &opts)), 0, "None paints whole pixels"); + // The same text drawn with each of the four methods gives four different pictures. + let methods = [TypeAntiAlias::None, TypeAntiAlias::Sharp, TypeAntiAlias::Crisp, TypeAntiAlias::Strong]; + let drawn: Vec> = methods.iter().map(|m| alphas(&page(*m, None), &opts)).collect(); + for (i, a) in drawn.iter().enumerate() { + for (j, b) in drawn.iter().enumerate().skip(i + 1) { + assert_ne!(a, b, "{:?} and {:?} draw alike", methods[i], methods[j]); + } + } } /// `edge_coverage` gives each method the share its documentation defines: None shows all of a