-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 0.6 depwarns #573
Fix 0.6 depwarns #573
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,19 @@ using FactCheck, Images, Colors, FixedPointNumbers | |
using Compat | ||
|
||
macro chk(a, b) | ||
:(@fact ($a == $b && typeof($a) == typeof($b)) --> true) | ||
quote | ||
a = $(esc(a)) | ||
b = $(esc(b)) | ||
@fact (a == b && typeof(a) == typeof(b)) --> true | ||
end | ||
end | ||
|
||
macro chk_approx(a, b) | ||
:(@fact (abs($a - $b) < 2*(eps($a)+eps($b)) && typeof($a) == typeof($b)) --> true) | ||
quote | ||
a = $(esc(a)) | ||
b = $(esc(b)) | ||
@fact (abs(a - b) < 2*(eps(a)+eps(b)) && typeof(a) == typeof(b)) --> true | ||
end | ||
end | ||
|
||
facts("Map") do | ||
|
@@ -200,10 +208,10 @@ facts("Map") do | |
@chk map(mapi, 0) reinterpret(RGB24, 0x00000000) | ||
end | ||
|
||
context("ScaleAutoMinMax") do | ||
@compat context("ScaleAutoMinMax") do | ||
mapi = ScaleAutoMinMax() | ||
A = [100,550,1000] | ||
@chk map(mapi, A) @compat UFixed8.([0.0,0.5,1.0]) | ||
@chk map(mapi, A) UFixed8.([0.0,0.5,1.0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, this one was a accidental change. I can change it back if someone feels very strongly about it... Otherwise I'll just leave it like this.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine. |
||
mapi = ScaleAutoMinMax(RGB24) | ||
@chk map(mapi, A) reinterpret(RGB24, [0x00000000, 0x00808080, 0x00ffffff]) | ||
|
||
|
@@ -219,7 +227,7 @@ facts("Map") do | |
# s = 1.1269798f0 | ||
# val = 0xdeb5 | ||
# UFixed16(s*UFixed16(val,0)) == UFixed16((s/typemax(UInt16))*val) | ||
@fact maxabs(convert(Array{Int32}, res1) - convert(Array{Int32}, res2)) --> less_than_or_equal(1) | ||
@fact maximum(abs, convert(Array{Int32}, res1) - convert(Array{Int32}, res2)) --> less_than_or_equal(1) | ||
end | ||
|
||
context("Scaling and ssd") do | ||
|
@@ -264,7 +272,7 @@ facts("Map") do | |
|
||
context("Color conversion") do | ||
gray = collect(linspace(0.0,1.0,5)) # a 1-dimensional image | ||
gray8 = round(UInt8, 255*gray) | ||
gray8 = [round(UInt8, 255 * x) for x in gray] | ||
gray32 = UInt32[convert(UInt32, g)<<16 | convert(UInt32, g)<<8 | convert(UInt32, g) for g in gray8] | ||
imgray = Images.Image(gray, Dict{Compat.ASCIIString,Any}([("colordim",0), ("colorspace","Gray")])) | ||
buf = map(Images.mapinfo(UInt32, imgray), imgray) # Images.uint32color(imgray) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all in favor of the improvements in efficiency that the new capabilities bring, but it's Interesting how this is a step backwards in terms of readability. If one were to abandon 0.4 I suppose we could use a generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'm proposing you should do that. Coming in #542.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issues that affect 0.4 are JuliaLang/Compat.jl#306 and JuliaLang/Compat.jl#282. If JuliaLang/Compat.jl#306 is merged and used here, the only necessary change should be replacing
|
with.|
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and also
&
with.&
.....)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I wasn't complaining about this specific use, just making a more general language observation. I'm fine with how you've done it here.