Skip to content

Commit

Permalink
Added tests for plotjl/generic multimedia
Browse files Browse the repository at this point in the history
  • Loading branch information
mpastell committed Apr 27, 2016
1 parent daa645a commit b6031cd
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

Expand Down
76 changes: 76 additions & 0 deletions test/documents/plotsjl/plotsjl_test.md.ref
Original file line number Diff line number Diff line change
@@ -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)
58 changes: 58 additions & 0 deletions test/documents/plotsjl/plotsjl_test.tex.ref
Original file line number Diff line number Diff line change
@@ -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}
12 changes: 12 additions & 0 deletions test/plotsjl_test.jl
Original file line number Diff line number Diff line change
@@ -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")
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b6031cd

Please sign in to comment.