Skip to content

Commit

Permalink
fix gtk hang, update refs
Browse files Browse the repository at this point in the history
  • Loading branch information
isentropic committed Jan 21, 2022
1 parent 1829ce8 commit 934fa55
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/gui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ function replace_refimg_dialog(tmpfn, reffn_old; reffn_new = reffn_old)
Gtk.showall(win)

# now ask the question
if Gtk.ask_dialog("Should we make this the new reference image?", "No", "Yes")
replace_refimg(tmpfn, reffn_new)
t = @async begin
state = Gtk.ask_dialog("Should we make this the new reference image?", "No", "Yes")
if state
replace_refimg(tmpfn, reffn_new)
end
end
if !isinteractive()
wait(t)
end

Gtk.destroy(win)
Expand Down
4 changes: 2 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
macro visualtest(testfun, refname, popup=true, tol=0.02)
macro visualtest(testfun, refname, popup=true, tol=1e-3)
esc(quote
testFilename = tempname()*".png"
$testfun(testFilename)
@test test_images(testFilename, $refname, popup=$popup, tol=$tol) |> success
end)
end

macro plottest(plotfun, refname, popup=true, tol=0.02)
macro plottest(plotfun, refname, popup=true, tol=1e-3)
esc(quote
testFilename = tempname()*".png"
if $plotfun isa Function
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function blurdiff(A::AbstractArray, B::AbstractArray, sigma)
Af = imfilter(A, kern, NA())
Bf = imfilter(B, kern, NA())
d = sad(Af, Bf)
diffscale = max(_abs(maxabsfinite(A)), _abs(maxabsfinite(B)))
diffscale = max(_abs(maximum_finite(abs, A)), _abs(maximum_finite(abs, B)))
diffpct = d / (length(Af) * diffscale)

diffpct
Expand Down
Binary file modified test/FuncPlotTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/MorePlotTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/PlotTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 934fa55

Please sign in to comment.