def test_hue2_backwards_modes_are_deprecated(caplog):
    modes = [
        'backwards-spectrum-wave', 'backwards-marquee-3',
        'backwards-marquee-4', 'backwards-marquee-5', 'backwards-marquee-6',
        'backwards-moving-alternating-3', 'covering-backwards-marquee',
        'backwards-moving-alternating-4', 'backwards-moving-alternating-5',
        'backwards-moving-alternating-6', 'backwards-rainbow-flow',
        'backwards-super-rainbow', 'backwards-rainbow-pulse'
    ]

    from liquidctl.driver.smart_device import SmartDevice2

    for mode in modes:
        base_mode = mode.replace('backwards-', '')

        old = SmartDevice2(MockHidapiDevice(),
                           'Mock Smart Device V2',
                           speed_channel_count=3,
                           color_channel_count=2)
        new = SmartDevice2(MockHidapiDevice(),
                           'Mock Smart Device V2',
                           speed_channel_count=3,
                           color_channel_count=2)

        colors = [RADICAL_RED, MOUNTAIN_MEADOW]

        old.set_color('led1', mode, colors)
        new.set_color('led1', base_mode, colors, direction='backward')

        assert old.device.sent == new.device.sent, \
               f'{mode} != {base_mode} + direction=backward'

        assert 'deprecated mode' in caplog.text
def mockSmartDevice2():
    device = _MockSmartDevice2(raw_speed_channels=3, raw_led_channels=2)
    dev = SmartDevice2(device,
                       'mock NZXT Smart Device V2',
                       speed_channel_count=3,
                       color_channel_count=2)
    dev.connect()
    return dev
def mock_smart2():
    raw = MockSmart2(raw_speed_channels=3, raw_led_channels=2)
    dev = SmartDevice2(raw,
                       "Mock Smart Device V2",
                       speed_channel_count=3,
                       color_channel_count=2)
    dev.connect()
    return dev
Example #4
0
 def setUp(self):
     self.mock_hid = _MockSmartDevice2(raw_speed_channels=3, raw_led_channels=2)
     self.device = SmartDevice2(self.mock_hid, 'Mock Smart Device V2',
                                speed_channel_count=3,
                                color_channel_count=2)
     self.device.connect()