pre merge cleanup
This commit is contained in:
+46
-1
@@ -94,11 +94,18 @@ def test_dc_precompute_all_angles(ctx):
|
||||
|
||||
|
||||
def test_angle_switching_from_cache(ctx):
|
||||
"""Setting the angle must redraw on its own — no nudge from the test.
|
||||
|
||||
The spinbox used to be wired to editingFinished alone, so stepping it with
|
||||
the arrows changed the number and left the plot on the previous angle until
|
||||
the box happened to lose focus.
|
||||
"""
|
||||
win, s = ctx.win, ctx.s
|
||||
for a in range(s.n_angles):
|
||||
win.spin_angle.setValue(a)
|
||||
win._on_view_changed()
|
||||
pump(60)
|
||||
assert win._current_angle == a, \
|
||||
f"angle {a} redrawn from the spinbox alone, showing {win._current_angle}"
|
||||
expected = win._sras.image_shape(a)
|
||||
assert win._current_image.shape == expected, \
|
||||
f"angle {a} shows its own geometry {expected}, got {win._current_image.shape}"
|
||||
@@ -106,6 +113,44 @@ def test_angle_switching_from_cache(ctx):
|
||||
"no compute job needed for cached DC angles"
|
||||
|
||||
|
||||
def test_angle_steps_and_typing(ctx):
|
||||
"""The arrows step and redraw one angle at a time; typing commits once,
|
||||
without a stop at every intermediate value."""
|
||||
win, s = ctx.win, ctx.s
|
||||
assert s.n_angles > 2, "fixture needs several angles"
|
||||
win.spin_angle.setValue(0)
|
||||
pump(60)
|
||||
|
||||
seen = []
|
||||
win.spin_angle.valueChanged.connect(seen.append)
|
||||
try:
|
||||
win.spin_angle.stepUp()
|
||||
pump(60)
|
||||
assert win._current_angle == 1, f"arrow stepped to 1, showing {win._current_angle}"
|
||||
win.spin_angle.stepDown()
|
||||
pump(60)
|
||||
assert win._current_angle == 0, f"arrow stepped to 0, showing {win._current_angle}"
|
||||
|
||||
# Typing must not redraw per keystroke — that is what editingFinished
|
||||
# bought and what keyboard tracking has to keep buying.
|
||||
seen.clear()
|
||||
last = s.n_angles - 1
|
||||
win.spin_angle.lineEdit().selectAll()
|
||||
QTest.keyClicks(win.spin_angle.lineEdit(), str(last))
|
||||
pump(30)
|
||||
assert seen == [] and win._current_angle == 0, \
|
||||
f"half-typed text must not redraw ({seen}, showing {win._current_angle})"
|
||||
QTest.keyClick(win.spin_angle, Qt.Key.Key_Return)
|
||||
pump(60)
|
||||
assert seen == [last], f"committed exactly once on Return: {seen}"
|
||||
assert win._current_angle == last
|
||||
finally:
|
||||
win.spin_angle.valueChanged.disconnect(seen.append)
|
||||
win.spin_angle.clearFocus()
|
||||
win.spin_angle.setValue(0)
|
||||
pump(60)
|
||||
|
||||
|
||||
def test_channel_switching(ctx):
|
||||
win = ctx.win
|
||||
win.spin_angle.setValue(0)
|
||||
|
||||
Reference in New Issue
Block a user