Skip to content

Commit 238514e

Browse files
committed
Add unit test for line cross section tool
1 parent 0c70e3a commit 238514e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from __future__ import annotations
2+
3+
import numpy as np
4+
from guidata.qthelpers import exec_dialog, qt_app_context
5+
6+
from plotpy.interfaces.items import IImageItemType
7+
from plotpy.panels.csection.cswidget import LineCrossSection
8+
from plotpy.tests.unit.utils import create_window, drag_mouse
9+
from plotpy.tools import LineCrossSectionTool
10+
11+
12+
def test_line_cross_section():
13+
"""Test the line cross section tool."""
14+
with qt_app_context(exec_loop=False) as qapp:
15+
win, tool = create_window(
16+
LineCrossSectionTool,
17+
active_item_type=IImageItemType,
18+
panels=[LineCrossSection],
19+
)
20+
n = 100
21+
x_path = np.linspace(0.25, 0.75, n)
22+
y_path = np.linspace(0.25, 0.75, n)
23+
drag_mouse(win, qapp, x_path, y_path)
24+
25+
exec_dialog(win)
26+
27+
28+
if __name__ == "__main__":
29+
test_line_cross_section()

0 commit comments

Comments
 (0)