diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-21 19:08:47 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-21 19:08:47 +0200 |
| commit | c0377de653ed7c0ae0e253724cbbb622125fbd3f (patch) | |
| tree | d69237f632084f07ce04e6d877cdea451a03f295 /tests | |
| parent | 0dd4ae0a7ac0c247078df492469ff20b8a90c886 (diff) | |
Shorter/clearer field name for geometry types
Size { width, height } => Size { w, h }
Spec { horizontal, vertical } => Spec { x, y }
Gen { cross, main } => Gen { inline, block }
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typeset.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/typeset.rs b/tests/typeset.rs index a14bafaf..ac5ab9e4 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -380,9 +380,8 @@ fn print_error(source: &SourceFile, line: usize, error: &Error) { fn draw(ctx: &Context, frames: &[Rc<Frame>], dpi: f32) -> sk::Pixmap { let pad = Length::pt(5.0); - - let height = pad + frames.iter().map(|l| l.size.height + pad).sum::<Length>(); - let width = 2.0 * pad + frames.iter().map(|l| l.size.width).max().unwrap_or_default(); + let width = 2.0 * pad + frames.iter().map(|l| l.size.w).max().unwrap_or_default(); + let height = pad + frames.iter().map(|l| l.size.h + pad).sum::<Length>(); let pixel_width = (dpi * width.to_pt() as f32) as u32; let pixel_height = (dpi * height.to_pt() as f32) as u32; @@ -405,8 +404,8 @@ fn draw(ctx: &Context, frames: &[Rc<Frame>], dpi: f32) -> sk::Pixmap { sk::Rect::from_xywh( origin.x.to_pt() as f32, origin.y.to_pt() as f32, - frame.size.width.to_pt() as f32, - frame.size.height.to_pt() as f32, + frame.size.w.to_pt() as f32, + frame.size.h.to_pt() as f32, ) .unwrap(), &paint, @@ -432,7 +431,7 @@ fn draw(ctx: &Context, frames: &[Rc<Frame>], dpi: f32) -> sk::Pixmap { } } - origin.y += frame.size.height + pad; + origin.y += frame.size.h + pad; } canvas @@ -496,7 +495,7 @@ fn draw_geometry( let rule = sk::FillRule::default(); match *geometry { - Geometry::Rect(Size { width, height }) => { + Geometry::Rect(Size { w: width, h: height }) => { let w = width.to_pt() as f32; let h = height.to_pt() as f32; let rect = sk::Rect::from_xywh(0.0, 0.0, w, h).unwrap(); @@ -539,8 +538,8 @@ fn draw_image( *dest = sk::ColorU8::from_rgba(r, g, b, a).premultiply(); } - let view_width = size.width.to_pt() as f32; - let view_height = size.height.to_pt() as f32; + let view_width = size.w.to_pt() as f32; + let view_height = size.h.to_pt() as f32; let scale_x = view_width as f32 / pixmap.width() as f32; let scale_y = view_height as f32 / pixmap.height() as f32; |
