get around registered PLotReferenceImages by downloading source of tags
This commit is contained in:
parent
63f8f52c9f
commit
a3be970f29
16
REQUIRE
Normal file
16
REQUIRE
Normal file
@ -0,0 +1,16 @@
|
||||
julia 1.0
|
||||
|
||||
RecipesBase 0.6.0
|
||||
PlotUtils 0.4.1
|
||||
PlotThemes 0.1.3
|
||||
Reexport
|
||||
GeometryTypes
|
||||
FixedPointNumbers 0.3
|
||||
Measures
|
||||
Showoff
|
||||
StatsBase 0.14.0
|
||||
JSON
|
||||
NaNMath
|
||||
Requires
|
||||
Contour
|
||||
GR 0.39.0
|
||||
1
test/.gitignore
vendored
Normal file
1
test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
reference_images
|
||||
11
test/REQUIRE
Normal file
11
test/REQUIRE
Normal file
@ -0,0 +1,11 @@
|
||||
FileIO
|
||||
ImageMagick
|
||||
Images
|
||||
LaTeXStrings
|
||||
RDatasets
|
||||
Random
|
||||
StatsPlots
|
||||
Test
|
||||
UnicodePlots
|
||||
VisualRegressionTests
|
||||
BinaryProvider
|
||||
@ -1,26 +1,7 @@
|
||||
|
||||
using VisualRegressionTests
|
||||
# using ExamplePlots
|
||||
|
||||
if isinteractive()
|
||||
@eval Main import Gtk
|
||||
end
|
||||
|
||||
# import DataFrames, RDatasets
|
||||
|
||||
# don't let pyplot use a gui... it'll crash
|
||||
# note: Agg will set gui -> :none in PyPlot
|
||||
# ENV["MPLBACKEND"] = "Agg"
|
||||
# try
|
||||
# @eval import PyPlot
|
||||
# @info("Matplotlib version: $(PyPlot.matplotlib[:__version__])")
|
||||
# end
|
||||
|
||||
|
||||
using Plots
|
||||
# using StatsPlots
|
||||
import PlotReferenceImages
|
||||
using Random
|
||||
using BinaryProvider
|
||||
using Test
|
||||
|
||||
default(size=(500,300))
|
||||
@ -31,6 +12,33 @@ default(size=(500,300))
|
||||
|
||||
import Plots._current_plots_version
|
||||
|
||||
# Taken from MakieGallery
|
||||
"""
|
||||
Downloads the reference images from ReferenceImages for a specific version
|
||||
"""
|
||||
function download_reference(version = v"0.0.1")
|
||||
download_dir = abspath(@__DIR__, "reference_images")
|
||||
isdir(download_dir) || mkpath(download_dir)
|
||||
tarfile = joinpath(download_dir, "reference_images.zip")
|
||||
url = "https://github.com/JuliaPlots/PlotReferenceImages.jl/archive/v$(version).tar.gz"
|
||||
refpath = joinpath(download_dir, "PlotReferenceImages.jl-$(version)")
|
||||
if !isdir(refpath) # if not yet downloaded
|
||||
@info "downloading reference images for version $version"
|
||||
download(url, tarfile)
|
||||
BinaryProvider.unpack(tarfile, download_dir)
|
||||
# check again after download
|
||||
if !isdir(refpath)
|
||||
error("Something went wrong while downloading reference images. Plots can't be compared to references")
|
||||
else
|
||||
rm(tarfile, force = true)
|
||||
end
|
||||
else
|
||||
@info "using reference images for version $version (already downloaded)"
|
||||
end
|
||||
refpath
|
||||
end
|
||||
|
||||
const ref_image_dir = download_reference()
|
||||
|
||||
function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], tol = 1e-2)
|
||||
Plots._debugMode.on = debug
|
||||
@ -43,8 +51,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is
|
||||
Random.seed!(1234)
|
||||
|
||||
# reference image directory setup
|
||||
# refdir = joinpath(Pkg.dir("ExamplePlots"), "test", "refimg", string(pkg))
|
||||
refdir = joinpath(dirname(pathof(PlotReferenceImages)), "..", "Plots", string(pkg))
|
||||
refdir = joinpath(ref_image_dir, "Plots", string(pkg))
|
||||
fn = "ref$idx.png"
|
||||
|
||||
# firgure out version info
|
||||
|
||||
@ -2,9 +2,6 @@ module PlotsTests
|
||||
|
||||
using Pkg
|
||||
|
||||
# This should be fine since it's run in it's own test env?
|
||||
pkg"add https://github.com/JuliaPlots/PlotReferenceImages.jl.git"
|
||||
|
||||
include("imgcomp.jl")
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user