Skip to content

Commit

Permalink
change color test
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Aug 19, 2021
1 parent c222ce6 commit a4115f3
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/tst_canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end
@test @inferred(lines!(c, 0., 0., 1., 1., :blue)) === c
@test @inferred(points!(c, x1, y1, :white)) === c
@test @inferred(pixel!(c, 2, 4, color = :cyan)) === c
points!(c, x2, y2, color = (255,0,0))
points!(c, x2, y2, color = :red)
lines!(c, 0., 1., .5, 0., :green)
points!(c, .05, .3, color = :cyan)
lines!(c, [1.,2], [2.,1])
Expand Down Expand Up @@ -115,3 +115,26 @@ end
@io2str(print(IOContext(::IO, :color=>true), c))
)
end

@testset "colors" begin
c = BrailleCanvas(40, 15, origin_x = 0., origin_y = 0., width = 1.2, height = 1.2)
@inferred lines!(c, 0.0, 0.0, 1.2, 0.0, (0,0,255))
lines!(c, 0.0, 0.2, 1.2, 0.2, (255,0,0))
lines!(c, 0.0, 0.4, 1.2, 0.4, (0,255,0))
lines!(c, 0.0, 0.6, 1.2, 0.6, (255,255,0))
lines!(c, 0.0, 0.8, 1.2, 0.8, 127)
lines!(c, 0.0, 1.0, 1.2, 1.0, 51)
lines!(c, 0.0, 1.2, 1.2, 1.2, 231)

lines!(c, 0.0, 0.0, 0.0, 1.2, :blue)
lines!(c, 0.2, 0.0, 0.2, 1.2, :red)
lines!(c, 0.4, 0.0, 0.4, 1.2, :green)
lines!(c, 0.6, 0.0, 0.6, 1.2, :yellow)
lines!(c, 0.8, 0.0, 0.8, 1.2, :magenta)
lines!(c, 1.0, 0.0, 1.0, 1.2, :cyan)
lines!(c, 1.2, 0.0, 1.2, 1.2, :normal)
test_ref(
"references/canvas/colors.txt",
@io2str(print(IOContext(::IO, :color=>true), c))
)
end

0 comments on commit a4115f3

Please sign in to comment.