Fix issue #2649, create unit tests for darkness-checking logic using six images (#5096)

* add images and test too dark

* add dark and proper images and check if too dar

* test: add refer

Co-authored-by: Ruofan <u7307578@anu.edu.au>
This commit is contained in:
gengarrrr 2022-10-29 18:38:32 +08:00 committed by GitHub
parent aa97629cbf
commit 09564c3eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 1 deletions

View file

@ -51,7 +51,30 @@ class ImageUtilsTest {
@Test
fun testCheckIfImageIsTooDarkCaseException() {
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark(""), ImageUtils.IMAGE_OK)
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("")
, ImageUtils.IMAGE_OK)
}
// Refer: testCheckIfImageIsTooDarkCaseException()
@Test
fun testCheckIfProperImageIsTooDark() {
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/ok1.jpg")
, ImageUtils.IMAGE_OK)
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/ok2.jpg")
, ImageUtils.IMAGE_OK)
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/ok3.jpg")
, ImageUtils.IMAGE_OK)
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/ok4.jpg")
, ImageUtils.IMAGE_OK)
}
// Refer: testCheckIfImageIsTooDarkCaseException()
@Test
fun testCheckIfDarkImageIsTooDark() {
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/dark1.jpg")
, ImageUtils.IMAGE_DARK)
Assert.assertEquals(ImageUtils.checkIfImageIsTooDark("src/test/resources/ImageTest/dark2.jpg")
, ImageUtils.IMAGE_DARK)
}
@Test

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 KiB