use ass_core::{
analysis::styles::resolved_style::ResolvedStyle,
parser::ast::{Span, Style},
};
#[test]
fn test_resolved_style_margin_logic() {
let v4plus_style = Style {
name: "V4Plus",
parent: None,
fontname: "Arial",
fontsize: "20",
primary_colour: "&H00FFFFFF",
secondary_colour: "&H000000FF",
outline_colour: "&H00000000",
back_colour: "&H80000000",
bold: "0",
italic: "0",
underline: "0",
strikeout: "0",
scale_x: "100",
scale_y: "100",
spacing: "0",
angle: "0",
border_style: "1",
outline: "2",
shadow: "0",
alignment: "2",
margin_l: "10",
margin_r: "10",
margin_v: "15",
margin_t: None,
margin_b: None,
encoding: "1",
relative_to: None,
span: Span::new(0, 0, 0, 0),
};
let resolved_v4plus = ResolvedStyle::from_style(&v4plus_style).unwrap();
assert_eq!(resolved_v4plus.margin_l(), 10);
assert_eq!(resolved_v4plus.margin_r(), 10);
assert_eq!(resolved_v4plus.margin_t(), 15); assert_eq!(resolved_v4plus.margin_b(), 15);
let v4plusplus_style = Style {
name: "V4PlusPlus",
parent: None,
fontname: "Arial",
fontsize: "20",
primary_colour: "&H00FFFFFF",
secondary_colour: "&H000000FF",
outline_colour: "&H00000000",
back_colour: "&H80000000",
bold: "0",
italic: "0",
underline: "0",
strikeout: "0",
scale_x: "100",
scale_y: "100",
spacing: "0",
angle: "0",
border_style: "1",
outline: "2",
shadow: "0",
alignment: "2",
margin_l: "10",
margin_r: "10",
margin_v: "0", margin_t: Some("20"),
margin_b: Some("25"),
encoding: "1",
relative_to: Some("1"),
span: Span::new(0, 0, 0, 0),
};
let resolved_v4plusplus = ResolvedStyle::from_style(&v4plusplus_style).unwrap();
assert_eq!(resolved_v4plusplus.margin_l(), 10);
assert_eq!(resolved_v4plusplus.margin_r(), 10);
assert_eq!(resolved_v4plusplus.margin_t(), 20); assert_eq!(resolved_v4plusplus.margin_b(), 25); }