From ed21ca4a2bd0677a7fc65c22caec9643425f63ea Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 28 Jun 2020 17:46:46 +0100 Subject: [PATCH] more merge testing --- src/game.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/game.rs b/src/game.rs index 82b6ebd..06d8226 100644 --- a/src/game.rs +++ b/src/game.rs @@ -802,6 +802,7 @@ mod test { use crate::game::{Version, Game}; use crate::text::{TextDirection, Font}; use crate::tile::Tile; + use crate::room::Room; #[test] fn test_game_from_string() { @@ -920,5 +921,17 @@ mod test { game.get_room_by_id("1".to_string()).unwrap().palette_id, Some("1".to_string()) ); + + // test sprites in non-zero rooms in merged game + let mut game_a = crate::mock::game_default(); + let mut game_b = crate::mock::game_default(); + let mut room = crate::mock::room(); + let mut sprite = crate::mock::sprite(); + let room_id = "2".to_string(); + room.id = room_id.clone(); + sprite.room_id = Some(room_id.clone()); + game_b.add_sprite(sprite); + game_a.merge(game_b); + assert_eq!(game_a.get_sprite_by_id("2".to_string()).unwrap().room_id, Some(room_id)); } }