step 3: add widget shell sizing and frame pump
This commit is contained in:
19
tests/test_interaction.py
Normal file
19
tests/test_interaction.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dpg_map.interaction import calculate_hit_rect
|
||||
from dpg_map.sizing import SizeMeasurement, apply_size_measurement
|
||||
from dpg_map.state import create_map_state
|
||||
|
||||
|
||||
def test_hit_rect_uses_effective_map_size() -> None:
|
||||
state = create_map_state(tag="hit-rect")
|
||||
apply_size_measurement(state, SizeMeasurement(width=400, height=250, visible=True))
|
||||
|
||||
rect = calculate_hit_rect(state, (10.0, 20.0))
|
||||
|
||||
assert rect.x == 10.0
|
||||
assert rect.y == 20.0
|
||||
assert rect.width == 400
|
||||
assert rect.height == 250
|
||||
assert rect.contains(410.0, 270.0)
|
||||
assert not rect.contains(411.0, 270.0)
|
||||
Reference in New Issue
Block a user