From 550b61c6aaac67c767615783c6475b9050595d3d Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 19 Aug 2022 20:10:47 +0800 Subject: [PATCH] fix XTermColors world age: invokelatest (#121) * fix XTermColors world age: invokelatest * ReferenceTests v0.10.1 --- Project.toml | 2 +- src/fileio.jl | 2 +- src/render.jl | 2 +- test/test_no_world_age_issues.jl | 11 +++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index e15003b..f79795e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ReferenceTests" uuid = "324d217c-45ce-50fc-942e-d289b448e8cf" authors = ["Christof Stocker ", "Frames White ", "Johnny Chen "] -version = "0.10.0" +version = "0.10.1" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" diff --git a/src/fileio.jl b/src/fileio.jl index cf11306..bfd63c4 100644 --- a/src/fileio.jl +++ b/src/fileio.jl @@ -58,7 +58,7 @@ function _convert( # encode image into string strs = @withcolor XTermColors.ascii_show( img, - XTermColors.TermColor8bit(), + Base.invokelatest(XTermColors.TermColor8bit), :small, size ) diff --git a/src/render.jl b/src/render.jl index f1f5809..9c2ff72 100644 --- a/src/render.jl +++ b/src/render.jl @@ -17,7 +17,7 @@ end function render_item(::BeforeAfterImage, item) str_item = @withcolor XTermColors.ascii_show( item, - XTermColors.TermColor8bit(), + Base.invokelatest(XTermColors.TermColor8bit), :small, (20, 40) ) diff --git a/test/test_no_world_age_issues.jl b/test/test_no_world_age_issues.jl index ffcee9a..aa13077 100644 --- a/test/test_no_world_age_issues.jl +++ b/test/test_no_world_age_issues.jl @@ -1,10 +1,21 @@ +using ReferenceTests: render_item, BeforeAfterImage + @testset "world age issues" begin + function test_render(file) + # https://github.com/JuliaTesting/ReferenceTests.jl/issues/120 + render_item(BeforeAfterImage(), load(file)) + end + function test_convert(file) + ReferenceTests._convert(DataFormat{:TXT}, load(file)) + end files = ["references/camera.png"] for filename in files ref_file = joinpath(@__DIR__, filename) if isfile(ref_file) @test_reference filename load(ref_file) + @test_nowarn test_render(ref_file) + @test_nowarn test_convert(ref_file) else @info "Skip reference file: $ref_file" end