fixed packRule
This commit is contained in:
parent
48b09ecf01
commit
79cbab42a1
@ -496,13 +496,11 @@ QVariantMap JsonTypes::packRule(const Rule &rule)
|
|||||||
foreach (const Action &action, rule.actions()) {
|
foreach (const Action &action, rule.actions()) {
|
||||||
actionList.append(JsonTypes::packAction(action));
|
actionList.append(JsonTypes::packAction(action));
|
||||||
}
|
}
|
||||||
if (!rule.exitActions().isEmpty()) {
|
QVariantList exitActionList;
|
||||||
QVariantList exitActionList;
|
foreach (const Action &action, rule.exitActions()) {
|
||||||
foreach (const Action &action, rule.exitActions()) {
|
exitActionList.append(JsonTypes::packAction(action));
|
||||||
exitActionList.append(JsonTypes::packAction(action));
|
|
||||||
}
|
|
||||||
ruleMap.insert("exitActions", exitActionList);
|
|
||||||
}
|
}
|
||||||
|
ruleMap.insert("exitActions", exitActionList);
|
||||||
|
|
||||||
ruleMap.insert("actions", actionList);
|
ruleMap.insert("actions", actionList);
|
||||||
ruleMap.insert("stateEvaluator", JsonTypes::packStateEvaluator(rule.stateEvaluator()));
|
ruleMap.insert("stateEvaluator", JsonTypes::packStateEvaluator(rule.stateEvaluator()));
|
||||||
|
|||||||
@ -182,7 +182,7 @@ void TestRules::addRemoveRules_data()
|
|||||||
QTest::addColumn<QString>("name");
|
QTest::addColumn<QString>("name");
|
||||||
|
|
||||||
|
|
||||||
QTest::newRow("valid rule. 1 EventDescriptor, StateEvaluator, 1 Action, enabled, name") << true << validActionNoParams << validEventDescriptor1 << QVariantList() << validStateEvaluator << RuleEngine::RuleErrorNoError << false << "TestRule";
|
QTest::newRow("valid rule. 1 EventDescriptor, StateEvaluator, 1 Action, enabled, name") << true << validActionNoParams << validEventDescriptor1 << QVariantList() << validStateEvaluator << RuleEngine::RuleErrorNoError << true << "TestRule";
|
||||||
QTest::newRow("valid rule. 1 EventDescriptor, StateEvaluator, 1 Action, diabled, name") << false << validActionNoParams << validEventDescriptor1 << QVariantList() << validStateEvaluator << RuleEngine::RuleErrorNoError << false << "TestRule";
|
QTest::newRow("valid rule. 1 EventDescriptor, StateEvaluator, 1 Action, diabled, name") << false << validActionNoParams << validEventDescriptor1 << QVariantList() << validStateEvaluator << RuleEngine::RuleErrorNoError << false << "TestRule";
|
||||||
QTest::newRow("valid rule. 2 EventDescriptors, 1 Action, name") << true << validActionNoParams << QVariantMap() << eventDescriptorList << validStateEvaluator << RuleEngine::RuleErrorNoError << false << "TestRule";
|
QTest::newRow("valid rule. 2 EventDescriptors, 1 Action, name") << true << validActionNoParams << QVariantMap() << eventDescriptorList << validStateEvaluator << RuleEngine::RuleErrorNoError << false << "TestRule";
|
||||||
QTest::newRow("invalid rule: eventDescriptor and eventDescriptorList used") << true << validActionNoParams << validEventDescriptor1 << eventDescriptorList << validStateEvaluator << RuleEngine::RuleErrorInvalidParameter << false << "TestRule";
|
QTest::newRow("invalid rule: eventDescriptor and eventDescriptorList used") << true << validActionNoParams << validEventDescriptor1 << eventDescriptorList << validStateEvaluator << RuleEngine::RuleErrorInvalidParameter << false << "TestRule";
|
||||||
|
|||||||
Reference in New Issue
Block a user