docx_rust/formatting/border/
right_border.rs1use hard_xml::{XmlRead, XmlWrite};
2use std::borrow::Cow;
3
4use crate::{__setter, __xml_test_suites, formatting::BorderStyle};
5
6#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
7#[cfg_attr(test, derive(PartialEq))]
8#[xml(tag = "w:right")]
9pub struct RightBorder<'a> {
10 #[xml(attr = "w:val")]
11 pub style: super::BorderStyle,
12 #[xml(attr = "w:color")]
13 pub color: Option<Cow<'a, str>>,
14 #[xml(attr = "w:themeColor")]
15 pub theme_color: Option<crate::formatting::ThemeColor>,
16 #[xml(attr = "w:themeTint")]
17 pub theme_tint: Option<Cow<'a, str>>,
18 #[xml(attr = "w:themeShade")]
19 pub theme_shade: Option<Cow<'a, str>>,
20 #[xml(attr = "w:sz")]
21 pub size: Option<isize>, #[xml(attr = "w:space")]
23 pub space: Option<isize>,
24 #[xml(attr = "w:shadow")]
25 pub shadow: Option<bool>,
26 #[xml(attr = "w:frame")]
27 pub frame: Option<bool>,
28}
29
30impl<'a> RightBorder<'a> {
31 __setter!(color: Option<Cow<'a, str>>);
32 __setter!(shadow: Option<bool>);
33 __setter!(space: Option<isize>);
34 __setter!(size: Option<isize>);
35 __setter!(style: BorderStyle);
36}
37
38__xml_test_suites!(
39 RightBorder,
40 RightBorder::default(),
41 r#"<w:right w:val="none"/>"#,
42 RightBorder::default().color("000000"),
43 r#"<w:right w:val="none" w:color="000000"/>"#,
44 RightBorder::default().shadow(false),
45 r#"<w:right w:val="none" w:shadow="false"/>"#,
46 RightBorder::default().space(40isize),
47 r#"<w:right w:val="none" w:space="40"/>"#,
48 RightBorder::default().size(20isize),
49 r#"<w:right w:val="none" w:sz="20"/>"#,
50 RightBorder::default().style(BorderStyle::Dotted),
51 r#"<w:right w:val="dotted"/>"#,
52);