Skip to content

Commit cfcc470

Browse files
committed
Fix test_multiline_tool failing with PyQt6 due to smaller canvas size
The spiral test data started at t=0, placing the first two points so close together that they mapped to the same pixel on PyQt6's smaller default canvas (297x382 vs 355x383 with PyQt5). This triggered stop_moving's init_pos == pos check, deleting a point and causing an off-by-one assertion error (99 vs 100 points). Start the spiral at t=2π to ensure sufficient pixel spacing between consecutive points regardless of canvas size.
1 parent cc18c85 commit cfcc470

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plotpy/tests/unit/test_multiline_tools.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def test_polygon_tool():
6060
def test_multiline_tool():
6161
"""Test the multi line tool."""
6262
n = 100
63-
t = np.linspace(0, np.pi * 10, n)
63+
# Start from 2*pi to skip the degenerate center of the spiral where adjacent
64+
# points are too close and may map to the same pixel on small canvases (this
65+
# caused the test to fail with PyQt6 due to a smaller default canvas size).
66+
t = np.linspace(2 * np.pi, np.pi * 10, n)
6467
x_arr = t * np.cos(t) / n + 0.5
6568
y_arr = t * np.sin(t) / n + 0.5
6669
__generic_polyline_tool_test(MultiLineTool, np.array([x_arr, y_arr]).T)

0 commit comments

Comments
 (0)