Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/images/sixel_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
# rerun the test twice to (1) make sure regeneration works (2) generated references match what's uploaded
- name: "Unit Test"
shell: bash
Expand All @@ -45,10 +45,10 @@ jobs:
julia --color=yes --check-bounds=yes --project -e "using Pkg; Pkg.test(coverage=true)"
julia --color=yes --check-bounds=yes --project -e "using Pkg; Pkg.test(coverage=true)"
- name: Upload Mismatched Files as a Build Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v5
with:
name: "Mismatched Files"
path: "~/mismatches/"
name: "Mismatched Files-${{ github.run_number }}"
path: "~/mismatches/{}"

- uses: julia-actions/julia-processcoverage@latest
- uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
version: ${{ matrix.julia-version }}
- name: Cache artifacts
uses: actions/cache@v1
uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name = "ReferenceTests"
uuid = "324d217c-45ce-50fc-942e-d289b448e8cf"
version = "0.10.6"
authors = ["Christof Stocker <[email protected]>", "Frames White <[email protected]>", "Johnny Chen <[email protected]>"]
version = "0.10.5"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
LazyModules = "8cdb02fc-e678-4876-92c5-9defec4f444e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Sixel = "45858cf5-a6b0-47a3-bbea-62219f50df47"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
XTermColors = "c8c2cc18-de81-4e68-b407-38a3a0c0491f"

[compat]
BSON = "0.3"
Colors = "0.10 - 0.13"
CSVFiles = "1"
Colors = "0.10 - 0.13"
DataFrames = "0.21 - 0.22, 1"
DeepDiffs = "1"
Distances = "0.7 - 0.10"
FileIO = "1"
ImageCore = "0.8.1, 0.9, 0.10"
ImageMagick = "0.7, 1"
ImageTransformations = "0.8 - 0.10"
LazyModules = "0.3"
Plots = "= 1.39.0"
Plots = "1.39.0"
Sixel = "0.1.3"
TestImages = "0.6, 1"
XTermColors = "0.2"
julia = "1.6"
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ using ReferenceTests, TestImages
![readme3](https://user-images.githubusercontent.com/10854026/30002971-3ebdc350-90b7-11e7-8f40-2fc8b59ce9e8.png)
![readme4](https://user-images.githubusercontent.com/10854026/30002972-3edfff60-90b7-11e7-8bb5-8e647f9f4965.png)

Note that while a text-based storage of reference images can be
convenient, proper image formats (e.g. `png`) are also supported
by the package. Those, however, will require the proper `FileIO`
backends to be installed.
Proper image formats such as `.png` are also supported for full-res image testing. If your terminal
[supports Sixel](https://www.arewesixelyet.com/), then ReferenceTests will display the full image
in your terminal using (Sixel.jl)[https://github.com/JuliaIO/Sixel.jl]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in your terminal using (Sixel.jl)[https://github.com/JuliaIO/Sixel.jl]:
in your terminal using [Sixel.jl](https://github.com/JuliaIO/Sixel.jl):


![sixel_demo](.github/images/sixel_demo.png)

Currently, Sixel is not able to automatically [detect if it is supported
during package testing](https://github.com/JuliaLang/Pkg.jl/issues/3185),
but it can be force-enable Sixel rendering of images by setting the
environment variable `REFERENCETESTS_FORCE_SIXEL=true`.

Another special file extension is `sha256` which will cause the
hash of the result of the given expression to be stored and
Expand Down
7 changes: 3 additions & 4 deletions src/ReferenceTests.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
module ReferenceTests

using LazyModules

using Test
using Colors
using Distances
using FileIO
@lazy import ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
@lazy import XTermColors = "c8c2cc18-de81-4e68-b407-38a3a0c0491f"
import ImageCore
import XTermColors
using SHA
using DeepDiffs
using Random
using Sixel

export
@withcolor,
Expand Down
23 changes: 15 additions & 8 deletions src/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,25 @@ function render_item(::BeforeAfterLimited, item)
show(io, "text/plain", item)
read(io, String)
end

should_use_sixel() = Sixel.is_sixel_supported() || parse(Bool, get(ENV, "REFERENCETESTS_FORCE_SIXEL", "false"))

function render_item(::BeforeAfterImage, item)
io = color_buffer()
io = should_use_sixel() ? PipeBuffer() : color_buffer()
println(io, "eltype: ", eltype(item))
println(io, "size: ", map(length, axes(item)))
println(io, "thumbnail:")
strs = @withcolor XTermColors.ascii_show(
item,
Base.invokelatest(XTermColors.TermColor8bit),
:small,
(20, 40)
)
print(io, join(strs, '\n'))
if should_use_sixel()
sixel_encode(io, item)
else
strs = @withcolor XTermColors.ascii_show(
item,
Base.invokelatest(XTermColors.TermColor8bit),
:small,
(20, 40)
)
print(io, join(strs, '\n'))
end
read(io, String)
end

Expand Down
7 changes: 5 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ else
end

ambs = detect_ambiguities(ReferenceTests, Base, Core)
@test isempty(ambs)

if VERSION>v"1.13.0-DEV.0"
@test_broken isempty(ambs) # Ref https://github.com/JuliaImages/ImageCore.jl/issues/210
else
@test isempty(ambs)
end
# to properly test world age issues, the full test dependencies must be loaded later
include("test_no_world_age_issues.jl")

Expand Down
Loading