From 9145af8333ed69dddfb29d79d826073202aab9f4 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Thu, 19 Aug 2021 12:24:45 +0200 Subject: [PATCH] add color tests --- test/tst_barplot.jl | 15 ++++++++++++++- test/tst_boxplot.jl | 18 ++++++++++++++++-- test/tst_histogram.jl | 25 +++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/test/tst_barplot.jl b/test/tst_barplot.jl index 48d46542..dcabad18 100644 --- a/test/tst_barplot.jl +++ b/test/tst_barplot.jl @@ -154,7 +154,7 @@ end [2.244, 8.406, 11.92, 3.165], title = "Relative sizes of cities", xlabel = "population [in mil]", - color = 220, # 256 color yellow + color = :yellow, border = :solid, symb = '=', width = 60 @@ -178,3 +178,16 @@ end @io2str(print(IOContext(::IO, :color=>true), p)) ) end + +@testset "colors" begin + p = barplot(["B","A"], [2,1], color=9) + test_ref( + "references/barplot/col1.txt", + @io2str(print(IOContext(::IO, :color=>true), p)) + ) + p = barplot(["B","A"], [2,1], color=(200,50,0)) + test_ref( + "references/barplot/col2.txt", + @io2str(print(IOContext(::IO, :color=>true), p)) + ) +end diff --git a/test/tst_boxplot.jl b/test/tst_boxplot.jl index 91ff4e9c..b9380766 100644 --- a/test/tst_boxplot.jl +++ b/test/tst_boxplot.jl @@ -14,7 +14,7 @@ "references/boxplot/default_parameters.txt", @io2str(show(IOContext(::IO, :color=>true), p)) ) - p = @inferred boxplot("series1", [1,2,3,4,5], title = "Test", xlim = [-1,8], color = (0,0,255), width = 50, border = :solid, xlabel="foo") + p = @inferred boxplot("series1", [1,2,3,4,5], title = "Test", xlim = [-1,8], color = :blue, width = 50, border = :solid, xlabel="foo") test_ref( "references/boxplot/default_parameters.txt", @io2str(show(IOContext(::IO, :color=>true), p)) @@ -41,7 +41,7 @@ end end @testset "multi-series" begin - p = @inferred boxplot(["one", "two"], [[1,2,3,4,5], [2,3,4,5,6,7,8,9]], title="Multi-series", xlabel="foo", color=11) # color 256 yellowish + p = @inferred boxplot(["one", "two"], [[1,2,3,4,5], [2,3,4,5,6,7,8,9]], title="Multi-series", xlabel="foo", color=:yellow) test_ref( "references/boxplot/multi1.txt", @io2str(show(IOContext(::IO, :color=>true), p)) @@ -57,3 +57,17 @@ end @io2str(show(IOContext(::IO, :color=>true), p)) ) end + +@testset "colors" begin + p = @inferred boxplot(["one", "two"], [[1,2,3], [4,5,6]], color=214) + test_ref( + "references/boxplot/col1.txt", + @io2str(show(IOContext(::IO, :color=>true), p)) + ) + + p = @inferred boxplot(["one", "two"], [[1,2,3], [4,5,6]], color=(187,0,187)) + test_ref( + "references/boxplot/col2.txt", + @io2str(show(IOContext(::IO, :color=>true), p)) + ) +end \ No newline at end of file diff --git a/test/tst_histogram.jl b/test/tst_histogram.jl index 6c2731c2..eca55f43 100644 --- a/test/tst_histogram.jl +++ b/test/tst_histogram.jl @@ -96,7 +96,7 @@ end x, title = "My Histogram", xlabel = "Absolute Frequency", - color = (0,0,255), + color = :blue, margin = 7, padding = 3, labels = false, @@ -124,7 +124,7 @@ end x, title = "My Histogram", xlabel = "Absolute Frequency", - color = (255,255,0), + color = :yellow, border = :solid, symb = '=', width = 50 @@ -133,4 +133,25 @@ end "references/histogram/parameters2.txt", @io2str(print(IOContext(::IO, :color=>true), p)) ) + + # colors + p = @inferred histogram( + x, + title = "Gray color", + color = 240, + ) + test_ref( + "references/histogram/col1.txt", + @io2str(print(IOContext(::IO, :color=>true), p)) + ) + + p = @inferred histogram( + x, + title = "Green color", + color = (50,100,50), + ) + test_ref( + "references/histogram/col2.txt", + @io2str(print(IOContext(::IO, :color=>true), p)) + ) end