mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Add initial Druid tests
This commit is contained in:
22
test/helper/mock_input.lua
Normal file
22
test/helper/mock_input.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local M = {}
|
||||
|
||||
|
||||
function M.click_pressed(x, y)
|
||||
return hash("touch"), {
|
||||
pressed = true,
|
||||
x = x,
|
||||
y = y,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function M.click_released(x, y)
|
||||
return hash("touch"), {
|
||||
released = true,
|
||||
x = x,
|
||||
y = y,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
return M
|
18
test/helper/test_helper.lua
Normal file
18
test/helper/test_helper.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
local mock = require("deftest.mock.mock")
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Userdata type instead of script self
|
||||
function M.get_context()
|
||||
return vmath.vector()
|
||||
end
|
||||
|
||||
|
||||
function M.get_function()
|
||||
local listener = {}
|
||||
listener.callback = function() end
|
||||
mock.mock(listener)
|
||||
return function(...) listener.callback(...) end, listener.callback
|
||||
end
|
||||
|
||||
return M
|
Reference in New Issue
Block a user