[289739, 323933] WCAG 2.0/JIS support (level AA)
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
index 7060e2d..ccebac3 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and Others
+ * Copyright (c) 2005, 2011 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,74 +14,78 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.actf.visualization.eval.problem.ILowvisionProblemSubtype;
import org.eclipse.actf.visualization.eval.problem.IProblemItem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ColorProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.LowVisionProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.LowVisionProblemGroup;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ProblemItemLV;
-
-
public class LowVisionProblemConverter {
- public static List<IProblemItem> convert(LowVisionProblemGroup[] target, String urlS, int frameId) {
+ public static List<IProblemItem> convert(LowVisionProblemGroup[] target,
+ String urlS, int frameId) {
- ArrayList<IProblemItem> result = new ArrayList<IProblemItem>();
+ ArrayList<IProblemItem> result = new ArrayList<IProblemItem>();
- for (int i = 0; i < target.length; i++) {
+ for (int i = 0; i < target.length; i++) {
- ProblemItemLV tmp = new ProblemItemLV("L_" + target[i].getLowVisionProblemType()); //$NON-NLS-1$
- tmp.setSubType(target[i].getLowVisionProblemType());
- try {
- tmp.setDescription(target[i].getDescription());
- } catch (Exception e) {
- tmp.setDescription("unknown"); //$NON-NLS-1$
- }
- tmp.setCanHighlight(true);
+ ProblemItemLV tmp = new ProblemItemLV(
+ "L_" + target[i].getLowVisionProblemType()); //$NON-NLS-1$
+ tmp.setSubType(target[i].getLowVisionProblemType());
+ try {
+ if (tmp.getSubType() != ILowvisionProblemSubtype.LOWVISION_BACKGROUND_IMAGE_WARNING) {
+ tmp.setDescription(target[i].getDescription());
+ }
+ } catch (Exception e) {
+ tmp.setDescription("unknown"); //$NON-NLS-1$
+ }
+ tmp.setCanHighlight(true);
+ tmp.setFrameId(frameId);
+ tmp.setFrameUrl(urlS);
- tmp.setFrameId(frameId);
- tmp.setFrameUrl(urlS);
+ tmp.setSeverityLV(target[i].getIntProbability());// TODO
+ tmp.setForeground(getLVProblemColorString(target[i], true));
+ tmp.setBackground(getLVProblemColorString(target[i], false));
+ tmp.setX(target[i].getX());
+ tmp.setY(target[i].getY());
+ tmp.setWidth(target[i].getWidth());
+ tmp.setHeight(target[i].getHeight());
+ tmp.setArea(target[i].getWidth() * target[i].getHeight());
+
+ // TODO recommendation
+ result.add(tmp);
+ }
- tmp.setSeverityLV(target[i].getIntProbability());//TODO
- tmp.setForeground(getLVProblemColorString(target[i], true));
- tmp.setBackground(getLVProblemColorString(target[i], false));
- tmp.setX(target[i].getX());
- tmp.setY(target[i].getY());
- tmp.setWidth(target[i].getWidth());
- tmp.setHeight(target[i].getHeight());
- tmp.setArea(target[i].getWidth() * target[i].getHeight());
+ return (result);
+ }
- //TODO recommendation
- result.add(tmp);
- }
+ private static String getLVProblemColorString(
+ LowVisionProblemGroup problem, boolean isFore) {
+ int probType;
+ int origAll;
+ int origR;
+ int origG;
+ int origB;
- return (result);
- }
+ probType = problem.getLowVisionProblemType();
- private static String getLVProblemColorString(LowVisionProblemGroup problem, boolean isFore) {
- int probType;
- int origAll;
- int origR;
- int origG;
- int origB;
-
- probType = problem.getLowVisionProblemType();
-
- if (probType == LowVisionProblem.LOWVISION_COLOR_PROBLEM) {
- ColorProblem cp = (ColorProblem) (problem.getRepresentative());
- if (isFore) {
- origAll = cp.getForegroundColor();
- } else {
- origAll = cp.getBackgroundColor();
- }
- origR = origAll >> 16 & 0xff;
- origG = origAll >> 8 & 0xff;
- origB = origAll & 0xff;
- return origR + "," + origG + "," + origB; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- return " "; //$NON-NLS-1$
- }
- }
+ if (probType == LowVisionProblem.LOWVISION_COLOR_PROBLEM
+ || probType == LowVisionProblem.LOWVISION_BACKGROUND_IMAGE_WARNING) {
+ ColorProblem cp = (ColorProblem) (problem.getRepresentative());
+ if (isFore) {
+ origAll = cp.getForegroundColor();
+ } else {
+ origAll = cp.getBackgroundColor();
+ }
+ origR = origAll >> 16 & 0xff;
+ origG = origAll >> 8 & 0xff;
+ origB = origAll & 0xff;
+ return origR + "," + origG + "," + origB; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ return " "; //$NON-NLS-1$
+ }
+ }
}
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 6490b32..55f37d6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2011 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -133,6 +133,7 @@
try {
foregroundColor = (new ColorCSS(fgStr)).toInt();
backgroundColor = (new ColorCSS(bgStr)).toInt();
+
} catch (ColorException e) {
e.printStackTrace();
throw new ImageException("Could not interpret colors."); //$NON-NLS-1$
@@ -289,16 +290,26 @@
W3CColorChecker w3c = new W3CColorChecker(fgSim, bgSim);
double severity = w3c.calcSeverity();
- if (severity <= 0.0) {
- return (null);
- } else {
- try {
- return (new ColorProblem(this, _lvType, severity));
- } catch (LowVisionProblemException e) {
- e.printStackTrace();
+ try {
+ if (severity <= 0.0) {
+ if (style.getBackgroundImage() != null
+ && !style.getBackgroundImage().equalsIgnoreCase("none")) {
+ ColorProblem result = new ColorProblem(this, _lvType, 0);
+ result.setHasBackgroundImage(true);
+ return (result);
+ }
return (null);
+ } else {
+ ColorProblem result = new ColorProblem(this, _lvType, severity);
+ if (style.getBackgroundImage() != null
+ && !style.getBackgroundImage().equalsIgnoreCase("none"))
+ result.setHasBackgroundImage(true);
+ return (result);
}
+ } catch (LowVisionProblemException e) {
+ return (null);
}
+
}
/*
@@ -343,6 +354,8 @@
String fontStr = style.getFontSize().toLowerCase();
+ System.out.println(fontStr);
+
// directly under the <BODY>
if (fontStr.indexOf(DELIM) == -1) {
fontStr = digitToFontSetting(fontStr);
@@ -684,8 +697,8 @@
scaling *= (value / 100.0);
} else if (curType == FONT_SIZE_EM) {
double value = 0.0;
- value = Double.parseDouble(curFontSize.substring(0, curFontSize
- .length() - 2));
+ value = Double.parseDouble(curFontSize.substring(0,
+ curFontSize.length() - 2));
if (curFontSize.endsWith("ex")) {
value /= 2.0;
}
@@ -704,8 +717,8 @@
curFontSize = IE_LARGEST_FONT;
}
- float value = Float.parseFloat(curFontSize.substring(0, curFontSize
- .length() - 2));
+ float value = Float.parseFloat(curFontSize.substring(0,
+ curFontSize.length() - 2));
float sizeInMm = 0.0f;
if (curFontSize.endsWith("in")) {
sizeInMm = LengthUtil.in2mm(value);
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 d2a818a..ad9f5fb 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2011 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@
public class ColorProblem extends LowVisionProblem{
private int foregroundColor = -1;
private int backgroundColor = -1;
+ private boolean hasBackgroundImage = false;
public ColorProblem( PageComponent _pc, LowVisionType _lvType, double _proba ) throws LowVisionProblemException{
super( LOWVISION_COLOR_PROBLEM, _lvType, Messages.ColorProblem_Foreground_and_background_colors_are_too_close__1, _pc, _proba );
@@ -72,4 +73,17 @@
public int getBackgroundColor(){
return( backgroundColor );
}
+
+ public boolean isHasBackgroundImage() {
+ return hasBackgroundImage;
+ }
+
+ public void setHasBackgroundImage(boolean hasBackgroundImage) {
+ this.hasBackgroundImage = hasBackgroundImage;
+ if(hasBackgroundImage){
+ problemType = LOWVISION_BACKGROUND_IMAGE_WARNING;
+ }else{
+ problemType = LOWVISION_COLOR_PROBLEM;
+ }
+ }
}
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ProblemItemLV.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ProblemItemLV.java
index 219ccac..f07f42d 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ProblemItemLV.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ProblemItemLV.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and Others
+ * Copyright (c) 2005, 2011 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -71,7 +71,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getBackgroundS()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getBackgroundS
+ * ()
*/
public String getBackground() {
return backgroundS;
@@ -80,7 +82,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getForegroundS()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getForegroundS
+ * ()
*/
public String getForeground() {
return foregroundS;
@@ -89,7 +93,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameId()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameId
+ * ()
*/
public int getFrameId() {
return frameId;
@@ -98,7 +104,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameOffset()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameOffset
+ * ()
*/
public int getFrameOffset() {
return frameOffset;
@@ -107,7 +115,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameUrlS()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getFrameUrlS
+ * ()
*/
public String getFrameUrl() {
return frameUrlS;
@@ -120,7 +130,8 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getIconId()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getIconId()
*/
public int getIconId() {
return iconId;
@@ -129,7 +140,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getImageIcon()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getImageIcon
+ * ()
*/
public Image getIconImage() {
// return imageIcon;
@@ -162,7 +175,8 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getImageIconTooltip()
+ * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#
+ * getImageIconTooltip()
*/
public String getIconTooltip() {
// return imageIcon;
@@ -173,7 +187,7 @@
case ICON_BLUR:
return ERR_BOKE + SPACE + ERR_HIGHLIGHT;
default:
- //System.out.println("Icon not found: " + iconId);
+ // System.out.println("Icon not found: " + iconId);
return ERR_COMPLIANCEALERT + SPACE + ERR_HIGHLIGHT;
}
@@ -184,7 +198,7 @@
case ICON_BLUR:
return ERR_BOKE;
default:
- //System.out.println("Icon not found: " + iconId);
+ // System.out.println("Icon not found: " + iconId);
return ERR_COMPLIANCEALERT;
}
}
@@ -193,7 +207,9 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getSeverityLV()
+ * @see
+ * org.eclipse.actf.visualization.eval.problem.IProblemItemImage#getSeverityLV
+ * ()
*/
public int getSeverityLV() {
return severityLV;
@@ -259,7 +275,8 @@
this.subType = subType;
// TODO
if (subType == LOWVISION_COLOR_PROBLEM
- || subType == LOWVISION_IMAGE_COLOR_PROBLEM) {
+ || subType == LOWVISION_IMAGE_COLOR_PROBLEM
+ || subType == LOWVISION_BACKGROUND_IMAGE_WARNING) {
iconId = ICON_COLOR;
} else {
iconId = ICON_BLUR;
diff --git a/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java b/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
index e941eec..4f1dccf 100644
--- a/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
+++ b/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and Others
+ * Copyright (c) 2005, 2011 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -72,8 +72,8 @@
public String getOverview() {
StringBuffer tmpSB = new StringBuffer(512);
- int problemCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0 };
- int severeCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0 };
+ int problemCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int severeCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
for (int i = 0; i < _problems.length; i++) {
IProblemItemImage curProblem = _problems[i];