mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-31 15:48:18 +00:00
Preserve explicit bullets over follow-text resets
This commit is contained in:
1 parent
f5c2aca644
commit
0e3f4cd353
2 files changed
+29
-3
No files matched your search
@@ -554,19 +554,19 @@ pub fn ppr(w: &mut W, x: &mut Exp, o: &mut Out, tag: &str, level: Option<u8>, p:
|
||||
if let Some(s) = &p.space_after {
|
||||
spacing(w, "a:spcAft", s);
|
||||
}
|
||||
if p.bullet_color_follow_text == Some(true) {
|
||||
if p.bullet_color.is_none() && p.bullet_color_follow_text == Some(true) {
|
||||
w.empty0("a:buClrTx");
|
||||
} else if let Some(c) = &p.bullet_color {
|
||||
w.open0("a:buClr");
|
||||
color(w, c);
|
||||
w.close("a:buClr");
|
||||
}
|
||||
if p.bullet_size_follow_text == Some(true) {
|
||||
if p.bullet_size.is_none() && p.bullet_size_follow_text == Some(true) {
|
||||
w.empty0("a:buSzTx");
|
||||
} else if let Some(s) = p.bullet_size {
|
||||
w.val("a:buSzPct", pct(s.clamp(0.25, 4.0)));
|
||||
}
|
||||
if p.bullet_font_follow_text == Some(true) {
|
||||
if p.bullet_font.is_none() && p.bullet_font_follow_text == Some(true) {
|
||||
w.empty0("a:buFontTx");
|
||||
} else if let Some(f) = &p.bullet_font {
|
||||
w.empty("a:buFont", A::new().a("typeface", f));
|
||||
|
||||
@@ -507,12 +507,38 @@ fn bullet_follow_text_resets_survive_two_pptx_round_trips() {
|
||||
..Default::default()
|
||||
});
|
||||
Arc::make_mut(&mut p.slides[0]).shapes.push(textbox);
|
||||
let mut conflicting = shape(&mut p, "Explicit bullet values", 20.0, 140.0, 400.0, 100.0);
|
||||
conflicting.text = Some(TextBody {
|
||||
paragraphs: vec![Paragraph {
|
||||
props: deckcraft_model::text::ParaProps {
|
||||
bullet: Some(Bullet::Char { char: "•".into() }),
|
||||
bullet_color: Some(deckcraft_model::style::ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0))),
|
||||
bullet_color_follow_text: Some(true),
|
||||
bullet_size: Some(1.5),
|
||||
bullet_size_follow_text: Some(true),
|
||||
bullet_font: Some("Inter".into()),
|
||||
bullet_font_follow_text: Some(true),
|
||||
..Default::default()
|
||||
},
|
||||
runs: vec![Run::with("Explicit bullet text", RunProps::default())],
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
});
|
||||
Arc::make_mut(&mut p.slides[0]).shapes.push(conflicting);
|
||||
|
||||
let q = round(&round(&p));
|
||||
let props = &by_name(&q.slides[0], "Follow text bullets").text.as_ref().expect("text").paragraphs[0].props;
|
||||
assert_eq!(props.bullet_color_follow_text, Some(true));
|
||||
assert_eq!(props.bullet_size_follow_text, Some(true));
|
||||
assert_eq!(props.bullet_font_follow_text, Some(true));
|
||||
let explicit = &by_name(&q.slides[0], "Explicit bullet values").text.as_ref().expect("text").paragraphs[0].props;
|
||||
assert_eq!(explicit.bullet_color_follow_text, None);
|
||||
assert_eq!(explicit.bullet_size_follow_text, None);
|
||||
assert_eq!(explicit.bullet_font_follow_text, None);
|
||||
assert_eq!(explicit.bullet_size, Some(1.5));
|
||||
assert_eq!(explicit.bullet_font.as_deref(), Some("Inter"));
|
||||
assert_eq!(explicit.bullet_color, Some(deckcraft_model::style::ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user