summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJules Clero <jules.clro@intel.com>2014-07-04 15:51:07 +0200
committerPhilippe Afonso <philippex.afonso@intel.com>2015-01-29 11:31:39 +0100
commit75461a26a74a4d9cb60020ccfcb2a5a4ec0961bd (patch)
tree4ccbb40c518cb10da26e67bff0bed2643c984895 /test
parent8526bbf8774b9751904703358d6b5efab5efa530 (diff)
downloadexternal_parameter-framework-75461a26a74a4d9cb60020ccfcb2a5a4ec0961bd.zip
external_parameter-framework-75461a26a74a4d9cb60020ccfcb2a5a4ec0961bd.tar.gz
external_parameter-framework-75461a26a74a4d9cb60020ccfcb2a5a4ec0961bd.tar.bz2
Fix test-platform set criterion by Lexical State Bug
BZ: 213233 The setCriterionState command of the Test Platform was setting undesired value when asking for multiple states to an InclusiveCriterion. The method used in setCriterionStateByLexicalSpace was to parse arguments before to get numerical value for each of them with the getNumericalValue method from ISelectionCriterionTypeInterface. Then, different masks were aggregated to set the criterion's state. Regarding the getNumericalValue method behaviour which parses automatically value arguments, this method leads to undesired bytes in the mask which leads to undesired criterion's state. The solution is to aggregate the setCriterionState arguments when more than one arg are used. As getNumericalValue use | to split his first parameter, the code has been modified to use this behaviour. getNumericalValue is now called only one time and the returned mask is directly used to set criterion's state. Change-Id: Ie3a1d79a6f66928a2418f11233ff0d1ef5c3e900 Signed-off-by: Jules Clero <jules.clero@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/test-platform/TestPlatform.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp
index b2b895c..e4b7ee1 100644
--- a/test/test-platform/TestPlatform.cpp
+++ b/test/test-platform/TestPlatform.cpp
@@ -462,30 +462,35 @@ bool CTestPlatform::setCriterionStateByLexicalSpace(const IRemoteCommand& remote
}
/// Translate lexical state to numerical state
- uint32_t uiNumericalState = 0;
+ int iNumericalState = 0;
uint32_t uiLexicalSubStateIndex;
// Parse lexical substates
+ std::string strLexicalState = "";
for (uiLexicalSubStateIndex = 1; uiLexicalSubStateIndex <= uiNbSubStates; uiLexicalSubStateIndex++) {
+ /*
+ * getNumericalValue method from ISelectionCriterionTypeInterface strip his parameter
+ * first parameter based on | sign. In case that the user uses multiple parameters
+ * to set InclusiveCriterion value, we aggregate all desired values to be sure
+ * they will be handled correctly.
+ */
+ if (uiLexicalSubStateIndex != 1) {
+ strLexicalState += "|";
+ }
+ strLexicalState += remoteCommand.getArgument(uiLexicalSubStateIndex);
+ }
- int iNumericalSubState;
-
- const std::string& strLexicalSubState = remoteCommand.getArgument(uiLexicalSubStateIndex);
-
- // Translate lexical to numerical substate
- if (!pCriterionType->getNumericalValue(strLexicalSubState, iNumericalSubState)) {
-
- strResult = "Unable to find lexical state \"" + strLexicalSubState + "\" in criteria " + strCriterionName;
+ // Translate lexical to numerical substate
+ if (!pCriterionType->getNumericalValue(strLexicalState, iNumericalState)) {
- return false;
- }
+ strResult = "Unable to find lexical state \""
+ + strLexicalState + "\" in criteria " + strCriterionName;
- // Aggregate numerical substates
- uiNumericalState |= iNumericalSubState;
+ return false;
}
// Set criterion new state
- pCriterion->setCriterionState(uiNumericalState);
+ pCriterion->setCriterionState(iNumericalState);
return true;
}