From 9b134d6354089920d22c8de783093120c44cfb36 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 9 Oct 2021 15:09:57 +0200 Subject: Enforce KAuthorized enums being not 0 This will output a warning if an invalid value is requested. The goal is to avoid implicit conversion which might result in a zero-int value. --- autotests/kconfigtest.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'autotests/kconfigtest.cpp') diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 9f88e67b..4657ea8d 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -2082,6 +2082,9 @@ void KConfigTest::testKAuthorizeEnums() QVERIFY(!KAuthorized::authorize(KAuthorized::SHELL_ACCESS)); QVERIFY(!KAuthorized::authorizeAction(KAuthorized::OPEN_WITH)); actionRestrictions.deleteGroup(); + + QVERIFY(!KAuthorized::authorize((KAuthorized::GenericRestriction)0)); + QVERIFY(!KAuthorized::authorizeAction((KAuthorized::GenericAction)0)); } void KConfigTest::testKdeglobalsVsDefault() -- cgit v1.2.1