Skip to content

Commit dd08658

Browse files
Enable short and complete testing
- Enable short and complete testing runtestsShort/Complete*.jl. - Single window plot for test ShaftFreeMotionAdaptiveRotSequence.jl. - Always use function colorNum in animation export.
1 parent 0641af2 commit dd08658

File tree

8 files changed

+87
-19
lines changed

8 files changed

+87
-19
lines changed

src/AnimationExport/exportAnimation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function printVisuMaterialToJSON(obj, visuMaterial::Modia3D.Shapes.VisualMateria
286286

287287
transparent = visuMaterial.transparency > 0
288288

289-
material = (; name=name, uuid=name2uuid(name), type="MeshPhongMaterial", color=((visuMaterial.color[1]*256 + visuMaterial.color[2])*256 + visuMaterial.color[3]), opacity=1-visuMaterial.transparency, transparent=transparent,
289+
material = (; name=name, uuid=name2uuid(name), type="MeshPhongMaterial", color=colorNum(visuMaterial.color[1], visuMaterial.color[2], visuMaterial.color[3]), opacity=1-visuMaterial.transparency, transparent=transparent,
290290
shininess=visuMaterial.shininess*100, side="DoubleSide")
291291

292292
return material

test/Basic/ShaftFreeMotionAdaptiveRotSequence.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ requiredFinalStates = [0.0, 0.7, -7.350074420637136, 0.0, 0.1, -2.1, 0.698131700
3333
simulate!(shaft, stopTime=stopTime, dtmax=dtmax, log=true, logEvents=true, logStates=true, requiredFinalStates=requiredFinalStates)
3434

3535
@usingModiaPlot
36-
plot(shaft, "free.rot", figure=1)
37-
plot(shaft, ["free.r", "free.v", "free.w"], figure=2)
38-
plot(shaft, "free.isrot123", figure=3)
36+
plot(shaft, ["free.rot", "free.isrot123", "free.w", "free.r", "free.v"], figure=1)
3937

4038
end

test/includeTests.jl

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,49 @@ Test.@testset "Basic" begin
99
include(joinpath("Basic", "PendulumWithParameterizedDamper.jl"))
1010
include(joinpath("Basic", "PendulumWithSpring.jl"))
1111
include(joinpath("Basic", "DoublePendulumWithDampers.jl"))
12-
include(joinpath("Basic", "Mobile.jl"))
1312
include(joinpath("Basic", "BoxPlanarMotion.jl"))
1413
include(joinpath("Basic", "ShaftFreeMotion.jl"))
1514
include(joinpath("Basic", "ShaftFreeMotionAdaptiveRotSequence.jl"))
1615
Test.@test_throws LoadError include(joinpath("Basic", "Object3DWithoutParentError.jl"))
16+
if testsExtend >= normalTests
17+
include(joinpath("Basic", "Mobile.jl"))
18+
end
1719
end
1820

1921
Test.@testset "Robot" begin
2022
include(joinpath("Robot", "ServoWithRamp.jl"))
2123
include(joinpath("Robot", "ServoWithRampAndPrismatic.jl"))
2224
include(joinpath("Robot", "ServoWithRampAndRevolute.jl"))
2325
include(joinpath("Robot", "ServoWithPathAndRevolute.jl"))
24-
include(joinpath("Robot", "YouBotWithSphere.jl"))
25-
Test.@test_skip include(joinpath("Robot", "YouBotPingPong.jl")) # too long computation time
26-
include(joinpath("Robot", "YouBotGripping.jl"))
27-
Test.@test_skip include(joinpath("Robot", "YouBotsGripping.jl")) # too long computation time
26+
if testsExtend >= normalTests
27+
include(joinpath("Robot", "YouBotWithSphere.jl"))
28+
include(joinpath("Robot", "YouBotGripping.jl"))
29+
end
30+
if testsExtend == completeTests
31+
include(joinpath("Robot", "YouBotPingPong.jl")) # long computation time
32+
include(joinpath("Robot", "YouBotsGripping.jl")) # long computation time
33+
end
2834
end
2935

3036
Test.@testset "Collision" begin
3137
include(joinpath("Collision", "BouncingSphere.jl"))
3238
include(joinpath("Collision", "BouncingSphereFreeMotion.jl"))
3339
include(joinpath("Collision", "BouncingEllipsoid.jl"))
34-
include(joinpath("Collision", "BouncingCones.jl"))
35-
include(joinpath("Collision", "BouncingCapsules.jl"))
36-
include(joinpath("Collision", "BouncingBeams.jl"))
3740
include(joinpath("Collision", "TwoCollidingBalls.jl"))
3841
include(joinpath("Collision", "TwoCollidingBoxes.jl"))
3942
include(joinpath("Collision", "CollidingCylinders.jl"))
40-
include(joinpath("Collision", "CollidingSphereWithBunnies.jl"))
4143
include(joinpath("Collision", "NewtonsCradle.jl"))
42-
include(joinpath("Collision", "Billard4Balls.jl"))
43-
Test.@test_skip include(joinpath("Collision", "Billard16Balls.jl")) # too long computation time
44-
Test.@test_throws LoadError include(joinpath("Collision", "InValidCollisionPairingError.jl")) # not defined collision pair material
44+
Test.@test_throws LoadError include(joinpath("Collision", "InValidCollisionPairingError.jl")) # not defined collision pair material
45+
if testsExtend >= normalTests
46+
include(joinpath("Collision", "BouncingCones.jl"))
47+
include(joinpath("Collision", "BouncingCapsules.jl"))
48+
include(joinpath("Collision", "BouncingBeams.jl"))
49+
include(joinpath("Collision", "CollidingSphereWithBunnies.jl"))
50+
include(joinpath("Collision", "Billard4Balls.jl"))
51+
end
52+
if testsExtend == completeTests
53+
include(joinpath("Collision", "Billard16Balls.jl")) # long computation time
54+
end
4555
end
4656

4757
Test.@testset "Tutorial" begin
@@ -53,8 +63,10 @@ end
5363

5464
Test.@testset "old" begin
5565
include(joinpath("old", "Move_Pendulum.jl"))
56-
Test.@test_skip include(joinpath("old", "Plot_cor.jl")) # direct PyPlot calls
57-
Test.@test_skip include(joinpath("old", "Plot_SlidingFriction.jl")) # direct PyPlot calls
66+
if currentPlotPackage() == "PyPlot"
67+
include(joinpath("old", "Plot_cor.jl")) # direct PyPlot calls
68+
include(joinpath("old", "Plot_SlidingFriction.jl")) # direct PyPlot calls
69+
end
5870
include(joinpath("old", "test_Shapes.jl"))
5971
include(joinpath("old", "Test_PathPlanning.jl"))
6072
include(joinpath("old", "test_Solids.jl"))

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ using ModiaLang
44
import Modia3D
55
import Test
66

7-
@time Test.@testset verbose=true "Modia3D (with SilentNoPlot)" begin
7+
@enum TestsExtend shortTests normalTests completeTests
8+
const testsExtend = normalTests
9+
const title = "Modia3D (with SilentNoPlot)"
10+
11+
@time Test.@testset verbose=true "$title" begin
812
usePlotPackage("SilentNoPlot")
913
Modia3D.disableRenderer()
1014
include("includeTests.jl")

test/runtestsComplete.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module RuntestsComplete
2+
3+
using ModiaLang
4+
import Modia3D
5+
import Test
6+
7+
@enum TestsExtend shortTests normalTests completeTests
8+
const testsExtend = completeTests
9+
const title = "Complete Modia3D (with SilentNoPlot)"
10+
11+
@time Test.@testset verbose=true "$title" begin
12+
usePlotPackage("SilentNoPlot")
13+
Modia3D.disableRenderer()
14+
include("includeTests.jl")
15+
Modia3D.reenableRenderer()
16+
usePreviousPlotPackage()
17+
end
18+
19+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module RuntestsCompleteWithGraphics
2+
3+
using ModiaLang
4+
import Test
5+
6+
@enum TestsExtend shortTests normalTests completeTests
7+
const testsExtend = completeTests
8+
const title = "Complete Modia3D (with " * currentPlotPackage() * ")"
9+
10+
@time Test.@testset verbose=true "$title" begin
11+
include("includeTests.jl")
12+
end
13+
14+
end

test/runtestsShort.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module RuntestsShort
2+
3+
using ModiaLang
4+
import Modia3D
5+
import Test
6+
7+
@enum TestsExtend shortTests normalTests completeTests
8+
const testsExtend = shortTests
9+
const title = "Short Modia3D (with SilentNoPlot)"
10+
11+
@time Test.@testset verbose=true "$title" begin
12+
usePlotPackage("SilentNoPlot")
13+
Modia3D.disableRenderer()
14+
include("includeTests.jl")
15+
Modia3D.reenableRenderer()
16+
usePreviousPlotPackage()
17+
end
18+
19+
end

test/runtestsWithGraphics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module RuntestsWithGraphics
33
using ModiaLang
44
import Test
55

6+
@enum TestsExtend shortTests normalTests completeTests
7+
const testsExtend = normalTests
68
const title = "Modia3D (with " * currentPlotPackage() * ")"
79

810
@time Test.@testset verbose=true "$title" begin

0 commit comments

Comments
 (0)