From 7fec19f8f27f17dbd4f62028755a2cac914f8bbc Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 25 Jul 2019 14:58:42 +1000 Subject: [PATCH] test: switch the resolution capabilities to an array Just like the profile ones Signed-off-by: Peter Hutterer --- ratbagd/ratbagd-test.c | 15 +++++++++------ src/driver-test.c | 5 ++++- src/libratbag-test.h | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ratbagd/ratbagd-test.c b/ratbagd/ratbagd-test.c index ecda1533..fe5a4950 100644 --- a/ratbagd/ratbagd-test.c +++ b/ratbagd/ratbagd-test.c @@ -110,9 +110,12 @@ static const struct ratbag_test_device ratbagd_test_device_descr = { .key = 7 }, }, .resolutions = { - { .xres = 1100, .yres = 1200, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, - { .xres = 1200, .yres = 1300, .dflt = true, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, - { .xres = 1300, .yres = 1400, .active = true, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, + { .xres = 1100, .yres = 1200, + .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, + { .xres = 1200, .yres = 1300, .dflt = true, + .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, + { .xres = 1300, .yres = 1400, .active = true, + .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, }, .hz = 2000, .active = false, @@ -140,9 +143,9 @@ static const struct ratbag_test_device ratbagd_test_device_descr = { .button = 3 }, }, .resolutions = { - { .xres = 2100, .yres = 2200, .active = true, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, - { .xres = 2200, .yres = 2300, .dflt = true, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, - { .xres = 2300, .yres = 2400, .caps = RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION }, + { .xres = 2100, .yres = 2200, .active = true, .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, + { .xres = 2200, .yres = 2300, .dflt = true, .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, + { .xres = 2300, .yres = 2400, .caps = {RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION} }, }, .hz = 3000, .leds = { diff --git a/src/driver-test.c b/src/driver-test.c index 027114d7..996ee77a 100644 --- a/src/driver-test.c +++ b/src/driver-test.c @@ -214,7 +214,10 @@ test_read_profile(struct ratbag_profile *profile) res->is_default = r->dflt; if (r->dflt) default_set = true; - ratbag_resolution_set_cap(res, r->caps); + + for (size_t j = 0; j < ARRAY_LENGTH(r->caps) && r->caps[j]; j++) { + ratbag_resolution_set_cap(res, r->caps[j]); + } } /* special case triggered by the test suite when num_resolutions is 0 */ diff --git a/src/libratbag-test.h b/src/libratbag-test.h index 45fc49ef..6c72fc52 100644 --- a/src/libratbag-test.h +++ b/src/libratbag-test.h @@ -53,7 +53,7 @@ struct ratbag_test_resolution { int xres, yres; bool active; bool dflt; - uint32_t caps; + uint32_t caps[10]; int dpi_min, dpi_max; };