Skip to content
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

Unbreak broadcast support #18

Merged
merged 2 commits into from
Sep 7, 2018
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
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ os:
- linux
- osx
julia:
- 0.6
- 1.0
- nightly
notifications:
email: false
sudo: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("Measures"); Pkg.test("Measures"; coverage=true)'
matrix:
allow_failures:
- julia: nightly
before_install:
- if [ `uname` = "Linux" ]; then
sudo apt-get update -qq -y;
sudo apt-get install -y libcairo2 libfontconfig1 libpango1.0-0 libpng12-0 libpng12-dev libpixman-1-0 gettext;
fi
after_success:
- julia -e 'cd(Pkg.dir("Measures")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
- julia -e 'cd(Pkg.dir("Measures")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Status](https://travis-ci.org/JuliaGraphics/Measures.jl.svg?branch=master)](https://travis-ci.org/JuliaGraphics/Measures.jl)

This library generalizes and unifies the notion of measures used in
[Compose](https://github.com/dcjones/Compose.jl),
[Compose](https://github.com/GiovineItalia/Compose.jl),
[Compose3D](https://github.com/rohitvarkey/Compose3D.jl),
and [Escher](https://github.com/shashi/Escher.jl).

Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
julia 0.6
Compat 0.33.0
julia 0.7
4 changes: 1 addition & 3 deletions src/Measures.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
__precompile__()

module Measures
using Compat

export Measure, Length, AbsoluteLength, BoundingBox, AbsoluteBox, Absolute2DBox,
Absolute3DBox, Vec, Vec2, Vec3, AbsoluteVec, AbsoluteVec2, AbsoluteVec3,
Expand All @@ -24,5 +21,6 @@ Base.show(out::IO, x::Max) = print(out, "max(", x.a, ", ", x.b, ")")
Base.show(out::IO, x::Div) = print(out, x.a, " / ", x.b)
Base.show(out::IO, x::Mul) = print(out, x.a, " * ", x.b)

Broadcast.broadcastable(x::T) where T<:Measure = Ref(x)

end # module Measures
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compat.Test
using Test
using Measures

const imm = Length(:mm, 1)
Expand Down Expand Up @@ -81,4 +81,8 @@ end
@testset "min" begin
check_binop(max)
end
@testset "broadcasting" begin
a = [1mm, 2mm, 3mm]
@test all((a .+ 1mm) .== [2mm, 3mm, 4mm])
end
end