Skip to content

Commit

Permalink
Merge pull request #5 from RexWzh/rex-dev
Browse files Browse the repository at this point in the history
Fix dependency of ImageMagick
  • Loading branch information
RexWzh authored Feb 12, 2023
2 parents 612eb9f + a46dc70 commit 0270d56
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- rex-dev
tags: '*'
pull_request:
concurrency:
Expand Down
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name = "ZBar"
uuid = "ae056753-435e-4d6b-8005-e923ff6e8938"
authors = ["rex <1073853456@qq.com> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
ImageMagick_jll = "c73af94c-d91f-53ed-93a7-00f77d67a9d7"
zbar_jll = "e2ef1e04-4331-5370-a106-92245136390b"

[compat]
CEnum = "0.4"
ImageMagick_jll = "6.9.12"
julia = "1.6"
zbar_jll = "0.23"
zbar_jll = "0.23.92"
34 changes: 31 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ using QRCoders

testpath = "testpath"

# image transformation
## flip
fliplr(mat) = mat[end:-1:1, :]
flipud(mat) = mat[:, end:-1:1]
flipdiag(mat)::BitMatrix = mat';

## rotate
rot180(mat) = mat[end:-1:1, end:-1:1]
rot90(mat) = flipud(mat');
rot270(mat) = fliplr(mat');

@testset "ZBar.jl -- general test" begin
### `zbarimg` ###
println(execute(`$(zbarimg()) --help`).stdout)
@test true
res = execute(`$(zbarimg()) --help`)
@test res.code == 0

### `decodeimg` ###
# normal test for `.png`
Expand All @@ -30,8 +40,26 @@ testpath = "testpath"
@test decodeimg("$testpath/hello12.gif") == fill("hello", 12)

# rotate

mat = qrcode("hello world")
rmat180 = rot180(mat)
rmat90 = rot90(mat)
rmat270 = rot270(mat)
exportbitmat(rmat180, "$testpath/hello180.png")
exportbitmat(rmat90, "$testpath/hello90.png")
exportbitmat(rmat270, "$testpath/hello270.png")
@test decodeimg("$testpath/hello180.png")[1] == "hello world"
@test decodeimg("$testpath/hello90.png")[1] == "hello world"
@test decodeimg("$testpath/hello270.png")[1] == "hello world"
# flip
fmatlr = fliplr(mat)
fmatud = flipud(mat)
fmatdiag = flipdiag(mat)
exportbitmat(fmatlr, "$testpath/hellofliplr.png")
exportbitmat(fmatud, "$testpath/helloflipud.png")
exportbitmat(fmatdiag, "$testpath/helloflipdiag.png")
@test decodeimg("$testpath/hellofliplr.png")[1] == "hello world"
@test decodeimg("$testpath/helloflipud.png")[1] == "hello world"
@test decodeimg("$testpath/helloflipdiag.png")[1] == "hello world"

# blank image

Expand Down

2 comments on commit 0270d56

@RexWzh
Copy link
Owner Author

@RexWzh RexWzh commented on 0270d56 Feb 13, 2023

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/77567

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 0270d56f55ab3a026bdcd7db23699adba2247ae2
git push origin v0.1.1

Please sign in to comment.