diff --git a/src/soc/peripheral/gpu.rs b/src/soc/peripheral/gpu.rs index 178620f..50c1649 100644 --- a/src/soc/peripheral/gpu.rs +++ b/src/soc/peripheral/gpu.rs @@ -1079,103 +1079,4 @@ mod gpu_tests { assert_eq!(gpu.object_palette_1.color_1, PixelColor::WHITE); assert_eq!(gpu.object_palette_1.color_0, PixelColor::DARK_GRAY); } - - #[test] - fn test_draw_big_sprite() { - let mut gpu = Gpu::new(); - - // init GPU - gpu.object_display_enabled = true; - gpu.object_size = ObjectSize::OS8X16; - - // init VRAM - // here we're looking for tile at index 0 - gpu.write_vram(0x0010, 0x7F); - gpu.write_vram(0x0011, 0xFF); - gpu.write_vram(0x0012, 0xFF); - gpu.write_vram(0x0013, 0xFE); - - // set OAM - // set y position - gpu.write_oam(0x0000, 0x10); - // set x position - gpu.write_oam(0x0001, 0x08); - // set tile index - gpu.write_oam(0x0002, 0x01); - // set attributes - gpu.write_oam(0x0003, 0x00); - - // draw the line in the frame buffer - gpu.current_line = 0; - gpu.draw_line(); - gpu.current_line = 1; - gpu.draw_line(); - - // check frame buffer - // line 1 * 160 = 160 / 0x00A0 - assert_eq!(gpu.frame_buffer[0x0000], PixelColor::DARK_GRAY as u8); - assert_eq!(gpu.frame_buffer[0x00A7], PixelColor::LIGHT_GRAY as u8); - - // shift sprite y position for 31 lines down - // set y position - gpu.write_oam(0x0000, 0x2F); - - // draw the line in the frame buffer - gpu.current_line = 31; - gpu.draw_line(); - gpu.current_line = 32; - gpu.draw_line(); - - // check frame buffer - // line 31 * 160 = 4960 / 0x1360 - assert_eq!(gpu.frame_buffer[0x1360], PixelColor::DARK_GRAY as u8); - // line 32 * 160 = 5120 / 0x1400 - assert_eq!(gpu.frame_buffer[0x1407], PixelColor::LIGHT_GRAY as u8); - - // shift sprite x position for 3 columns right - // set y position - gpu.write_oam(0x0001, 0x0B); - - // draw the line in the frame buffer - gpu.current_line = 31; - gpu.draw_line(); - gpu.current_line = 32; - gpu.draw_line(); - - // check frame buffer - // line 31 * 160 = 4960 / 0x1360 - assert_eq!(gpu.frame_buffer[0x1363], PixelColor::DARK_GRAY as u8); - // line 32 * 160 = 5120 / 0x1400 - assert_eq!(gpu.frame_buffer[0x140A], PixelColor::LIGHT_GRAY as u8); - } - - #[test] - fn test_draw_window() { - let mut gpu = Gpu::new(); - - // init GPU - gpu.window_display_enabled = true; - gpu.background_display_enabled = true; - gpu.window_tile_map_area = TileMapArea::X9800; - gpu.background_tile_data_area = true; - gpu.current_line = 0; // first line of the second tile row - - // init VRAM - // here we're looking for tile at index 0 - gpu.write_vram(0x0000, 0x01); - gpu.write_vram(0x0001, 0x00); - - // set tile map - // here we're looking for tile at index 0 - gpu.write_vram(0x1800, 0x00); - - // draw the line in the frame buffer - gpu.window_x_offset = 0; - gpu.draw_line(); - assert_eq!(gpu.frame_buffer[0x0000], PixelColor::LIGHT_GRAY as u8); - - gpu.window_x_offset = 128; - gpu.draw_line(); - assert_eq!(gpu.frame_buffer[0x0080], PixelColor::LIGHT_GRAY as u8); - } } \ No newline at end of file