Skip to content

Commit

Permalink
[dessin-dioxus] Add none to fill
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierLemoine committed Feb 26, 2025
1 parent a35ed71 commit 772deeb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
20 changes: 11 additions & 9 deletions dessin-dioxus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,17 @@ fn Shaper(
stroke,
shape,
} => {
let fill = fill.map(|color| {
format!(
"rgb({} {} {} / {:.3})",
(color.red * 255.) as u32,
(color.green * 255.) as u32,
(color.blue * 255.) as u32,
color.alpha
)
});
let fill = fill
.map(|color| {
format!(
"rgb({} {} {} / {:.3})",
(color.red * 255.) as u32,
(color.green * 255.) as u32,
(color.blue * 255.) as u32,
color.alpha
)
})
.unwrap_or_else(|| "none".to_string());

let (stroke, stroke_width, stroke_dasharray) = match stroke {
Some(Stroke::Dashed {
Expand Down
4 changes: 4 additions & 0 deletions dessin-macros/src/dessin_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ fn simple_with_style() {
syn::parse_str::<Dessin>("*Item()").unwrap();
}
#[test]
fn simple_with_style_and_generic() {
syn::parse_str::<Dessin>("*Item<GenA, GenB<GenC>>()").unwrap();
}
#[test]
fn complex_with_style() {
syn::parse_str::<Dessin>("*Item() > *()").unwrap();
}
Expand Down
5 changes: 5 additions & 0 deletions dessin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ pub mod font {
mod tests {
use crate::prelude::{polygons::Octogon, *};

#[test]
fn types_funkyness() {
dessin2!(Padding<Shape>(shape = dessin2!(Line() > ())) > *());
}

#[test]
fn erased_type() {
#[derive(Default)]
Expand Down

0 comments on commit 772deeb

Please sign in to comment.