test: check that disabled profile can't made active

This is failing right now.
This commit is contained in:
Yaroslav Chvanov
2023-03-09 18:28:01 +03:00
parent 6e06fe7245
commit 890d8313fd

View File

@@ -33,6 +33,7 @@
#include <limits.h>
#include <sys/resource.h>
#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);