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JEOF5GCHCRKEBGC3FQN7AYETY7LKEJUXVIQAB4QPEPYQC
JF5L2BBS7ESMKHNGKLXI2F32GZKET2ICJ4KT2L5BMH3P2L2Y5MRAC
-- have LÖVE delegate all handlers to App if they exist
for name in pairs(love.handlers) do
if App[name] then
love.handlers[name] = App[name]
end
end
-- Stash current state of App for tests
App_for_tests = {}
for k,v in pairs(App) do
App_for_tests[k] = v
end
-- there's one nested table
App_for_tests.screen = {}
for k,v in pairs(App.screen) do
App_for_tests.screen[k] = v
end
-- Mutate App for the real app
-- disable test methods
App.screen.init = nil
App.filesystem = nil
App.time = nil
App.run_after_textinput = nil
App.run_after_keychord = nil
App.keypress = nil
App.keyrelease = nil
App.run_after_mouse_click = nil
App.run_after_mouse_press = nil
App.run_after_mouse_release = nil
App.fake_keys_pressed = nil
App.fake_key_press = nil
App.fake_key_release = nil
App.fake_mouse_state = nil
App.fake_mouse_press = nil
App.fake_mouse_release = nil
-- dispatch some methods to real hardware
App.screen.resize = love.window.setMode
App.screen.size = love.window.getMode
App.screen.move = love.window.setPosition
App.screen.position = love.window.getPosition
App.screen.print = love.graphics.print
App.newText = love.graphics.newText
App.screen.draw = love.graphics.draw
App.width = function(text) return text:getWidth() end
App.open_for_reading = function(filename) return io.open(filename, 'r') end
App.open_for_writing = function(filename) return io.open(filename, 'w') end
App.getTime = love.timer.getTime
App.getClipboardText = love.system.getClipboardText
App.setClipboardText = love.system.setClipboardText
App.modifier_down = love.keyboard.isDown
App.mouse_move = love.mouse.setPosition
App.mouse_down = love.mouse.isDown
App.mouse_x = love.mouse.getX
App.mouse_y = love.mouse.getY
-- call this once all tests are run
-- can't run any tests after this
function App.disable_tests()
-- have LÖVE delegate all handlers to App if they exist
for name in pairs(love.handlers) do
if App[name] then
love.handlers[name] = App[name]
end
end
-- test methods are disallowed outside tests
App.run_tests = nil
App.disable_tests = nil
App.screen.init = nil
App.filesystem = nil
App.time = nil
App.run_after_textinput = nil
App.run_after_keychord = nil
App.keypress = nil
App.keyrelease = nil
App.run_after_mouse_click = nil
App.run_after_mouse_press = nil
App.run_after_mouse_release = nil
App.fake_keys_pressed = nil
App.fake_key_press = nil
App.fake_key_release = nil
App.fake_mouse_state = nil
App.fake_mouse_press = nil
App.fake_mouse_release = nil
-- other methods dispatch to real hardware
App.screen.resize = love.window.setMode
App.screen.size = love.window.getMode
App.screen.move = love.window.setPosition
App.screen.position = love.window.getPosition
App.screen.print = love.graphics.print
App.newText = love.graphics.newText
App.screen.draw = love.graphics.draw
App.width = function(text) return text:getWidth() end
App.open_for_reading = function(filename) return io.open(filename, 'r') end
App.open_for_writing = function(filename) return io.open(filename, 'w') end
App.getTime = love.timer.getTime
App.getClipboardText = love.system.getClipboardText
App.setClipboardText = love.system.setClipboardText
App.modifier_down = love.keyboard.isDown
App.mouse_move = love.mouse.setPosition
App.mouse_down = love.mouse.isDown
App.mouse_x = love.mouse.getX
App.mouse_y = love.mouse.getY
function handle_error_in_test(err)
local full_error = debug.traceback('Error: '..err, --[[stack frame]]3):gsub('\n[^\n]+$', '')
table.insert(Test_errors, full_error..'\n')