11using AbstractPlotting
2+ using MakieGallery
23using Test
34
45# does this machine have a OPENGL?
5- const OPENGL = haskey (ENV , " OPENGL" ) || haskey (ENV , " GITLAB_CI" ) || try success (pipeline (` glxinfo` , ` grep version` )) catch ; false end # if it's Gitlab, it must be JuliaGPU
6+ const OPENGL = false # haskey(ENV, "OPENGL") || haskey(ENV, "GITLAB_CI") || try success(pipeline(`glxinfo`, `grep version`)) catch; false end # if it's Gitlab, it must be JuliaGPU
67
78OPENGL && begin @info " OpenGL detected" ; using GLMakie end
89OPENGL || @warn " No OpenGL detected! Software tests only."
910
1011# does this machine have FFMPEG? We'll take it on faith if you tell us...
11- const fmp = haskey (ENV , " FFMPEG" ) || try ; AbstractPlotting. @ffmpeg_env success (` $ffmpeg -version` ); catch ; false end ;
12-
1312const _MINIMAL = get (ENV , " ABSTRACTPLOTTING_MINIMAL" , " false" )
1413
15-
16- scene = scatter (rand (4 ))
17-
1814include (" conversions.jl" )
1915include (" quaternions.jl" )
2016include (" projection_math.jl" )
@@ -26,133 +22,116 @@ include("projection_math.jl")
2622 @test scene[Axis]. ticks. title_gap[] == 4
2723end
2824
29- # if get(ENV, "IS_TRAVIS_CI", "false") == "false"
30- # exit(0);
31- # end
32-
33- using MakieGallery
3425
3526if _MINIMAL == " false"
3627
3728 # Load all entries in the database
3829
3930 database = MakieGallery. load_database ()
4031
41- # # Exceptions are made on basis of title and not index,
32+ # # Exceptions are made on basis of title and not index,
4233 # because index may change as MakieGallery changes.
4334
44- # All these require FFMpeg and need to save,
45- # and are therefore ignored
46- ffmpeg_exs = [
47- " Animation" , " Lots of Heatmaps" ," Animated Scatter" ,
48- " Chess Game" , " Record Video" , " Animated surface and wireframe" ,
49- " Moire" , " pong" , " pulsing marker" , " Travelling wave" ,
50- " Type recipe for molecule simulation"
51- ]
52-
53- # All these require GLMakie and so are ignored
54- glmakie_exs = [
55- " Textured Mesh" , " Load Mesh" , " Wireframe of a Mesh" ,
56- " FEM mesh 3D" , " Normals of a Cat" , " Line GIF"
57- ]
58-
59- # Requires GDAL (a GL package) so ignored
60- gdal_exs = [
61- " WorldClim visualization"
62- ]
35+ # All these require FFMpeg and need to save,
36+ # and are therefore ignored
37+ ffmpeg_exs = [
38+ " Animation" , " Lots of Heatmaps" ," Animated Scatter" ,
39+ " Chess Game" , " Record Video" , " Animated surface and wireframe" ,
40+ " Moire" , " pong" , " pulsing marker" , " Travelling wave" ,
41+ " Type recipe for molecule simulation" , " Cobweb plot "
42+ ]
43+
44+ # All these require GLMakie and so are ignored
45+ glmakie_exs = [
46+ " Textured Mesh" , " Load Mesh" , " Wireframe of a Mesh" ,
47+ " FEM mesh 3D" , " Normals of a Cat" , " Line GIF"
48+ ]
49+
50+ # Requires GDAL (a GL package) so ignored
51+ gdal_exs = [
52+ " WorldClim visualization"
53+ ]
6354
6455 # Requires GLMakie and ModernGL, so ignored
65- moderngl_exs = [
66- " Explicit frame rendering"
67- ]
68-
69- # use Stepper plots, which save, so ignored
70- save_exs = [
71- " Axis theming" , " Labels" , " Color Legend" ,
72- " Stepper demo"
73- ]
74-
75- # hopefullly fixed by next tag of MakieGallery (already in AbstractPlotting
76- color_exs = [" colormaps" ]
77-
78- # curl fails with this for some reason, so it has been ignored.
79- curl_exs = [" Earth & Ships" ]
80-
81- if OPENGL
82- if fmp
83- # all test infrastructure in place - no exceptions!
84- exc_str = Set ()
85- else
86- exc_str = Set (ffmpeg_exs)
87- end
88- else
89- # combine all exceptions into a single Set
90- exc_str = exc_str = union (ffmpeg_exs, glmakie_exs, gdal_exs, moderngl_exs, save_exs, color_exs, curl_exs)
91- end
56+ moderngl_exs = [
57+ " Explicit frame rendering"
58+ ]
59+
60+ # use Stepper plots, which save, so ignored
61+ save_exs = [
62+ " Axis theming" , " Labels" , " Color Legend" ,
63+ " Stepper demo"
64+ ]
65+
66+ # hopefullly fixed by next tag of MakieGallery (already in AbstractPlotting
67+ color_exs = [" colormaps" ]
68+
69+ # curl fails with this for some reason, so it has been ignored.
70+ curl_exs = [" Earth & Ships" ]
71+ stepper_exclude = [" Tutorial plot transformation" , " Legend" ]
72+ if OPENGL
73+ excluded_examples = Set ()
74+ else
75+ # combine all exceptions into a single Set
76+ excluded_examples = excluded_examples = union (
77+ ffmpeg_exs, glmakie_exs, gdal_exs, moderngl_exs,
78+ save_exs, color_exs, curl_exs, stepper_exclude
79+ )
80+ end
9281
9382else
94-
9583 # Load only short tests
96-
9784 database = MakieGallery. load_tests ()
98-
99- # This one is broken, all the others are fine. I don't know why this fails. It doesn't fail on my machine :P
100- exc_str = Set ([" Comparing contours, image, surfaces and heatmaps" ])
101-
85+ excluded_examples = Set ([" Comparing contours, image, surfaces and heatmaps" ])
10286end
10387
10488if ! OPENGL # run software only tests...
105-
89+ # Make sure we don't include Makie in the usings
90+ empty! (MakieGallery. plotting_backends)
91+ push! (MakieGallery. plotting_backends, " AbstractPlotting" )
92+ @test AbstractPlotting. current_backend[] isa Missing
93+ @info " Starting minimal software tests"
94+ filter! (database) do example
95+ ! (example. title in excluded_examples) &&
96+ ! (" record" in example. tags)
97+ end
10698 @testset " Gallery short tests" begin
107-
10899 # iterate over database
109100 @testset " $(database[i]. title) (#$i )" for i in 1 : length (database)
110-
111- # skip if the title is in the list of exceptions
112- if database[i] . title ∈ exc_str
113-
114- print (
115- " Skipping "
116- * database[i] . title *
117- " \n (removed from tests explicitly) \n "
118- )
119-
120- continue
121-
122- end
123-
124- @debug ( " Running " * database[i] . title * " \n (index $i ) \n " )
125- # evaluate the entry
126- @test_nowarn MakieGallery . eval_example (database[i]);
127-
101+ @debug ( " Running " * database[i] . title * " \n (index $i ) \n " )
102+ # evaluate the entry
103+ try
104+ MakieGallery . eval_example (database[i])
105+ @test true
106+ catch e
107+ # THis is ok, since we try to record something, which we can't
108+ # without backend
109+ if e isa LoadError && e . error isa MethodError && (
110+ e . error . f == AbstractPlotting . backend_display ||
111+ e . error . f == AbstractPlotting . format2mime
112+ )
113+ @test true
114+ else
115+ @test rethrow (e )
116+ end
117+ end
118+ @assert AbstractPlotting . current_backend[] isa Missing
128119 end
129-
130120 end
131-
132121else # full MakieGallery comparisons here
133-
134122 using GLMakie
135-
136123 @info (" Running full tests - artifacts will be stored!" )
137-
138- for exc in exc_str
139-
124+ for exc in excluded_examples
140125 printstyled (" Excluded " , color = :yellow , bold = true )
141126 println (exc)
142-
143127 end
144-
145- filter! (entry -> ! (entry. title in exc_str), database)
146-
128+ filter! (entry -> ! (entry. title in excluded_examples), database)
147129 tested_diff_path = joinpath (@__DIR__ , " tested_different" )
148130 test_record_path = joinpath (@__DIR__ , " test_recordings" )
149131 rm (tested_diff_path, force = true , recursive = true )
150132 mkpath (tested_diff_path)
151133 rm (test_record_path, force = true , recursive = true )
152134 mkpath (test_record_path)
153-
154135 examples = MakieGallery. record_examples (test_record_path)
155-
156136 MakieGallery. run_comparison (test_record_path, tested_diff_path)
157-
158137end
0 commit comments