callback renamed -> onEvent

This commit is contained in:
Michael Freno
2025-11-11 13:13:22 -05:00
parent e56b18b7bd
commit be0771d0d3
15 changed files with 80 additions and 69 deletions

View File

@@ -49,7 +49,7 @@ function TestEventSystem:test_event_object_has_required_fields()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
eventReceived = event
end,
})
@@ -82,7 +82,7 @@ function TestEventSystem:test_left_click_generates_click_event()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
table.insert(eventsReceived, { type = event.type, button = event.button })
end,
})
@@ -118,7 +118,7 @@ function TestEventSystem:test_right_click_generates_rightclick_event()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
table.insert(eventsReceived, { type = event.type, button = event.button })
end,
})
@@ -151,7 +151,7 @@ function TestEventSystem:test_middle_click_generates_middleclick_event()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
table.insert(eventsReceived, { type = event.type, button = event.button })
end,
})
@@ -184,7 +184,7 @@ function TestEventSystem:test_modifier_keys_are_detected()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
if event.type == "click" then
eventReceived = event
end
@@ -213,7 +213,7 @@ function TestEventSystem:test_double_click_increments_click_count()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
if event.type == "click" then
table.insert(clickEvents, event.clickCount)
end
@@ -248,7 +248,7 @@ function TestEventSystem:test_press_and_release_events_are_fired()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
table.insert(eventsReceived, event.type)
end,
})
@@ -288,7 +288,7 @@ function TestEventSystem:test_event_contains_mouse_position()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
if event.type == "click" then
eventReceived = event
end
@@ -318,7 +318,7 @@ function TestEventSystem:test_no_callback_when_clicking_outside_element()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
callbackCalled = true
end,
})
@@ -343,7 +343,7 @@ function TestEventSystem:test_multiple_modifiers_detected()
y = 100,
width = 200,
height = 100,
callback = function(element, event)
onEvent = function(element, event)
if event.type == "click" then
eventReceived = event
end

View File

@@ -32,7 +32,7 @@ function TestDragEvent:test_drag_event_fired_on_mouse_movement()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
dragEventReceived = true
dragEvent = event
@@ -62,7 +62,7 @@ function TestDragEvent:test_drag_event_contains_delta_values()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
dragEvent = event
end
@@ -94,7 +94,7 @@ function TestDragEvent:test_drag_event_updates_delta_continuously()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
table.insert(dragEvents, { dx = event.dx, dy = event.dy })
end
@@ -130,7 +130,7 @@ function TestDragEvent:test_no_drag_event_when_mouse_stationary()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
dragEventCount = dragEventCount + 1
end
@@ -158,7 +158,7 @@ function TestDragEvent:test_drag_tracking_cleaned_up_on_release()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
table.insert(dragEvents, { dx = event.dx, dy = event.dy })
end
@@ -199,7 +199,7 @@ function TestDragEvent:test_drag_works_with_different_buttons()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
table.insert(dragEvents, { button = event.button, dx = event.dx })
end
@@ -232,7 +232,7 @@ function TestDragEvent:test_drag_event_contains_mouse_position()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
dragEvent = event
end
@@ -260,7 +260,7 @@ function TestDragEvent:test_no_drag_when_mouse_leaves_element()
y = 100,
width = 200,
height = 100,
callback = function(el, event)
onEvent = function(el, event)
if event.type == "drag" then
dragEventCount = dragEventCount + 1
end