Files
lda Verified 038e152bbc
Checks / tests (ubuntu-latest, 3.11) (push) Canceled after 0s
Checks / tests (ubuntu-latest, 3.14) (push) Canceled after 0s
Checks / tests (windows-latest, 3.11) (push) Canceled after 0s
Checks / tests (windows-latest, 3.14) (push) Canceled after 0s
Checks / package (push) Canceled after 0s
Add MX-T40 BLE desktop controller and protocol documentation
2026-10-25 04:43:47 +07:00

30 lines
958 B
Python

"""Match semantic command builders against independently captured writes."""
import unittest
from controller import commands
from controller.protocol import Encoder
class CommandTests(unittest.TestCase):
def test_rock_packet_matches_hardware_capture(self):
encoder = Encoder()
encoder.sequence = 11
self.assertEqual(
encoder.encode(commands.set_eq(5)), bytes.fromhex("00 bb 01 0c 00 05 40 03 00 05 00 5a")
)
def test_bass_off_matches_hardware_capture(self):
encoder = Encoder()
encoder.sequence = 6
self.assertEqual(
encoder.encode(commands.set_bass(False)),
bytes.fromhex("00 bb 01 07 00 05 40 04 00 01 00 52"),
)
def test_invalid_rgb_is_rejected_before_transport(self):
with self.assertRaises(ValueError):
commands.set_rgb(256, 0, 0)
with self.assertRaises(ValueError):
commands.set_rgb(0.5, 0, 0)