diff --git a/test/test-device.c b/test/test-device.c index 8750e3ad..a367137b 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -33,6 +33,7 @@ #include #include +#include "libratbag-private.h" #include "libratbag.h" #include "libratbag-util.h" #include "libratbag-test.h" @@ -249,6 +250,34 @@ START_TEST(device_profiles) } END_TEST +START_TEST(device_profiles_activate_disabled) +{ + int rc; + struct ratbag *r; + struct ratbag_device *d; + struct ratbag_profile *p; + + struct ratbag_test_device td = sane_device; + + td.profiles[0].active = true; + + r = ratbag_create_context(&abort_iface, NULL); + d = ratbag_device_new_test_device(r, &td); + ck_assert(d != NULL); + + p = ratbag_device_get_profile(d, 0); + + ratbag_profile_set_cap(p, RATBAG_PROFILE_CAP_DISABLE); + + rc = ratbag_profile_set_enabled(p, false); + ck_assert_int_eq(rc, RATBAG_ERROR_VALUE); + + ratbag_profile_unref(p); + + ratbag_unref(r); +} +END_TEST + START_TEST(device_profiles_ref_unref) { struct ratbag *r; @@ -922,6 +951,7 @@ test_context_suite(void) tc = tcase_create("profiles"); tcase_add_test(tc, device_profiles); + tcase_add_test(tc, device_profiles_activate_disabled); tcase_add_test(tc, device_profiles_ref_unref); tcase_add_test(tc, device_profiles_num_0); tcase_add_test(tc, device_profiles_multiple_active);