From 5b6554352e2fa5687370ea8d7e20a817431ca683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 15 Apr 2016 10:02:25 +0200 Subject: [PATCH] update rule consistency --- server/rule.cpp | 6 ++++++ tests/auto/timemanager/testtimemanager.cpp | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/rule.cpp b/server/rule.cpp index 03690af1..49bd1b5e 100644 --- a/server/rule.cpp +++ b/server/rule.cpp @@ -184,6 +184,12 @@ bool Rule::isConsistent() const return false; } + // check if this rules is based on any time events and contains exit actions + if (!timeDescriptor().timeEventItems().isEmpty() && !exitActions().isEmpty()) { + qCWarning(dcRuleEngine) << "Rule not consistent. The exitActions will never be executed if the rule contains an timeEvents."; + return false; + } + // check if there are any actions if (actions().isEmpty()) { qCWarning(dcRuleEngine) << "Rule not consistent. A rule without actions has no effect."; diff --git a/tests/auto/timemanager/testtimemanager.cpp b/tests/auto/timemanager/testtimemanager.cpp index 8a662c35..a81928dd 100644 --- a/tests/auto/timemanager/testtimemanager.cpp +++ b/tests/auto/timemanager/testtimemanager.cpp @@ -344,7 +344,6 @@ void TestTimeManager::addTimeDescriptor_data() QTest::newRow("invalid: timeEventItem - invalid weekdays (to big)") << createTimeDescriptorTimeEvent(createTimeEventItem("13:13", repeatingOptionInvalidWeekDays2)) << RuleEngine::RuleErrorInvalidRepeatingOption; QTest::newRow("invalid: timeEventItem - invalid monthdays (negative)") << createTimeDescriptorTimeEvent(createTimeEventItem("13:13", repeatingOptionInvalidMonthDays)) << RuleEngine::RuleErrorInvalidRepeatingOption; QTest::newRow("invalid: timeEventItem - invalid monthdays (to big)") << createTimeDescriptorTimeEvent(createTimeEventItem("13:13", repeatingOptionInvalidMonthDays2)) << RuleEngine::RuleErrorInvalidRepeatingOption; - } void TestTimeManager::addTimeDescriptor()