Skip to content

Commit d635b9e

Browse files
calbert-hallCasey Albert-Hall
andauthored
Support for Accessibility Regions
Add accessibility regions to ImageTester options. Co-authored-by: Casey Albert-Hall <casey@Caseys-MacBook-Pro.local>
1 parent b2c0129 commit d635b9e

File tree

15 files changed

+210
-79
lines changed

15 files changed

+210
-79
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Artifacts/
77
debug/
88
src/test/java/Private/
99
TestData/Private/
10-
output
10+
output
11+
dependency-reduced-pom.xml

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ The tool build in java and requires minimal set of parameters the minimal comman
103103
**Example:** `-ir "300,300,500,100|500,500,200,200"` will create layout regions at <br>
104104
+ x:300, y:300, with width:500, height:100 and <br>
105105
+ x:500, y:500, with width:200, height:200 <br>
106+
+ `-ari` - Accessibility ignore regions will be applied to all pages. <br>
107+
**Example:** `-ari "300,300,500,100|500,500,200,200"` will create accessibility ignore regions at <br>
108+
+ x:300, y:300, with width:500, height:100 and <br>
109+
+ x:500, y:500, with width:200, height:200 <br>
110+
+ `-arr` - Accessibility regular text regions will be applied to all pages. Without coordinates, region will be the viewport size. <br>
111+
**Example:** `-arr "300,300,500,100|500,500,200,200"` will create accessibility regular text regions at <br>
112+
+ x:300, y:300, with width:500, height:100 and <br>
113+
+ x:500, y:500, with width:200, height:200 <br>
114+
+ `-arl` - Accessibility large text regions will be applied to all pages. Without coordinates, region will be the viewport size. <br>
115+
**Example:** `-arl "300,300,500,100|500,500,200,200"` will create accessibility large text regions at <br>
116+
+ x:300, y:300, with width:500, height:100 and <br>
117+
+ x:500, y:500, with width:200, height:200 <br>
118+
+ `-arb` - Accessibility bold text regions will be applied to all pages. Without coordinates, region will be the viewport size. <br>
119+
**Example:** `-arb "300,300,500,100|500,500,200,200"` will create accessibility bold text regions at <br>
120+
+ x:300, y:300, with width:500, height:100 and <br>
121+
+ x:500, y:500, with width:200, height:200 <br>
122+
+ `-arg` - Accessibility graphic regions will be applied to all pages. Without coordinates, region will be the viewport size. <br>
123+
**Example:** `-arg "300,300,500,100|500,500,200,200"` will create accessibility graphics regions at <br>
124+
+ x:300, y:300, with width:500, height:100 and <br>
125+
+ x:500, y:500, with width:200, height:200 <br>
106126

107127
### Using The Batch Mapper
108128
The Batch Mapper is a feature that allows you to specify tests from a CSV instead of supplying a path or file in the traditional way.

dependency-reduced-pom.xml

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/main/java/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Manifest-Version: 1.0
22
Main-Class: com.yanirta.ImageTester
33
Implementation-Version: 3.0.4
4+

src/main/java/com/yanirta/BatchObjects/PDFFileBatch.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.yanirta.BatchObjects;
22

3+
import com.applitools.eyes.images.ImagesCheckSettings;
34
import com.yanirta.TestObjects.IDisposable;
5+
import com.yanirta.TestObjects.ImagesCheckSettingsFactory;
46
import com.yanirta.TestObjects.TestBase;
57
import com.applitools.eyes.BatchInfo;
68
import com.applitools.eyes.TestResults;
@@ -39,7 +41,7 @@ public TestResults run(Eyes eyes) throws Exception {
3941
BufferedImage bim = safeRender();
4042
if (!eyes.getIsOpen())
4143
eyes.open(appName(), name(), viewport(bim));
42-
eyes.checkImage(bim, name());
44+
eyes.check(name(), new ImagesCheckSettingsFactory(bim, config(), viewport(bim)).create());
4345
return eyes.close(false);
4446
}
4547

src/main/java/com/yanirta/ImageTester.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ public static void main(String[] args) {
104104
config.setIgnoreRegions(cmd.getOptionValue("ir", null));
105105
config.setContentRegions(cmd.getOptionValue("cr", null));
106106
config.setLayoutRegions(cmd.getOptionValue("lr", null));
107+
config.setAccessibilityIgnoreRegions(cmd.getOptionValue("ari", null));
108+
config.setAccessibilityRegularTextRegions(cmd.getOptionValue("arr", null));
109+
config.setAccessibilityLargeTextRegions(cmd.getOptionValue("arl", null));
110+
config.setAccessibilityBoldTextRegions(cmd.getOptionValue("arb", null));
111+
config.setAccessibilityGraphicsRegions(cmd.getOptionValue("arg", null));
112+
113+
// Full page for ac regions capability
114+
if (cmd.hasOption("arr") && config.accessibilityRegularTextRegions == null) {
115+
config.accessibilityRegularTextFullPage = true;
116+
}
117+
if (cmd.hasOption("arl") && config.accessibilityLargeTextRegions == null) {
118+
config.accessibilityLargeTextFullPage = true;
119+
}
120+
if (cmd.hasOption("arb") && config.accessibilityBoldTextRegions == null) {
121+
config.accessibilityBoldTextFullPage = true;
122+
}
123+
if (cmd.hasOption("arg") && config.accessibilityGraphicsRegions== null) {
124+
config.accessibilityGraphicsFullPage = true;
125+
}
107126

108127
File root = new File(cmd.getOptionValue("f", "."));
109128

@@ -442,6 +461,36 @@ private static Options getOptions() {
442461
.longOpt("throwExceptions")
443462
.desc("Throw exceptions on test failure")
444463
.build());
464+
options.addOption(Option.builder("ari")
465+
.longOpt("accessibility region: ignore")
466+
.desc("Parameters for accessibility ignore regions [x, y, width, height]")
467+
.hasArgs()
468+
.optionalArg(true)
469+
.build());
470+
options.addOption(Option.builder("arr")
471+
.longOpt("accessibility region: regular text")
472+
.desc("Parameters for accessibility regular text regions [x, y, width, height]")
473+
.hasArgs()
474+
.optionalArg(true)
475+
.build());
476+
options.addOption(Option.builder("arl")
477+
.longOpt("accessibility region: large text")
478+
.desc("Parameters for accessibility large text regions [x, y, width, height]")
479+
.hasArgs()
480+
.optionalArg(true)
481+
.build());
482+
options.addOption(Option.builder("arb")
483+
.longOpt("accessibility region: bold text")
484+
.desc("Parameters for accessibility bold text regions [x, y, width, height]")
485+
.hasArgs()
486+
.optionalArg(true)
487+
.build());
488+
options.addOption(Option.builder("arg")
489+
.longOpt("accessibility region: graphic")
490+
.desc("Parameters for accessibility graphics regions [x, y, width, height]")
491+
.hasArgs()
492+
.optionalArg(true)
493+
.build());
445494

446495
EyesUtilitiesConfig.injectOptions(options);
447496
return options;

src/main/java/com/yanirta/TestObjects/BatchMappedPdfFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public TestResults run(Eyes eyes) throws Exception {
3030
eyes.open(appName(), name(), viewport(bim));
3131
eyes.check(
3232
String.format("Page-%s", name()),
33-
new ImagesCheckSettingsFactory(bim, config()).create()
33+
new ImagesCheckSettingsFactory(bim, config(), viewport(bim)).create()
3434
);
3535
bim.getGraphics().dispose();
3636
bim.flush();

src/main/java/com/yanirta/TestObjects/FolderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public TestResults run(Eyes eyes) throws Exception {
3333
if (!eyes.getIsOpen()) eyes.open(appName(), name(), viewport(image));
3434
eyes.check(
3535
img.getName(),
36-
new ImagesCheckSettingsFactory(image, config()).create()
36+
new ImagesCheckSettingsFactory(image, config(), viewport(image)).create()
3737
);
3838
image = null;
3939
} catch (IOException e) {

src/main/java/com/yanirta/TestObjects/ImageFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public TestResults run(Eyes eyes) throws Exception {
1818
eyes.open(appName(), name(), viewport(image));
1919
eyes.check(
2020
file().getName(),
21-
new ImagesCheckSettingsFactory(image, config()).create()
21+
new ImagesCheckSettingsFactory(image, config(), viewport(image)).create()
2222
);
2323
image = null;
2424
return eyes.close(false);

0 commit comments

Comments
 (0)