refactor to reduce complexity of nesting
Python CI / test (push) Successful in 1m41s
Lint / lint (push) Successful in 1m29s
Tests / test (3.11) (push) Successful in 1m46s
Tests / test (3.12) (push) Successful in 1m50s
Tests / test (3.13) (push) Successful in 1m43s
Tests / test (3.14) (push) Successful in 1m26s
Python CI / test (push) Successful in 1m41s
Lint / lint (push) Successful in 1m29s
Tests / test (3.11) (push) Successful in 1m46s
Tests / test (3.12) (push) Successful in 1m50s
Tests / test (3.13) (push) Successful in 1m43s
Tests / test (3.14) (push) Successful in 1m26s
This commit is contained in:
@@ -462,51 +462,6 @@ class TestSnapEdgeToTargets:
|
||||
assert result is None
|
||||
|
||||
|
||||
class TestSnapAxis:
|
||||
"""Tests for _snap_axis method"""
|
||||
|
||||
def test_snap_axis_to_start(self):
|
||||
"""Test snapping axis to start edge"""
|
||||
snap = SnappingSystem()
|
||||
snap.snap_to_edges = True
|
||||
snap.snap_to_grid = False
|
||||
snap.snap_to_guides = False
|
||||
|
||||
dpi = 300
|
||||
threshold_px = 50
|
||||
|
||||
result = snap._snap_axis(
|
||||
position=10, size=50, page_size_mm=210, dpi=dpi, snap_threshold_px=threshold_px, orientation="vertical"
|
||||
)
|
||||
|
||||
assert result == 0
|
||||
|
||||
def test_snap_axis_to_end(self):
|
||||
"""Test snapping axis so element end aligns with page end"""
|
||||
snap = SnappingSystem()
|
||||
snap.snap_to_edges = True
|
||||
snap.snap_to_grid = False
|
||||
snap.snap_to_guides = False
|
||||
|
||||
dpi = 300
|
||||
page_size_mm = 210
|
||||
page_size_px = page_size_mm * dpi / 25.4
|
||||
element_size = 50
|
||||
threshold_px = 50
|
||||
|
||||
result = snap._snap_axis(
|
||||
position=page_size_px - element_size - 10,
|
||||
size=element_size,
|
||||
page_size_mm=page_size_mm,
|
||||
dpi=dpi,
|
||||
snap_threshold_px=threshold_px,
|
||||
orientation="vertical",
|
||||
)
|
||||
|
||||
expected = page_size_px - element_size
|
||||
assert abs(result - expected) < 1
|
||||
|
||||
|
||||
class TestGetSnapLines:
|
||||
"""Tests for get_snap_lines method"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user