Skip to content

Commit

Permalink
Add tests for shape size
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 2, 2025
1 parent 64f0775 commit 65fbce1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/epaint/src/shapes/rect_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ pub struct RectShape {
pub uv: Rect,
}

#[test]
fn rect_shape_size() {
assert_eq!(
std::mem::size_of::<RectShape>(), 72,
"RectShape changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
);
}

impl RectShape {
/// The stroke extends _outside_ the [`Rect`].
#[inline]
Expand Down
8 changes: 8 additions & 0 deletions crates/epaint/src/shapes/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ pub enum Shape {
Callback(PaintCallback),
}

#[test]
fn shape_size() {
assert_eq!(
std::mem::size_of::<Shape>(), 72,
"Shape changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
);
}

#[test]
fn shape_impl_send_sync() {
fn assert_send_sync<T: Send + Sync>() {}
Expand Down

0 comments on commit 65fbce1

Please sign in to comment.