Added tests for plotjl/generic multimedia

pull/37/head
= 2016-04-27 22:02:20 +03:00
parent daa645ac58
commit b6031cd111
5 changed files with 152 additions and 3 deletions

6
.gitignore vendored
View File

@ -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.*

View File

@ -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)

View File

@ -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
test/plotsjl_test.jl Normal file
View File

@ -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")

View File

@ -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