mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Fix tests
This commit is contained in:
parent
bd9b4ad58f
commit
cfaeff1516
@ -248,6 +248,10 @@ function Button.on_input(self, action_id, action)
|
||||
return false
|
||||
end
|
||||
|
||||
if not self:is_enabled() then
|
||||
return false
|
||||
end
|
||||
|
||||
local is_pick = true
|
||||
local is_key_trigger = (action_id == self.key_trigger)
|
||||
if not is_key_trigger then
|
||||
@ -280,7 +284,7 @@ function Button.on_input(self, action_id, action)
|
||||
|
||||
-- While hold button, repeat rate pick from input.repeat_interval
|
||||
if action.repeated then
|
||||
if not self.disabled and self.on_repeated_click:is_exist() and self.can_action then
|
||||
if self.on_repeated_click:is_exist() and self.can_action then
|
||||
on_button_repeated_click(self)
|
||||
return true
|
||||
end
|
||||
@ -290,7 +294,7 @@ function Button.on_input(self, action_id, action)
|
||||
return on_button_release(self)
|
||||
end
|
||||
|
||||
if not self.disabled and self.can_action and self.on_long_click:is_exist() then
|
||||
if self.can_action and self.on_long_click:is_exist() then
|
||||
local press_time = socket.gettime() - self.last_pressed_time
|
||||
|
||||
if self.style.AUTOHOLD_TRIGGER <= press_time then
|
||||
|
@ -11,7 +11,7 @@ return function()
|
||||
local function create_drag_instance(on_drag)
|
||||
local button = mock_gui.add_box("button", 0, 0, 20, 20)
|
||||
local instance = druid:new_drag(button, on_drag)
|
||||
instance.style.IS_USE_SCREEN_KOEF = false
|
||||
instance.style.NO_USE_SCREEN_KOEF = true
|
||||
instance.style.DRAG_DEADZONE = 4
|
||||
return instance
|
||||
end
|
||||
@ -36,7 +36,7 @@ return function()
|
||||
local instance = create_drag_instance(on_drag)
|
||||
|
||||
druid:on_input(mock_input.click_pressed(10, 10))
|
||||
assert(instance.is_touch == true)
|
||||
assert(instance.is_touch == true)
|
||||
|
||||
druid:on_input(mock_input.input_empty(12, 10))
|
||||
assert(on_drag_mock.calls == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user