[289739,323933] WCAG 2.0/JIS support
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
index 9de3f9b..13735b0 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
@@ -28,6 +28,7 @@
ProhibitedBackgroundColorProblem_The_background_color_is_not_allowed_by_the_design_guideline__1=The background color is not allowed by the design guideline.
ContrastRatio = Contrast Ratio
TargetString = Corresponding Texts
+BackgroundImage = (If background image is turned off, the contrast ratio might not be enough.)
#
# lowvision.ScoreUtil
#
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
index e90b376..0fb6d03 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
@@ -28,6 +28,7 @@
ProhibitedBackgroundColorProblem_The_background_color_is_not_allowed_by_the_design_guideline__1 = \u80cc\u666f\u8272\u306b\u30ac\u30a4\u30c9\u30e9\u30a4\u30f3\u3067\u8a31\u3055\u308c\u3066\u3044\u306a\u3044\u8272\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059
ContrastRatio = \u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u6bd4
TargetString = \u5bfe\u8c61\u6587\u5b57\u5217
+BackgroundImage = (\u3082\u3057\u80cc\u666f\u753b\u50cf\u304c\u975e\u8868\u793a\u306b\u3055\u308c\u305f\u5834\u5408\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u6bd4\u306b\u554f\u984c\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002)
#
# lowvision.ScoreUtil
#
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
index bb1bffb..99b980d 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
@@ -42,6 +42,7 @@
public static String ImageDumpUtil_TrueColor;
public static String ContrastRatio;
public static String TargetString;
+ public static String BackgroundImage;
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
index f7e2c4d..617ae45 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
@@ -12,6 +12,8 @@
package org.eclipse.actf.visualization.internal.engines.lowvision;
+import java.util.ArrayList;
+import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -179,7 +181,7 @@
return (new LowVisionProblem[0]);
}
- ColorProblem cp = null;
+ List<ColorProblem> cp = new ArrayList<ColorProblem>();
try {
cp = checkColors(_lvType);
} catch (LowVisionException e) {
@@ -187,9 +189,7 @@
+ this.id);
e.printStackTrace();
}
- if (cp != null) {
- problemVec.addElement(cp);
- }
+ problemVec.addAll(cp);
FixedSizeFontProblem fsfp = null;
try {
@@ -271,26 +271,30 @@
return (problemArray);
}
- private ColorProblem checkColors(LowVisionType _lvType)
+ private List<ColorProblem> checkColors(LowVisionType _lvType)
throws LowVisionException {
+
+ List<ColorProblem> result = new ArrayList<ColorProblem>();
+
if (!isTextTag()) {
- return (null);
+ return (result);
}
try {
if (style.hasDescendantTextWithBGImage()) {
- ColorProblem result = new ColorProblem(this, _lvType, 0);
- result.setElement(style.getElement());
- result.setHasBackgroundImage(true);
- result.setTargetStrings(style.getDescendantTextsWithBGImage());
+ ColorProblem cp = new ColorProblem(this, _lvType, 0);
+ cp.setElement(style.getElement());
+ cp.setHasBackgroundImage(true);
+ cp.setTargetStrings(style.getDescendantTextsWithBGImage());
+ cp.setIsWarning(true);
+ result.add(cp);
+ }
+
+ if (!style.hasChildText()) {
return (result);
}
- if (!style.hasChildText()
- || (style.getComputedBackgroundImage() != null && !style
- .getComputedBackgroundImage().equalsIgnoreCase(
- "none"))) {
- return (null);
- }
+ boolean hasBgImage = (style.getComputedBackgroundImage() != null && !style
+ .getComputedBackgroundImage().equalsIgnoreCase("none"));
ColorIRGB fgOrg = new ColorIRGB(foregroundColor);
ColorIRGB bgOrg = new ColorIRGB(backgroundColor);
@@ -298,16 +302,17 @@
W3CColorChecker w3c = new W3CColorChecker(fgOrg, bgOrg);
double contrast = w3c.calcContrast();
if (contrast < 7) {
- ColorProblem result = new ColorProblem(this, _lvType,
+ ColorProblem cp = new ColorProblem(this, _lvType,
w3c.calcSeverity());
- result.setElement(style.getElement());
- result.setContrast(contrast);
- result.setTargetStrings(style.getChildTexts());
- return (result);
+ cp.setElement(style.getElement());
+ cp.setContrast(contrast);
+ cp.setTargetStrings(style.getChildTexts());
+ cp.setHasBackgroundImage(hasBgImage);
+ result.add(cp);
}
} catch (LowVisionProblemException e) {
}
- return (null);
+ return (result);
/*
* if (!(_lvType.doChangeColors())) { //TODO ColorIRGB fgSim = null;
@@ -381,8 +386,8 @@
short type = fontSizeType(fontStr);
if (type == FONT_SIZE_FIXED) { // not include "pt"
try {
- FixedSizeFontProblem problem = new FixedSizeFontProblem(this, _lvType,
- PageElement.SEVERITY_FIXED_SIZE_FONT);
+ FixedSizeFontProblem problem = new FixedSizeFontProblem(
+ this, _lvType, PageElement.SEVERITY_FIXED_SIZE_FONT);
problem.setElement(style.getElement());
return (problem);
} catch (LowVisionProblemException e) {
@@ -486,8 +491,8 @@
if (fixedFlag) {
try {
- FixedSizeFontProblem problem = new FixedSizeFontProblem(this, _lvType,
- PageElement.SEVERITY_FIXED_SIZE_FONT);
+ FixedSizeFontProblem problem = new FixedSizeFontProblem(this,
+ _lvType, PageElement.SEVERITY_FIXED_SIZE_FONT);
problem.setElement(style.getElement());
return (problem);
} catch (LowVisionProblemException e) {
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorProblem.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorProblem.java
index 9a5250f..c03aa38 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorProblem.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorProblem.java
@@ -76,6 +76,9 @@
public String getAdditionalDescription(){
StringBuffer tmpSB = new StringBuffer();
+ if(hasBackgroundImage&&problemType==LOWVISION_COLOR_PROBLEM){
+ tmpSB.append(Messages.BackgroundImage);
+ }
if(targetStrings!=null && targetStrings.length>0){
tmpSB.append("("+Messages.TargetString+" = ");
for(String tmpS : targetStrings){
@@ -99,17 +102,20 @@
return( backgroundColor );
}
- public boolean isHasBackgroundImage() {
+ public boolean hasBackgroundImage() {
return hasBackgroundImage;
}
public void setHasBackgroundImage(boolean hasBackgroundImage) {
this.hasBackgroundImage = hasBackgroundImage;
- if(hasBackgroundImage){
+ }
+
+ public void setIsWarning(boolean isWarning){
+ if(isWarning){
problemType = LOWVISION_BACKGROUND_IMAGE_WARNING;
}else{
problemType = LOWVISION_COLOR_PROBLEM;
- }
+ }
}
public double getContrast() {