Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] 3eecf55c46 Merge main (e7b67fb0) into the pull request
I resolved the one conflict, in crates/color/src/lib.rs. The default bra

I resolved the one conflict, in crates/color/src/lib.rs. The default branch had moved the whole colour implementation into craft-libs (`pub use craft_drawingml::color::*;`), so I took that side. The pull request's cleanups to the moved code (`channel_from_f64`, the `f32::from`/`f64::from` conversions and the renamed variables) are dropped, because that code is no longer in this repo. Carrying them over would need a craft-libs change. The cleanup of the `hsl_roundtrip` test merged without conflict and is kept. No conflict markers remain. `cargo test` for the color crate passes (7 tests), and `cargo fmt --check` and `cargo clippy --all-targets` are clean.
2026-12-02 19:24:17 +00:00
Cédric Legrand 25ea1eb064 style(color): M14: remove review churn 2026-11-01 23:02:08 +01:00
Cédric Legrand e9dbf10433 refactor(color): clean up pedantic lints for M14 2026-10-31 12:54:57 +01:00
+7 -5
View File
@@ -39,12 +39,14 @@ mod tests {
#[test]
fn hsl_roundtrip() {
for c in [Rgba::rgb(10, 200, 30), Rgba::rgb(255, 0, 0), Rgba::rgb(128, 128, 128), Rgba::rgb(21, 96, 130)] {
let (h, s, l) = c.to_hsl();
let d = Rgba::from_hsl(h, s, l, 255);
for color in [Rgba::rgb(10, 200, 30), Rgba::rgb(255, 0, 0), Rgba::rgb(128, 128, 128), Rgba::rgb(21, 96, 130)] {
let (hue, saturation, lightness) = color.to_hsl();
let converted = Rgba::from_hsl(hue, saturation, lightness, 255);
assert!(
(d.r as i32 - c.r as i32).abs() <= 1 && (d.g as i32 - c.g as i32).abs() <= 1 && (d.b as i32 - c.b as i32).abs() <= 1,
"{c:?} {d:?}"
(i32::from(converted.r) - i32::from(color.r)).abs() <= 1
&& (i32::from(converted.g) - i32::from(color.g)).abs() <= 1
&& (i32::from(converted.b) - i32::from(color.b)).abs() <= 1,
"{color:?} {converted:?}"
);
}
}