Skip to content

Commit fc8f2e7

Browse files
author
Andy Ferris
committed
Changed tests to avoid defining isapprox on UniformScaling
1 parent 67491e4 commit fc8f2e7

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

test/perspective.jl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
@testset "Perspective transformation" begin
22
@test PerspectiveMap()([2.0, -1.0, 0.5]) [4.0, -2.0]
33

4-
@test cameramap(2.0) LinearMap(UniformScaling(2.0)) PerspectiveMap()
5-
@test cameramap((1.1,2.2)) LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
6-
@test cameramap(1.1, (3.3,4.4)) Translation([-3.3,-4.4]) LinearMap(UniformScaling(1.1)) PerspectiveMap()
7-
@test cameramap((1.1,2.2), (3.3,4.4)) Translation([-3.3,-4.4]) LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
4+
if VERSION > v"0.6-"
5+
@test cameramap(2.0) LinearMap(UniformScaling(2.0)) PerspectiveMap()
6+
@test cameramap((1.1,2.2)) LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
7+
@test cameramap(1.1, (3.3,4.4)) Translation([-3.3,-4.4]) LinearMap(UniformScaling(1.1)) PerspectiveMap()
8+
@test cameramap((1.1,2.2), (3.3,4.4)) Translation([-3.3,-4.4]) LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
9+
else
10+
# `isapprox` for `UniformScaling` not defined. Just put a few points through and
11+
# test that we get the same results
12+
points = [[1.0,1.0,1.0], [-1.0,1.0,1.0], [-1.0,-1.0,1.0], [1.0,-1.0,1.0]]
13+
14+
trans1 = cameramap(2.0)
15+
trans2 = LinearMap(UniformScaling(2.0)) PerspectiveMap()
16+
@test all(isapprox.(trans1.(points), trans2.(points)))
17+
18+
trans1 = cameramap((1.1,2.2))
19+
trans2 = LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
20+
@test all(isapprox.(trans1.(points), trans2.(points)))
21+
22+
trans1 = cameramap(1.1, (3.3,4.4))
23+
trans2 = Translation([-3.3,-4.4]) LinearMap(UniformScaling(1.1)) PerspectiveMap()
24+
@test all(isapprox.(trans1.(points), trans2.(points)))
25+
26+
trans1 = cameramap((1.1,2.2), (3.3,4.4))
27+
trans2 = Translation([-3.3,-4.4]) LinearMap([1.1 0; 0 2.2]) PerspectiveMap()
28+
@test all(isapprox.(trans1.(points), trans2.(points)))
29+
30+
end
831
end

test/runtests.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ using Base.Test
33
using ForwardDiff: Dual, partials
44
using StaticArrays
55

6-
# See https://github.com/JuliaLang/julia/issues/18858
7-
Base.isapprox(a::UniformScaling, b::UniformScaling; kwargs...) = isapprox(a.λ, b.λ; kwargs...)
8-
96
@testset "CoordinateTransformations" begin
107

118
include("core.jl")

0 commit comments

Comments
 (0)