use of org.asqatasun.rules.elementchecker.contrast.exception.ContrastCheckerParseResultException in project Asqatasun by Asqatasun.
the class ContrastChecker method createRemarkOnBadContrastElement.
/**
*
* @param sspHandler
* @param domElement
* @param contrast
* @return the TestSolution
*/
private TestSolution createRemarkOnBadContrastElement(SSPHandler sspHandler, DomElement domElement, String contrast) throws ContrastCheckerParseResultException {
TestSolution testSolution;
String msgCode;
if (domElement.isHidden()) {
// if the result is hidden, the result is NEED_MORE_INFO
testSolution = TestSolution.NEED_MORE_INFO;
msgCode = BAD_CONTRAST_HIDDEN_ELEMENT_MSG;
} else if (alternativeContrastMechanismPresent) {
// An alternative contrast mechanism is provided
testSolution = TestSolution.NEED_MORE_INFO;
msgCode = BAD_CONTRAST_BUT_ALT_MECHANISM_MSG;
} else {
// By default the result is failed
testSolution = TestSolution.FAILED;
msgCode = BAD_CONTRAST_MSG;
}
Element element = DomElementExtractor.getElementFromDomElement(domElement, sspHandler);
if (element != null) {
Collection<EvidenceElement> eeList = new LinkedList<>();
eeList.add(getEvidenceElement(FG_COLOR_EE, domElement.getFgColor()));
eeList.add(getEvidenceElement(BG_COLOR_EE, domElement.getBgColor()));
eeList.add(getEvidenceElement(CONTRAST_EE, contrast));
addSourceCodeRemark(testSolution, element, msgCode, eeList);
} else {
// the test returns not_tested to avoid false positive results
throw new ContrastCheckerParseResultException();
}
return testSolution;
}
Aggregations