1"""Test API backward compatibility with liquidctl 1.0.x.
2
3While at the time all APIs were undocumented, we choose to support the use
4cases from GKraken as that software is a substantial contribution to the
5community.
6"""
7
8import pytest
9from _testutils import MockHidapiDevice
10
11from liquidctl.driver.kraken_two import KrakenTwoDriver
12from liquidctl.version import __version__
13
14SPECTRUM = [
15    (235, 77, 40),
16    (255, 148, 117),
17    (126, 66, 45),
18    (165, 87, 0),
19    (56, 193, 66),
20    (116, 217, 170),
21    (166, 158, 255),
22    (208, 0, 122)
23]
24
25
26@pytest.fixture
27def mockDevice():
28    device = MockHidapiDevice()
29    dev = KrakenTwoDriver(device, 'Mock X62',
30                                  device_type=KrakenTwoDriver.DEVICE_KRAKENX)
31
32    dev.connect()
33    return dev
34
35
36def test_pre11_apis_find_does_not_raise():
37    import liquidctl.cli
38    liquidctl.cli.find_all_supported_devices()
39
40
41def test_pre11_apis_connect_as_initialize(mockDevice):
42    # deprecated behavior in favor of connect()
43    mockDevice.initialize()
44
45
46def test_pre11_apis_deprecated_super_mode(mockDevice):
47    # deprecated in favor of super-fixed, super-breathing and super-wave
48    mockDevice.set_color('sync', 'super', [(128, 0, 255)] + SPECTRUM, 'normal')
49
50
51def test_pre11_apis_status_order(mockDevice):
52    # GKraken unreasonably expects a particular ordering
53    pass
54
55
56def test_pre11_apis_finalize_as_connect_or_noop(mockDevice):
57    # deprecated in favor of disconnect()
58    mockDevice.finalize()  # should disconnect
59    mockDevice.finalize()  # should be a no-op
60