Skip to content

Commit

Permalink
tests: expand tests for settings_templates
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Mar 27, 2024
1 parent 8330950 commit 5dd747f
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions tests/logitech_receiver/test_setting_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ def mock_gethostname(mocker):
hidpp.Response("000320", 0x0420),
hidpp.Response("000190", 0x0430, "000190"),
],
[
FeatureTest(settings_templates.AdjustableDpi, 800, 400, 0x30, "000190"),
common.NamedInts.list([400, 800, 1600]),
hidpp.Response("040003", 0x0000, "2201"), # ADJUSTABLE_DPI
hidpp.Response("000190032006400000", 0x0410, "000000"),
hidpp.Response("000320", 0x0420),
hidpp.Response("000190", 0x0430, "000190"),
],
[
FeatureTest(settings_templates.AdjustableDpi, 256, 512, 0x30, "000200"),
common.NamedInts.list([256, 512]),
Expand All @@ -475,29 +483,6 @@ def mock_gethostname(mocker):
hidpp.Response("000100", 0x0420),
hidpp.Response("000200", 0x0430, "000200"),
],
[
FeatureTest(settings_templates.ExtendedAdjustableDpi, 256, 512, 0x60, "000200"),
common.NamedInts.list([256, 512]),
hidpp.Response("090000", 0x0000, "2202"), # EXTENDED_ADJUSTABLE_DPI
hidpp.Response("000000", 0x0910, "00"), # no y direction
hidpp.Response("0000000100e10002000000", 0x0920, "000000"),
hidpp.Response("000100", 0x0950),
hidpp.Response("000200", 0x0960, "000200"),
],
[
FeatureTest(settings_templates.ExtendedAdjustableDpi, 0x64, 0x164, 0x60, "0001640164"),
common.NamedInts.list([0x064, 0x074, 0x084, 0x0A4, 0x0C4, 0x0E4, 0x0124, 0x0164, 0x01C4]),
hidpp.Response("090000", 0x0000, "2202"), # EXTENDED_ADJUSTABLE_DPI
hidpp.Response("000001", 0x0910, "00"), # supports y direction
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000000"),
hidpp.Response("000001E4E0400124E0400164E06001C4", 0x0920, "000001"),
hidpp.Response("00000000000000000000000000000000", 0x0920, "000002"),
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000100"),
hidpp.Response("000001E4E0400124E0400164E06001C4", 0x0920, "000101"),
hidpp.Response("00000000000000000000000000000000", 0x0920, "000102"),
hidpp.Response("000064", 0x0950),
hidpp.Response("0001640164", 0x0960, "0001640164"),
],
[
FeatureTest(settings_templates.Multiplatform, 0, 1, 0x30, "FF01"),
common.NamedInts(**{"MacOS 0.1-0.5": 0, "iOS 0.1-0.7": 1, "Linux 0.2-0.9": 2, "Windows 0.3-0.9": 3}),
Expand Down Expand Up @@ -645,6 +630,48 @@ def test_variable_template(test, mocker, mock_gethostname):
},
]
+ responses_remappable_action,
[
FeatureTest(settings_templates.ExtendedAdjustableDpi, {0: 256}, {0: 512}, 0x60, "000200000000"),
{common.NamedInt(0, "X"): common.NamedInts.list([256, 512])},
hidpp.Response("090000", 0x0000, "2202"), # EXTENDED_ADJUSTABLE_DPI
hidpp.Response("000000", 0x0910, "00"), # no y direction, no lod
hidpp.Response("0000000100e10002000000", 0x0920, "000000"),
hidpp.Response("00010000000000000000", 0x0950),
hidpp.Response("000200000000", 0x0960, "000200000000"),
],
[
FeatureTest(settings_templates.ExtendedAdjustableDpi, {0: 0x64, 1: 0xE4}, {0: 0x164}, 0x60, "00016400E400"),
{
common.NamedInt(0, "X"): common.NamedInts.list([0x064, 0x074, 0x084, 0x0A4, 0x0C4, 0x0E4, 0x0124, 0x0164, 0x01C4]),
common.NamedInt(1, "Y"): common.NamedInts.list([0x064, 0x074, 0x084, 0x0A4, 0x0C4, 0x0E4, 0x0124, 0x0164]),
},
hidpp.Response("090000", 0x0000, "2202"), # EXTENDED_ADJUSTABLE_DPI
hidpp.Response("000001", 0x0910, "00"), # supports y direction, no lod
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000000"),
hidpp.Response("000001E4E0400124E0400164E06001C4", 0x0920, "000001"),
hidpp.Response("00000000000000000000000000000000", 0x0920, "000002"),
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000100"),
hidpp.Response("000001E4E0400124E040016400000000", 0x0920, "000101"),
hidpp.Response("000064007400E4007400", 0x0950),
hidpp.Response("00016400E400", 0x0960, "00016400E400"),
],
[
FeatureTest(settings_templates.ExtendedAdjustableDpi, {0: 0x64, 1: 0xE4, 2: 1}, {1: 0x164}, 0x60, "000064016401"),
{
common.NamedInt(0, "X"): common.NamedInts.list([0x064, 0x074, 0x084, 0x0A4, 0x0C4, 0x0E4, 0x0124, 0x0164, 0x01C4]),
common.NamedInt(1, "Y"): common.NamedInts.list([0x064, 0x074, 0x084, 0x0A4, 0x0C4, 0x0E4, 0x0124, 0x0164]),
common.NamedInt(2, "LOD"): common.NamedInts(LOW=0, MEDIUM=1, HIGH=2),
},
hidpp.Response("090000", 0x0000, "2202"), # EXTENDED_ADJUSTABLE_DPI
hidpp.Response("000003", 0x0910, "00"), # supports y direction and lod
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000000"),
hidpp.Response("000001E4E0400124E0400164E06001C4", 0x0920, "000001"),
hidpp.Response("00000000000000000000000000000000", 0x0920, "000002"),
hidpp.Response("0000000064E0100084E02000C4E02000", 0x0920, "000100"),
hidpp.Response("000001E4E0400124E040016400000000", 0x0920, "000101"),
hidpp.Response("000064007400E4007401", 0x0950),
hidpp.Response("000064016401", 0x0960, "000064016401"),
],
]


Expand All @@ -654,7 +681,6 @@ def test_key_template(test, mocker):
spy_feature_request = mocker.spy(device, "feature_request")

setting = settings_templates.check_feature(device, test[0].sclass)
print("SETTING", setting)
assert setting is not None
if isinstance(setting, list):
setting = setting[0]
Expand Down

0 comments on commit 5dd747f

Please sign in to comment.