mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
a9ce423bdc
CLOSES #1275, CLOSES #1295, CLOSES #1384, CLOSES #1628, CLOSES #1677, CLOSES #1682, CLOSES #1691, CLOSES #1813, CLOSES #1822, CLOSES #1861, CLOSES #1867, CLOSES #1868, CLOSES #1869, CLOSES #1870, CLOSES #1871, CLOSES #1872, CLOSES #1874, CLOSES #1876, CLOSES #1878, CLOSES #1880, CLOSES #1881, CLOSES #1882, CLOSES #1884, CLOSES #1885, CLOSES #1886, CLOSES #1887, CLOSES #1888, CLOSES #1889, CLOSES #1890, CLOSES #1891, CLOSES #1892, CLOSES #1893, CLOSES #1894, CLOSES #1895, CLOSES #1896, CLOSES #1899, CLOSES #1900, CLOSES #1901
90 lines
2.9 KiB
Lua
90 lines
2.9 KiB
Lua
-- engine/events/halloffame.asm:270 (#1869)
|
|
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
love = require("tests.love_stub")
|
|
|
|
local T = require("tests.harness")
|
|
local G = love.graphics
|
|
|
|
local scissors = {}
|
|
G.intersectScissor = nil
|
|
G.setScissor = function(x, y, w, h)
|
|
scissors[#scissors + 1] = { x = x, y = y, w = w, h = h }
|
|
end
|
|
|
|
local Chrome = require("src.ui.gen2.Chrome")
|
|
|
|
local WIN_W, WIN_H = 1280, 840
|
|
local PANEL_W, PANEL_H = Chrome.SCREEN_W * 8, Chrome.SCREEN_H * 8
|
|
|
|
local function only(label)
|
|
T.eq(#scissors, 1, label .. " sets exactly one scissor")
|
|
local rect = scissors[1]
|
|
scissors = {}
|
|
return rect or {}
|
|
end
|
|
|
|
local function checkPanel(label, scale)
|
|
local rect = only(label)
|
|
local ox, oy = Chrome.fitOrigin(WIN_W, WIN_H, scale)
|
|
T.eq(rect.x, ox, label .. " clips from the panel's own origin x")
|
|
T.eq(rect.y, oy, label .. " clips from the panel's own origin y")
|
|
T.eq(rect.w, PANEL_W * scale, label .. " clips to the scaled panel width")
|
|
T.eq(rect.h, PANEL_H * scale, label .. " clips to the scaled panel height")
|
|
end
|
|
|
|
do
|
|
local scale = Chrome.fitScale(WIN_W, WIN_H)
|
|
T.check(scale >= 1, "1280x840 fits at least one whole GB pixel per window pixel")
|
|
local drew = false
|
|
Chrome.withPanel(WIN_W, WIN_H, 0, 0, 0, function() drew = true end)
|
|
T.eq(drew, true, "Chrome.withPanel runs the panel body")
|
|
checkPanel("Chrome.withPanel", scale)
|
|
|
|
Chrome.withPanel(WIN_W, WIN_H, 1, 1, 1, function() end, 3)
|
|
checkPanel("an explicit panel scale", 3)
|
|
|
|
drew = false
|
|
Chrome.withClip(function() drew = true end)
|
|
T.eq(drew, true, "Chrome.withClip runs the panel body")
|
|
local rect = only("Chrome.withClip")
|
|
T.eq(rect.x, 0, "the 1:1 clip starts at the panel origin")
|
|
T.eq(rect.y, 0, "on both axes")
|
|
T.eq(rect.w, PANEL_W, "and is 160 wide")
|
|
T.eq(rect.h, PANEL_H, "by 144 tall")
|
|
end
|
|
|
|
do
|
|
local HallOfFame = require("src.ui.gen2.HallOfFame")
|
|
local hof = setmetatable({ drawPanel = function() end },
|
|
{ __index = HallOfFame })
|
|
hof:drawWidescreen(WIN_W, WIN_H)
|
|
checkPanel("HallOfFame:drawWidescreen", Chrome.fitScale(WIN_W, WIN_H))
|
|
hof:draw()
|
|
T.eq(only("HallOfFame:draw").w, PANEL_W, "and its 1:1 draw clips to the LCD")
|
|
end
|
|
|
|
do
|
|
local Credits = require("src.ui.gen2.Credits")
|
|
local credits = setmetatable({ drawPanel = function() end },
|
|
{ __index = Credits })
|
|
credits:drawWidescreen(WIN_W, WIN_H)
|
|
checkPanel("Credits:drawWidescreen", Chrome.fitScale(WIN_W, WIN_H))
|
|
credits:draw()
|
|
T.eq(only("Credits:draw").w, PANEL_W, "and its 1:1 draw clips to the LCD")
|
|
end
|
|
|
|
do
|
|
local BattleState = require("src.ui.gen2.BattleState")
|
|
local battle = setmetatable({ drawScene = function() end },
|
|
{ __index = BattleState })
|
|
local scale = battle:battlePanelScale(WIN_W, WIN_H)
|
|
battle:drawWidescreen(WIN_W, WIN_H)
|
|
checkPanel("BattleState:drawWidescreen", scale)
|
|
battle:draw()
|
|
T.eq(only("BattleState:draw").w, PANEL_W, "and its 1:1 draw clips to the LCD")
|
|
end
|
|
|
|
T.finish("gen2 widescreen clip bug 1869")
|