-- #114: launcher must restore the arrow cursor when leaving for boot. -- Self-contained: `luajit tests/rom_importer_cursor_test.lua`; also dofile'd -- by tests/run_tests.lua. package.path = "./?.lua;./?/init.lua;" .. package.path if not _G.love then _G.love = require("tests.love_stub") end local S = require("tests.harness").suite("rom importer cursor") local eq = S.eq local currentCursor = "arrow" love.mouse.isCursorSupported = function() return true end love.mouse.getSystemCursor = function(name) return name end love.mouse.setCursor = function(c) currentCursor = c or "arrow" end local RomImporter = require("src.import.RomImporter") local booted = nil local ri = setmetatable({ android = false, workState = nil, ready = { red = true, blue = false }, onComplete = function(version) booted = version end, }, RomImporter) -- Simulate leaving Play while the hand cursor is still active (hover). currentCursor = "hand" ri:play("red") eq(booted, "red", "play boots the chosen version") eq(currentCursor, "arrow", "play restores the arrow cursor before boot") -- Android / unsupported cursors must not error. booted = nil currentCursor = "hand" ri.android = true ri:play("red") eq(booted, "red", "android play still boots") eq(currentCursor, "hand", "android play leaves the cursor alone") booted = nil currentCursor = "hand" ri.android = false ri.arrowCursor = nil love.mouse.getSystemCursor = function() error("CreateSystemCursor is not currently supported") end ri:play("red") eq(booted, "red", "unsupported system cursors still allow boot") eq(currentCursor, "hand", "unsupported system cursors leave the existing cursor alone") -- #781: a host-forwarded real mouse press must win the pointer back from -- the pad cursor. While it is active LauncherView.update refuses to mint -- mouse clicks, so a stuck motion yield (X11 multi-monitor polled coords) -- left the Linux launcher mouse-dead until this reclaim existed. ri._padCursorActive = true ri:mousepressed(10, 10, 1) eq(ri._padCursorActive, false, "mouse press yields the pad cursor (#781)") S.finish()