update rule consistency

This commit is contained in:
Simon Stürz 2016-04-15 10:02:25 +02:00 committed by Michael Zanetti
parent 6aa8d3e5b6
commit 5b6554352e
2 changed files with 6 additions and 1 deletions

View File

@ -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.";

View File

@ -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()