css_ast/types/
stroke_layer.rs1use super::prelude::*;
2use crate::{Color, FillOrigin, Paint, PositionAndSize, RepeatStyle};
3use css_parse::Box;
4
5#[node]
16#[derive(Parse, Peek, ToCursors, ToSpan, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
17#[parse(all_must_occur)]
18#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
19#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit)]
20#[derive(csskit_derives::NodeWithMetadata)]
21pub struct StrokeLayer<'a> {
22 pub image: Option<Paint<'a>>,
23 pub position: Option<Box<'a, PositionAndSize<'a>>>,
24 pub repeat: Option<RepeatStyle>,
25 pub origin: Option<FillOrigin>,
26 pub color: Option<Color<'a>>,
27}
28
29#[cfg(test)]
30mod tests {
31 use super::*;
32 use crate::CssAtomSet;
33 use css_parse::{assert_parse, assert_peek_false};
34
35 #[test]
36 fn test_writes() {
37 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "none");
38 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "url(foo.svg)");
39 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "currentcolor");
40 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "center");
41 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "center / cover");
42 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "repeat-x");
43 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "stroke-box");
44 assert_parse!(CssAtomSet::ATOMS, StrokeLayer, "url(foo.svg) center no-repeat stroke-box red");
45 }
46
47 #[test]
48 fn test_errors() {
49 assert_peek_false!(CssAtomSet::ATOMS, StrokeLayer, "");
50 }
51}