forked from drath/libratbag
tools: add dpi get-all to ratbagctl
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
94320099b0
commit
251efd3b40
@@ -421,6 +421,12 @@ def func_dpi_get(r, args):
|
||||
print("{}dpi".format(r.resolution[0]))
|
||||
|
||||
|
||||
def func_dpi_get_all(r, args):
|
||||
r, p, d = find_resolution(r, args)
|
||||
dpis = r.resolutions
|
||||
print(" ".join([str(x) for x in dpis]))
|
||||
|
||||
|
||||
def func_dpi_set(r, args):
|
||||
r, p, d = find_resolution(r, args)
|
||||
r.resolution = (args.dpi_n[0], args.dpi_n[1])
|
||||
@@ -858,6 +864,12 @@ active resolution of the active profile if none are given.""",
|
||||
help_str: 'Show current DPI value',
|
||||
func: func_dpi_get,
|
||||
},
|
||||
{
|
||||
of_type: command,
|
||||
name: 'get-all',
|
||||
help_str: 'Show all available DPIs',
|
||||
func: func_dpi_get_all,
|
||||
},
|
||||
{
|
||||
of_type: command,
|
||||
name: 'set',
|
||||
|
||||
@@ -286,6 +286,15 @@ class TestRatbagCtlDPI(TestRatbagCtl):
|
||||
self.launch_fail_test(command + " 1 test_device")
|
||||
self.launch_fail_test(command + " test_device X")
|
||||
|
||||
def test_dpi_get_all_self(self):
|
||||
dpi_list = "50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2800 3000 3200 3400 3600 3800 4000 4200 4400 4600 4800 5000"
|
||||
command = "DPI get-all"
|
||||
r = self.launch_good_test(command + " test_device")
|
||||
self.assertEqual(r, dpi_list)
|
||||
self.setProfile(1)
|
||||
r = self.launch_good_test(command + " test_device")
|
||||
self.assertEqual(r, dpi_list)
|
||||
|
||||
def test_dpi_set(self):
|
||||
command = "DPI set"
|
||||
self.setProfile(0)
|
||||
|
||||
Reference in New Issue
Block a user