Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel committed Dec 29, 2023
1 parent 5e08da5 commit a4cb3a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions ReferenceTests/src/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ function get_frames(video::AbstractString)
samples = 1:istep:length(aframes)
aframes = aframes[samples]
end
return rgbf_convert.(load.(aframes))
return load.(aframes)
end
end

function compare_images(a::Matrix{<:Union{RGBf,RGBAf}}, b::Matrix{<:Union{RGBf,RGBAf}})
function compare_images(a::AbstractMatrix{<:Union{RGB,RGBA}}, b::AbstractMatrix{<:Union{RGB,RGBA}})

a = rgbf_convert(a)
b = rgbf_convert(b)

if size(a) != size(b)
@warn "images don't have the same size, difference will be Inf"
return Inf
Expand Down Expand Up @@ -52,8 +56,8 @@ end
function compare_media(a::AbstractString, b::AbstractString)
_, ext = splitext(a)
if ext in (".png", ".jpg", ".jpeg", ".JPEG", ".JPG")
imga = rgbf_convert(load(a))
imgb = rgbf_convert(load(b))
imga = load(a)
imgb = load(b)
return compare_images(imga, imgb)
elseif ext in (".mp4", ".gif")
aframes = get_frames(a)
Expand Down
2 changes: 1 addition & 1 deletion ReferenceTests/src/tests/updating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function compare_videos(reference, vpath, dir)
@test n == length(reference)

@test all(1:n) do i
v = ReferenceTests.compare_media(reference[i], to_compare[i])
v = ReferenceTests.compare_images(reference[i], to_compare[i])
return v < 0.02
end
end
Expand Down

0 comments on commit a4cb3a8

Please sign in to comment.