diff --git a/tests/stretch-blt-bounds/Graphics/Pictures/OST_009.jxl b/tests/stretch-blt-bounds/Graphics/Pictures/OST_009.jxl new file mode 100644 index 0000000..3d55e0e Binary files /dev/null and b/tests/stretch-blt-bounds/Graphics/Pictures/OST_009.jxl differ diff --git a/tests/stretch-blt-bounds/stretch-blt-test.rb b/tests/stretch-blt-bounds/stretch-blt-test.rb new file mode 100755 index 0000000..4ca7ac0 --- /dev/null +++ b/tests/stretch-blt-bounds/stretch-blt-test.rb @@ -0,0 +1,62 @@ +# Test suite for mkxp-z stretch_blt. +# Copyright 2024 Splendide Imaginarius. +# License GPLv2+. +# Test images are from https://github.com/xinntao/Real-ESRGAN/ +# +# Run the suite via the "customScript" field in mkxp.json. +# Use RGSS v3 for best results. + +def dump(bmp, spr, desc) + spr.bitmap = bmp + Graphics.wait(1) + bmp.to_file("test-results/" + desc + ".png") + System::puts("Finished " + desc) +end + +# Setup graphics +Graphics.resize_screen(1920, 1080) + +# Setup font +fnt = Font.new("Liberation Sans", 100) + +# Setup splash screen +bmp = Bitmap.new(1920, 1080) +bmp.fill_rect(0, 0, 1920, 1080, Color.new(0, 0, 0)) + +bmp.font = fnt +bmp.draw_text(0, 0, 1920, 540, "stretch_blt Test Suite", 1) +bmp.draw_text(0, 540, 1920, 540, "Starting Now", 1) + +spr = Sprite.new() +spr.bitmap = bmp + +Graphics.wait(1 * 60) + +# Tests start here + +foreground = Bitmap.new("Graphics/Pictures/OST_009") +dump(foreground, spr, "foreground") + +background = Bitmap.new(1920, 1080) +background.clear +dump(background, spr, "background") + +composite = background.dup +composite.stretch_blt(Rect.new(0, 0, 1920, 1080), foreground, Rect.new(0, 0, 1920, 1080)) +dump(composite, spr, "composite") + +# Tests are finished, show exit screen + +bmp = Bitmap.new(1920, 1080) +bmp.fill_rect(0, 0, 1920, 1080, Color.new(0, 0, 0)) + +fnt = Font.new("Liberation Sans", 100) + +bmp.font = fnt +bmp.draw_text(0, 0, 1920, 540, "stretch_blt Test Suite", 1) +bmp.draw_text(0, 540, 1920, 540, "Has Finished", 1) +spr.bitmap = bmp + +Graphics.wait(1 * 60) + +exit diff --git a/tests/stretch-blt-bounds/test-results/.RESULTS WILL GO HERE b/tests/stretch-blt-bounds/test-results/.RESULTS WILL GO HERE new file mode 100644 index 0000000..e69de29