refactor: rename project to LedGrab, split HA integration into separate repo
Lint & Test / test (push) Successful in 1m56s
Lint & Test / test (push) Successful in 1m56s
- Rename Python package: wled_controller -> ledgrab - Rename env var prefix: WLED_ -> LEDGRAB_ (with auto-migration for old vars) - Rename localStorage key: wled_api_key -> ledgrab_api_key (with migration) - Rename HA integration domain: wled_screen_controller -> ledgrab - Update all imports, build scripts, Docker, installer, config, docs - Remove HA integration (moved to ledgrab-haos-integration repo) - Remove hacs.json (belongs in HA repo now) - Add startup warning for users with old WLED_ env vars - All tests pass (715/715), ruff clean, tsc clean, frontend builds
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from wled_controller.core.capture.calibration import (
|
||||
from ledgrab.core.capture.calibration import (
|
||||
CalibrationSegment,
|
||||
CalibrationConfig,
|
||||
PixelMapper,
|
||||
@@ -13,7 +13,7 @@ from wled_controller.core.capture.calibration import (
|
||||
EDGE_ORDER,
|
||||
EDGE_REVERSE,
|
||||
)
|
||||
from wled_controller.core.capture.screen_capture import BorderPixels
|
||||
from ledgrab.core.capture.screen_capture import BorderPixels
|
||||
|
||||
|
||||
def test_calibration_segment():
|
||||
@@ -139,16 +139,19 @@ def test_build_segments_skips_zero_edges():
|
||||
assert "bottom" not in edges
|
||||
|
||||
|
||||
@pytest.mark.parametrize("start_position,layout", [
|
||||
("bottom_left", "clockwise"),
|
||||
("bottom_left", "counterclockwise"),
|
||||
("bottom_right", "clockwise"),
|
||||
("bottom_right", "counterclockwise"),
|
||||
("top_left", "clockwise"),
|
||||
("top_left", "counterclockwise"),
|
||||
("top_right", "clockwise"),
|
||||
("top_right", "counterclockwise"),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"start_position,layout",
|
||||
[
|
||||
("bottom_left", "clockwise"),
|
||||
("bottom_left", "counterclockwise"),
|
||||
("bottom_right", "clockwise"),
|
||||
("bottom_right", "counterclockwise"),
|
||||
("top_left", "clockwise"),
|
||||
("top_left", "counterclockwise"),
|
||||
("top_right", "clockwise"),
|
||||
("top_right", "counterclockwise"),
|
||||
],
|
||||
)
|
||||
def test_build_segments_all_combinations(start_position, layout):
|
||||
"""Test build_segments matches lookup tables for all 8 combinations."""
|
||||
config = CalibrationConfig(
|
||||
@@ -171,8 +174,9 @@ def test_build_segments_all_combinations(start_position, layout):
|
||||
# Verify reverse flags match EDGE_REVERSE table
|
||||
expected_reverse = EDGE_REVERSE[(start_position, layout)]
|
||||
for seg in segments:
|
||||
assert seg.reverse == expected_reverse[seg.edge], \
|
||||
f"Mismatch for {start_position}/{layout}/{seg.edge}: expected reverse={expected_reverse[seg.edge]}"
|
||||
assert (
|
||||
seg.reverse == expected_reverse[seg.edge]
|
||||
), f"Mismatch for {start_position}/{layout}/{seg.edge}: expected reverse={expected_reverse[seg.edge]}"
|
||||
|
||||
# Verify led_start values are cumulative
|
||||
expected_start = 0
|
||||
@@ -240,11 +244,11 @@ def test_pixel_mapper_test_calibration():
|
||||
|
||||
# Top edge should be lit (red)
|
||||
top_segment = config.get_segment_for_edge("top")
|
||||
top_leds = led_colors[top_segment.led_start:top_segment.led_start + top_segment.led_count]
|
||||
top_leds = led_colors[top_segment.led_start : top_segment.led_start + top_segment.led_count]
|
||||
assert all(color == (255, 0, 0) for color in top_leds)
|
||||
|
||||
# Other LEDs should be off
|
||||
other_leds = led_colors[:top_segment.led_start]
|
||||
other_leds = led_colors[: top_segment.led_start]
|
||||
assert all(color == (0, 0, 0) for color in other_leds)
|
||||
|
||||
|
||||
@@ -317,7 +321,6 @@ def test_calibration_from_dict():
|
||||
assert config.get_total_leds() == 140
|
||||
|
||||
|
||||
|
||||
def test_calibration_from_dict_missing_field():
|
||||
"""Test calibration from dict with missing field."""
|
||||
data = {
|
||||
|
||||
Reference in New Issue
Block a user