69753e35f9
- Implement synchronous offscreen wafer map PNG rendering and CSV summary. - Add "Batch Export" button to file browser sidebar. - Adjust trend pane bottom spacer to align with About button when visible. - Fix type check errors and add pytest coverage for batch export.
53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
import pytest
|
|
|
|
from pygui.backend.visualization.chart_geometry import (
|
|
elapsed_to_pixel,
|
|
index_to_pixel,
|
|
value_to_pixel,
|
|
)
|
|
|
|
|
|
def test_value_to_pixel_min_maps_to_bottom():
|
|
assert value_to_pixel(0.0, 0.0, 100.0, pixel_start=10.0, pixel_span=200.0) == pytest.approx(210.0)
|
|
|
|
|
|
def test_value_to_pixel_max_maps_to_top():
|
|
assert value_to_pixel(100.0, 0.0, 100.0, pixel_start=10.0, pixel_span=200.0) == pytest.approx(10.0)
|
|
|
|
|
|
def test_value_to_pixel_midpoint():
|
|
assert value_to_pixel(50.0, 0.0, 100.0, pixel_start=0.0, pixel_span=200.0) == pytest.approx(100.0)
|
|
|
|
|
|
def test_value_to_pixel_degenerate_range_centers():
|
|
assert value_to_pixel(5.0, 5.0, 5.0, pixel_start=0.0, pixel_span=200.0) == pytest.approx(100.0)
|
|
|
|
|
|
def test_index_to_pixel_first_and_last():
|
|
assert index_to_pixel(0, 5, pixel_start=0.0, pixel_span=100.0) == pytest.approx(0.0)
|
|
assert index_to_pixel(4, 5, pixel_start=0.0, pixel_span=100.0) == pytest.approx(100.0)
|
|
|
|
|
|
def test_index_to_pixel_single_point_centers():
|
|
assert index_to_pixel(0, 1, pixel_start=0.0, pixel_span=100.0) == pytest.approx(50.0)
|
|
|
|
|
|
def test_elapsed_to_pixel_window_start_maps_to_left():
|
|
assert elapsed_to_pixel(10.0, window_start=10.0, window_end=70.0,
|
|
pixel_start=0.0, pixel_span=200.0) == pytest.approx(0.0)
|
|
|
|
|
|
def test_elapsed_to_pixel_window_end_maps_to_right():
|
|
assert elapsed_to_pixel(70.0, window_start=10.0, window_end=70.0,
|
|
pixel_start=0.0, pixel_span=200.0) == pytest.approx(200.0)
|
|
|
|
|
|
def test_elapsed_to_pixel_midpoint():
|
|
assert elapsed_to_pixel(40.0, window_start=10.0, window_end=70.0,
|
|
pixel_start=0.0, pixel_span=200.0) == pytest.approx(100.0)
|
|
|
|
|
|
def test_elapsed_to_pixel_degenerate_window_pins_right():
|
|
assert elapsed_to_pixel(5.0, window_start=5.0, window_end=5.0,
|
|
pixel_start=0.0, pixel_span=200.0) == pytest.approx(200.0)
|