test: switch the resolution capabilities to an array

Just like the profile ones

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-07-25 14:58:42 +10:00
committed by Filipe Laíns
parent 11c1e2d71a
commit 7fec19f8f2
3 changed files with 14 additions and 8 deletions

View File

@@ -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 = {

View File

@@ -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 */

View File

@@ -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;
};