diff --git a/.gitignore b/.gitignore index 5532da2..c8ab49e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,15 +7,15 @@ examples/*.pdf examples/*.html examples/*.rst examples/*.tex -test/documents/figures -test/documents/cache -test/documents/output/figures +test/**/cache +test/**/figures test/documents/output/gadfly_formats_test.txt test/**/*.tex test/**/*.md test/**/*.rst test/**/*.html test/**/*.pdf +test/**/*.png test/**/chunk_options.jl !test/**/*ref.* diff --git a/test/documents/plotsjl/plotsjl_test.md.ref b/test/documents/plotsjl/plotsjl_test.md.ref new file mode 100644 index 0000000..e008075 --- /dev/null +++ b/test/documents/plotsjl/plotsjl_test.md.ref @@ -0,0 +1,76 @@ + + +~~~~{.julia} +using Plots +pyplot() +x = linspace(0, 2*pi) +println(x) + +~~~~~~~~~~~~~ + + +~~~~ +linspace(0.0,6.283185307179586,50) +~~~~ + + + +~~~~{.julia} +p = plot(x = x, y = sin(x), size =(900,300)) +~~~~~~~~~~~~~ + + +~~~~ +[Plots.jl] Initializing backend: pyplot +~~~~ + + + + + + +~~~~{.julia} +julia> plot(x = x, y = sin(x)) +Plot{Plots.PyPlotBackend() n=1} +~~~~~~~~~~~~~ + + +![](figures/plotsjl_test_2_1.png)\ + + + + +~~~~{.julia} +plot(rand(100) / 3,reg=true,fill=(0,:green)) +scatter!(rand(100),markersize=6,c=:orange) +~~~~~~~~~~~~~ + + +![](figures/plotsjl_test_3_1.png)\ + + + + +~~~~{.julia} +julia> plot(rand(100) / 3,reg=true,fill=(0,:green)) + +Plot{Plots.PyPlotBackend() n=1} +~~~~~~~~~~~~~ + + +![](figures/plotsjl_test_4_1.png)\ + + +~~~~{.julia} +julia> scatter!(rand(100),markersize=6,c=:orange) +Plot{Plots.PyPlotBackend() n=2} +~~~~~~~~~~~~~ + + +![](figures/plotsjl_test_4_2.png)\ + + + + + +![A random walk.](figures/plotsjl_test_random_1.png) diff --git a/test/documents/plotsjl/plotsjl_test.tex.ref b/test/documents/plotsjl/plotsjl_test.tex.ref new file mode 100644 index 0000000..be4356c --- /dev/null +++ b/test/documents/plotsjl/plotsjl_test.tex.ref @@ -0,0 +1,58 @@ + + +\begin{juliacode} +using Plots +pyplot() +x = linspace(0, 2*pi) +println(x) + +\end{juliacode} +\begin{juliaout} +linspace(0.0,6.283185307179586,50) +\end{juliaout} + +\begin{juliacode} +p = plot(x = x, y = sin(x), size =(900,300)) +\end{juliacode} + + + + +\begin{juliaterm} +julia> plot(x = x, y = sin(x)) +Plot{Plots.PyPlotBackend() n=1} +\end{juliaterm} +\includegraphics[width=\linewidth]{figures/plotsjl_test_2_1.pdf} + + + +\begin{juliacode} +plot(rand(100) / 3,reg=true,fill=(0,:green)) +scatter!(rand(100),markersize=6,c=:orange) +\end{juliacode} +\includegraphics[width=\linewidth]{figures/plotsjl_test_3_1.pdf} + + + +\begin{juliaterm} +julia> plot(rand(100) / 3,reg=true,fill=(0,:green)) + +Plot{Plots.PyPlotBackend() n=1} +\end{juliaterm} +\includegraphics[width=\linewidth]{figures/plotsjl_test_4_1.pdf} + +\begin{juliaterm} +julia> scatter!(rand(100),markersize=6,c=:orange) +Plot{Plots.PyPlotBackend() n=2} +\end{juliaterm} +\includegraphics[width=\linewidth]{figures/plotsjl_test_4_2.pdf} + + + + +\begin{figure}[htpb] +\center +\includegraphics[width=\linewidth]{figures/plotsjl_test_random_1.pdf} +\caption{A random walk.} +\label{fig:random} +\end{figure} diff --git a/test/plotsjl_test.jl b/test/plotsjl_test.jl new file mode 100644 index 0000000..b63f15c --- /dev/null +++ b/test/plotsjl_test.jl @@ -0,0 +1,12 @@ +using Weave, Compat +using Base.Test + +function pljtest(source, resfile, doctype) + weave("documents/$source", out_path = "documents/plotsjl/$resfile", doctype=doctype, plotlib=nothing) + result = @compat readstring(open("documents/plotsjl/$resfile")) + ref = @compat readstring(open("documents/plotsjl/$resfile.ref")) + @test result == ref +end + +pljtest("plotsjl_test.jmd", "plotsjl_test.md", "pandoc") +pljtest("plotsjl_test.jmd", "plotsjl_test.tex", "tex") diff --git a/test/runtests.jl b/test/runtests.jl index f319ac9..37fb8ea 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -27,4 +27,7 @@ if VERSION < v"0.5-dev" info("Test: Weaving with PyPlot") include("pyplot_formats.jl") + + info("Test: Weaving with Plots.jl") + include("plotsjl_test.jl") end