fixed normal force negative display scale problem

This commit is contained in:
ykcheungab
2026-09-01 16:46:00 +08:00
parent e7789c86cb
commit 299696ab33
3 changed files with 49 additions and 11 deletions
+14 -4
View File
@@ -337,14 +337,24 @@ def test_exhibition_window_offscreen() -> None:
assert "FN" in title0
assert "raw" in title0
from sensor_bench.force_calibration import CALIBRATED_FORCE_Y_MAX, CALIBRATED_FORCE_Y_MIN
from sensor_bench.force_calibration import (
CALIBRATED_NORMAL_FORCE_Y_MAX,
CALIBRATED_NORMAL_FORCE_Y_MIN,
CALIBRATED_SHEAR_FORCE_Y_MAX,
CALIBRATED_SHEAR_FORCE_Y_MIN,
)
win._force_calibrated = True
win.force_history.push(time.time(), 1.0, -2.0, 3.0)
win._update_plots()
ymin, ymax = win.plots[0].viewRange()[1]
assert abs(ymin - CALIBRATED_FORCE_Y_MIN) < 1e-6
assert abs(ymax - CALIBRATED_FORCE_Y_MAX) < 1e-6
fn_ymin, fn_ymax = win.plots[0].viewRange()[1]
assert abs(fn_ymin - CALIBRATED_NORMAL_FORCE_Y_MIN) < 1e-6
assert abs(fn_ymax - CALIBRATED_NORMAL_FORCE_Y_MAX) < 1e-6
fx_ymin, fx_ymax = win.plots[1].viewRange()[1]
assert abs(fx_ymin - CALIBRATED_SHEAR_FORCE_Y_MIN) < 1e-6
assert abs(fx_ymax - CALIBRATED_SHEAR_FORCE_Y_MAX) < 1e-6
axis = win.plots[0].getAxis("left")
assert "20" in axis.tickStrings([20.0], 1.0, 20.0)
win.view_combo.setCurrentIndex(1)
assert win._view_mode == "captured"