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)); } }