Skip to content

Commit be1f854

Browse files
committed
test lock trimage tool
1 parent 404278b commit be1f854

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

plotpy/tests/unit/test_plot_image.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Licensed under the terms of the BSD 3-Clause
43
# (see plotpy/LICENSE for details)
@@ -14,6 +13,7 @@
1413
from plotpy.builder import make
1514
from plotpy.plot import BasePlot
1615
from plotpy.tools import ColormapTool, ReverseColormapTool
16+
from plotpy.tools.image import LockTrImageTool
1717

1818

1919
def compute_image():
@@ -104,6 +104,24 @@ def test_plot_tr_image():
104104
assert bounds3.height() == bounds2.height() * 3.0
105105

106106

107+
def test_lock_tr_image():
108+
"""Test LockTrImageTool"""
109+
with qt_app_context(exec_loop=True):
110+
win = make.dialog(type="image", toolbar=True)
111+
win.show()
112+
item = make.trimage(compute_image())
113+
# with plot_image(item) as plot:
114+
plot = win.manager.get_plot()
115+
plot.add_item(item)
116+
plot.select_item(item)
117+
tool = win.manager.add_tool(LockTrImageTool)
118+
tool.activate()
119+
assert item.is_locked()
120+
tool.activate(False)
121+
assert not item.is_locked()
122+
exec_dialog(win)
123+
124+
107125
@pytest.mark.parametrize("ratio", [1.0, 0.75, 1.5, 2.0, 3.0])
108126
def test_set_aspect_ratio(ratio):
109127
"""Test BasePlot.set_aspect_ratio method()

0 commit comments

Comments
 (0)