add tests

This commit is contained in:
Simon Christ 2019-11-18 17:16:27 +01:00
parent c39613ddd8
commit 1e2ea1614c
4 changed files with 21 additions and 1 deletions

View File

@ -47,6 +47,7 @@ ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd" StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
@ -55,4 +56,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
[targets] [targets]
test = ["FileIO", "GeometryTypes", "Gtk", "ImageMagick", "Images", "LaTeXStrings", "LibGit2", "Random", "RDatasets", "StatsPlots", "Test", "UnicodePlots", "VisualRegressionTests"] test = ["FileIO", "GeometryTypes", "Gtk", "ImageMagick", "Images", "LaTeXStrings", "LibGit2", "PGFPlotsX", "Random", "RDatasets", "StatsPlots", "Test", "UnicodePlots", "VisualRegressionTests"]

View File

@ -567,18 +567,22 @@ function _update_plot_object(plt::Plot{PGFPlotsXBackend})
end end
function _show(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsXBackend}) function _show(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsXBackend})
_update_plot_object(plt)
show(io, mime, plt.o) show(io, mime, plt.o)
end end
function _show(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsXBackend}) function _show(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsXBackend})
_update_plot_object(plt)
show(io, mime, plt.o) show(io, mime, plt.o)
end end
function _show(io::IO, mime::MIME"image/png", plt::Plot{PGFPlotsXBackend}) function _show(io::IO, mime::MIME"image/png", plt::Plot{PGFPlotsXBackend})
_update_plot_object(plt)
show(io, mime, plt.o) show(io, mime, plt.o)
end end
function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsXBackend}) function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsXBackend})
_update_plot_object(plt)
PGFPlotsX.print_tex(plt.o) PGFPlotsX.print_tex(plt.o)
end end

View File

@ -8,6 +8,8 @@ using Gtk
using LibGit2 using LibGit2
using GeometryTypes using GeometryTypes
include("test_pgfplotsx.jl")
reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...) reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
function reference_file(backend, i, version) function reference_file(backend, i, version)

13
test/test_pgfplotsx.jl Normal file
View File

@ -0,0 +1,13 @@
using Plots, Test
pgfplotsx()
function create_plot( args...; kwargs... )
pgfx_plot = plot(args..., kwargs...)
return pgfx_plot, repr("application/x-tex", pgfx_plot)
end
@testset "PGFPlotsX" begin
pgfx_plot, pgfx_tex = create_plot(1:5)
@test pgfx_plot.o isa PGFPlotsX.GroupPlot
end # testset