more merge testing

This commit is contained in:
Max Bradbury 2020-06-28 17:46:46 +01:00
parent 4c47de406e
commit ed21ca4a2b
1 changed files with 13 additions and 0 deletions

View File

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