Skip to content

Commit

Permalink
Fix visualization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed Nov 6, 2024
1 parent 95bb0db commit be3b3b5
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions test/show_colors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ algo = GreedyColoringAlgorithm(; decompression=:direct)
problem = ColoringProblem(; structure=:nonsymmetric, partition=partition)
result = coloring(S, problem, algo)

img = show_colors(result)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}
if partition != :bidirectional
img = show_colors(result)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}
end

h, w = size(S)
scale = 3
Expand All @@ -31,15 +33,17 @@ algo = GreedyColoringAlgorithm(; decompression=:direct)
@test size(img) == (h * (scale + pad) + pad, w * (scale + pad) + pad)
@test img isa Matrix{<:Colorant}

@testset "color cycling" begin
colorscheme = [RGB(0, 0, 0), RGB(1, 1, 1)] # 2 colors, whereas S requires 3
img = @test_logs (:warn,) show_colors(result; colorscheme=colorscheme)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}

img = show_colors(result; colorscheme=colorscheme, warn=false)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}
if partition != :bidirectional
@testset "color cycling" begin
colorscheme = [RGB(0, 0, 0), RGB(1, 1, 1)] # 2 colors, whereas S requires 3
img = @test_logs (:warn,) show_colors(result; colorscheme)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}

img = show_colors(result; colorscheme, warn=false)
@test size(img) == size(S)
@test img isa Matrix{<:Colorant}
end
end
end

Expand Down

0 comments on commit be3b3b5

Please sign in to comment.