forked from frankframework/frankframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test ClassPath dependencies (frankframework#2366)
- Loading branch information
Showing
18 changed files
with
762 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
aspose/src/test/java/com/testautomationguru/utility/CompareMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.testautomationguru.utility; | ||
|
||
public enum CompareMode { | ||
TEXT_MODE, | ||
VISUAL_MODE | ||
} |
46 changes: 46 additions & 0 deletions
46
aspose/src/test/java/com/testautomationguru/utility/ImageUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.testautomationguru.utility; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
import javax.imageio.ImageIO; | ||
|
||
class ImageUtil { | ||
|
||
static Logger logger = Logger.getLogger(ImageUtil.class.getName()); | ||
|
||
static boolean compareAndHighlight(final BufferedImage img1, final BufferedImage img2, String fileName, boolean highlight, int colorCode) throws IOException { | ||
|
||
final int w = img1.getWidth(); | ||
final int h = img1.getHeight(); | ||
final int[] p1 = img1.getRGB(0, 0, w, h, null, 0, w); | ||
final int[] p2 = img2.getRGB(0, 0, w, h, null, 0, w); | ||
|
||
if(!(java.util.Arrays.equals(p1, p2))) { | ||
logger.warning("Image compared - does not match"); | ||
if(highlight) { | ||
for(int i = 0; i < p1.length; i++) { | ||
if(p1[i] != p2[i]) { | ||
p1[i] = colorCode; | ||
} | ||
} | ||
final BufferedImage out = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); | ||
out.setRGB(0, 0, w, h, p1, 0, w); | ||
saveImage(out, fileName); | ||
} | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
static void saveImage(BufferedImage image, String file) { | ||
try { | ||
File outputfile = new File(file); | ||
ImageIO.write(image, "png", outputfile); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
Oops, something went wrong.