|
1 |
| -using Images, IndirectArrays, Test |
| 1 | +using Images, IndirectArrays, Test, Suppressor |
| 2 | +using Images.MappedArrays: mappedarray |
2 | 3 |
|
3 | 4 | @testset "ColorizedArray" begin
|
4 | 5 | intensity = [0.1 0.3; 0.2 0.4]
|
5 | 6 | labels = IndirectArray([1 2; 2 1], [RGB(1,0,0), RGB(0,0,1)])
|
6 |
| - A = ColorizedArray(intensity, labels) |
| 7 | + colorized_A = @suppress_err ColorizedArray(intensity, labels) |
| 8 | + mapped_A = mappedarray(*, intensity, labels) |
| 9 | + |
7 | 10 | target = intensity .* labels
|
8 |
| - @test eltype(A) == RGB{Float64} |
9 |
| - @test size(A) == (2,2) |
10 |
| - @test axes(A) == (Base.OneTo(2), Base.OneTo(2)) |
11 |
| - for i = 1:4 |
12 |
| - @test A[i] === target[i] |
13 |
| - end |
14 |
| - for j = 1:2, i = 1:2 |
15 |
| - @test A[i,j] === target[i,j] |
16 |
| - end |
17 |
| - for (a,t) in zip(A, target) |
18 |
| - @test a === t |
| 11 | + |
| 12 | + for A in (colorized_A, mapped_A) |
| 13 | + @test eltype(A) == RGB{Float64} |
| 14 | + @test size(A) == (2,2) |
| 15 | + @test axes(A) == (Base.OneTo(2), Base.OneTo(2)) |
| 16 | + for i = 1:4 |
| 17 | + @test A[i] === target[i] |
| 18 | + end |
| 19 | + for j = 1:2, i = 1:2 |
| 20 | + @test A[i,j] === target[i,j] |
| 21 | + end |
| 22 | + for (a,t) in zip(A, target) |
| 23 | + @test a === t |
| 24 | + end |
19 | 25 | end
|
20 | 26 |
|
21 | 27 | intensity1 = [0.1 0.3 0.6; 0.2 0.4 0.1]
|
|
0 commit comments