Skip to content

Commit

Permalink
Update tests to match new translation behavior
Browse files Browse the repository at this point in the history
Feels kind of silly testing behavior that's just "match the coordinates and flip the Y," but then again, the scale is worth testing.
  • Loading branch information
Koopa1018 committed Jan 16, 2024
1 parent 985e9b7 commit a7a3de0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,22 +463,22 @@ mod tests {
};
let result =
calculate_transform_from_entity_instance(&entity_instance, &entity_definition_map, 320);
assert_eq!(result, Transform::from_xyz(272., 48., 0.));
assert_eq!(result, Transform::from_xyz(256., 64., 0.));

// difficult case
let entity_instance = EntityInstance {
px: IVec2::new(40, 50),
def_uid: 2,
width: 30,
height: 50,
def_uid: 2, // default size: (10, 25)
width: 30, // spawned with triple size on X
height: 50, // double size on Y
pivot: Vec2::new(1., 1.),
..Default::default()
};
let result =
calculate_transform_from_entity_instance(&entity_instance, &entity_definition_map, 100);
assert_eq!(
result,
Transform::from_xyz(25., 75., 0.).with_scale(Vec3::new(3., 2., 1.))
Transform::from_xyz(40., 50., 0.).with_scale(Vec3::new(3., 2., 1.))
);
}

Expand Down Expand Up @@ -518,7 +518,7 @@ mod tests {
calculate_transform_from_entity_instance(&entity_instance, &entity_definition_map, 100);
assert_eq!(
result,
Transform::from_xyz(32., 68., 0.).with_scale(Vec3::new(4., 2., 1.))
Transform::from_xyz(64., 36., 0.).with_scale(Vec3::new(4., 2., 1.))
);
}

Expand Down

0 comments on commit a7a3de0

Please sign in to comment.