Skip to content

Commit 5458c76

Browse files
committed
add 2D and 3D test for flips: flip dimension size of 1 means identity operation
1 parent c05656f commit 5458c76

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/projective/affine.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,26 @@ include("../imports.jl")
139139
@test_nowarn apply!(buffer, tfm, image2)
140140
end
141141

142+
@testset ExtendedTestSet "FlipX 2D: flip dimension of 1 = identity" begin
143+
tfm = FlipX{2}()
144+
img = rand(RGB, 10, 1)
145+
item = Image(img)
146+
@test_nowarn titem = apply(tfm, item)
147+
titem = apply(tfm, item)
148+
@test itemdata(titem) == img
149+
end
150+
151+
@testset ExtendedTestSet "FlipZ 3D: flip dimension of 1 = identity" begin
152+
tfm = FlipZ{3}()
153+
img = rand(RGB, 10, 10, 1)
154+
item = Image(img)
155+
@test_nowarn titem = apply(tfm, item)
156+
titem = apply(tfm, item)
157+
@test itemdata(titem) == img
158+
end
159+
142160
@testset ExtendedTestSet "`RandomCrop` correct indices" begin
143-
# Flipping and cropping should be the same as reverse-indexing
161+
# Flipping followed by cropping should be the same as reverse-indexing
144162
# the flipped dimension
145163
tfm = FlipX{2}() |> RandomCrop((64, 64)) |> PinOrigin()
146164
img = rand(RGB, 64, 64)

0 commit comments

Comments
 (0)