From 98fb6c833ac8dbe3a6221dac29efbbf4caffdde2 Mon Sep 17 00:00:00 2001 From: Tamas Date: Fri, 7 Sep 2018 15:21:58 -0700 Subject: [PATCH 1/2] drop support for 0.6 --- .travis.yml | 16 ++++++++++------ README.md | 2 +- REQUIRE | 3 +-- src/Measures.jl | 3 --- test/runtests.jl | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8cfe5e7..8b46216 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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())' diff --git a/README.md b/README.md index 229e55e..74d500d 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/REQUIRE b/REQUIRE index e0ee8c3..859ad46 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1 @@ -julia 0.6 -Compat 0.33.0 +julia 0.7 diff --git a/src/Measures.jl b/src/Measures.jl index b09ad2b..4ea6b7e 100644 --- a/src/Measures.jl +++ b/src/Measures.jl @@ -1,7 +1,4 @@ -__precompile__() - module Measures -using Compat export Measure, Length, AbsoluteLength, BoundingBox, AbsoluteBox, Absolute2DBox, Absolute3DBox, Vec, Vec2, Vec3, AbsoluteVec, AbsoluteVec2, AbsoluteVec3, diff --git a/test/runtests.jl b/test/runtests.jl index 53d8806..48644fe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using Compat.Test +using Test using Measures const imm = Length(:mm, 1) From 6d29436f7e93142845cfe8ceb32e7720f358beb4 Mon Sep 17 00:00:00 2001 From: Tamas Date: Fri, 7 Sep 2018 15:23:15 -0700 Subject: [PATCH 2/2] add support for measure broadcasting This solution was identified by @Mattriks over in https://github.com/GiovineItalia/Compose.jl/pull/282#issuecomment-419423106 --- src/Measures.jl | 1 + test/runtests.jl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Measures.jl b/src/Measures.jl index 4ea6b7e..6fe167f 100644 --- a/src/Measures.jl +++ b/src/Measures.jl @@ -21,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 diff --git a/test/runtests.jl b/test/runtests.jl index 48644fe..66684cd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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