mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-28 17:19:31 +01:00
style: format SVG acceptance test source
This commit is contained in:
1 parent
2cd16209af
commit
0cdf704bdf
1 file changed
+10
-3
@@ -108,7 +108,11 @@ fn a_superscript_sits_above_the_line_and_runs_wrap_across() {
|
||||
assert!(t.box_width < before.box_width - 5.0, "{} vs {}", t.box_width, before.box_width);
|
||||
assert!(t.outline.bounds().min.y <= before.outline.bounds().min.y + 0.5);
|
||||
// Wrapping across runs: a width that fits two words per line.
|
||||
run(&mut s, "text.edit", json!({"text": "one two three four five", "width": 180, "runs": [{"chars": 8, "size": 30}, {"chars": 15, "size": 60, "color": "#0000ff"}]}));
|
||||
run(
|
||||
&mut s,
|
||||
"text.edit",
|
||||
json!({"text": "one two three four five", "width": 180, "runs": [{"chars": 8, "size": 30}, {"chars": 15, "size": 60, "color": "#0000ff"}]}),
|
||||
);
|
||||
let w = text_of(&s, id);
|
||||
assert!(w.box_height > 150.0, "several lines: {}", w.box_height);
|
||||
assert!(w.outline.bounds().max.x <= 182.0, "{:?}", w.outline.bounds());
|
||||
@@ -121,7 +125,9 @@ fn paragraphs_take_their_own_alignment_indent_and_margins() {
|
||||
return;
|
||||
}
|
||||
let mut s = Session::default();
|
||||
let id = ElementId(run(&mut s, "text.create", json!({"text": "Title\nbody text", "x": 0, "y": 0, "size": 30, "width": 400}))["element"].as_u64().unwrap());
|
||||
let id = ElementId(
|
||||
run(&mut s, "text.create", json!({"text": "Title\nbody text", "x": 0, "y": 0, "size": 30, "width": 400}))["element"].as_u64().unwrap(),
|
||||
);
|
||||
run(&mut s, "text.paragraph", json!({"start": 0, "end": 0, "align": "center"}));
|
||||
let t = text_of(&s, id);
|
||||
assert_eq!(t.paragraphs.iter().map(|p| p.align).collect::<Vec<_>>(), vec![TextAlign::Center, TextAlign::Left]);
|
||||
@@ -247,7 +253,8 @@ fn svg_links_are_sanitized_and_round_trip_without_changing_the_drawing() {
|
||||
("da\nta:text/plain,hello", None),
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate() {
|
||||
.enumerate()
|
||||
{
|
||||
dl.links = vec![(0, url.into())];
|
||||
let svg = anicraft_render::svg::to_svg(&dl, &s.doc.stage);
|
||||
let root = anicraft_xml::parse(svg.as_bytes()).unwrap();
|
||||
|
||||
Reference in new issue
Block a user