Paint framed colorbox backgrounds
This commit is contained in:
1 parent
d88e74cd29
commit
2018e5f8b8
8 files changed
+240
-62
No files matched your search
@@ -6614,6 +6614,7 @@ mod tests {
|
||||
65_536 * 10,
|
||||
0,
|
||||
[0, 255, 0],
|
||||
None,
|
||||
"Boxed".into(),
|
||||
)];
|
||||
let style = crate::paragraph::ParagraphStyle {
|
||||
@@ -6642,6 +6643,44 @@ mod tests {
|
||||
assert!(rect.1 > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn framed_color_boxes_paint_a_frame() {
|
||||
let segments = vec![crate::paragraph::InlineSegment::ColorBox(
|
||||
ParagraphFont::Roman,
|
||||
65_536 * 10,
|
||||
0,
|
||||
[0, 255, 0],
|
||||
Some([255, 0, 0]),
|
||||
"Framed".into(),
|
||||
)];
|
||||
let style = crate::paragraph::ParagraphStyle {
|
||||
line_width: 480 * 65_536,
|
||||
..crate::paragraph::ParagraphStyle::default()
|
||||
};
|
||||
let unit = Unit::paragraph_with_style_and_segments(1, "Framed", style, segments);
|
||||
let page = Page {
|
||||
items: unit.items,
|
||||
insertions: Vec::new(),
|
||||
marks: Vec::new(),
|
||||
floats: Vec::new(),
|
||||
sources: Vec::new(),
|
||||
hash: 0,
|
||||
};
|
||||
let list = page.display_list();
|
||||
let frame = list
|
||||
.items
|
||||
.iter()
|
||||
.find_map(|item| match item {
|
||||
crate::render::DisplayItem::Frame {
|
||||
color, thickness, ..
|
||||
} => Some((*color, *thickness)),
|
||||
_ => None,
|
||||
})
|
||||
.expect("frame");
|
||||
assert_eq!(frame.0, [255, 0, 0]);
|
||||
assert!(frame.1 > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sized_paragraphs_paint_at_their_font_size() {
|
||||
let style = crate::paragraph::ParagraphStyle {
|
||||
|
||||
Reference in new issue
Block a user