Skip to content
Discussion options

You must be logged in to vote

Hi, We already have a comparator in the test for the images, that does more or less as your snippet in Test_org_eclipse_swt_graphics_Image

private Comparator<ImageData> imageDataComparator() {
	return Comparator.<ImageData>comparingInt(d -> d.width) //
			.thenComparing(d -> d.height) //
			.thenComparing((ImageData firstData, ImageData secondData) -> {
				for (int x = 0; x < firstData.width; x++) {
					for (int y = 0; y < firstData.height; y++) {
						if (firstData.getPixel(x, y) != secondData.getPixel(x, y)) {
							return -1;
						}
						if (firstData.getAlpha(x, y) != secondData.getAlpha(x, y)) {
							return -1;
						}
					}
				}
				return 0;
			});
}

I am not 100% sure a…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jonahgraham
Comment options

jonahgraham Oct 24, 2025
Collaborator Author

@ShahzaibIbrahim
Comment options

@jonahgraham
Comment options

jonahgraham Oct 24, 2025
Collaborator Author

@jonahgraham
Comment options

jonahgraham Oct 24, 2025
Collaborator Author

@jonahgraham
Comment options

jonahgraham Oct 25, 2025
Collaborator Author

Answer selected by jonahgraham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants