Skip to content

Commit

Permalink
Support gif verification
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed May 29, 2023
1 parent 073a7bb commit b853a3e
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ class SnapshotVerifier @JvmOverloads constructor(
fps: Int
): FrameHandler {
return object : FrameHandler {
var frame = 0
override fun handle(image: BufferedImage) {
// Note: does not handle videos or its frames at the moment
val expected = snapshot.goldenFile(imagesDirectory)
// Note: does not handle videos at the moment
val expected = if (frameCount == 1) {
snapshot.goldenFile(imagesDirectory)
} else {
snapshot.goldenFile(imagesDirectory, frame++)
}
if (!expected.exists()) {
throw AssertionError("File $expected does not exist")
}
Expand All @@ -55,7 +60,9 @@ class SnapshotVerifier @JvmOverloads constructor(
)
}

override fun close() = Unit
override fun close() {
frame = 0
}
}
}

Expand Down

0 comments on commit b853a3e

Please sign in to comment.