Skip to content

Commit

Permalink
misc fixes for v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Nov 17, 2019
1 parent 50e9ce3 commit 4384e7a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Changelog

## [v1.8.0] - future release November-ish 2019
## [v1.8.0] - 17 November 2019

### Added

- `arrow()` arrows can have decoration (arbitrary graphics) drawn at a location along the shaft

### Changed

- `pathtopoly()`` revised
- now generating docs on macOS again
- `pathtopoly()` revised
- generating docs on macOS again, now that Travis/Cairo/macOS is back to normal
- some `arrowhead` options renamed to be more consistent
- bug fixed in `box()` with rounded corners (Thanks Anthony!)
- mktempdir()

### Removed

Expand All @@ -26,7 +28,7 @@

- initnoise() is correctly seedable
- center3pts() changed
- use of realpath() in test removed - it seems error-prone
- use of realpath() in test removed - it seems error-prone on recent macOS systems
- testing OpenType fonts in docs

### Removed
Expand Down
7 changes: 3 additions & 4 deletions src/juliagraphics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ function julialogo(;action=:fill,

color && setcolor(julia_green) # green
circle(Point(261.299, 31.672), Point(226.299, 31.672), :path)
(action == :clip) ? newsubpath() : do_action(action)

if action == :clip
clip()
else
if action :clip
do_action(action)
else
clip()
end
# restore saved color
setcolor(r, g, b, a)
Expand Down
5 changes: 2 additions & 3 deletions src/shapes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ box(x::Real, y::Real, width::Real, height::Real, action::Symbol=:nothing) =
rect(x - width/2.0, y - height/2.0, width, height, action)

"""
box(x, y, width, height, cornerradius, action=:nothing)
box(pt, width, height, cornerradius, action=:nothing)
Draw a box/rectangle centered at point `x/y` with `width` and `height` and
Draw a box/rectangle centered at point `pt` with `width` and `height` and
round each corner by `cornerradius`.
"""
function box(centerpoint::Point, width, height, cornerradius, action::Symbol=:stroke)
Expand Down Expand Up @@ -142,7 +142,6 @@ function box(centerpoint::Point, width, height, cornerradius, action::Symbol=:st

arc(p4center, cornerradius, (3pi)/2, 2pi, :none)
line(p4end)
line(p1start)

closepath()
do_action(action)
Expand Down
4 changes: 3 additions & 1 deletion src/text.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ textextents(str) = Cairo.text_extents(get_current_cr(), str)
"""
textpath(t)
Convert the text in string `t` to a new path, for subsequent filling/stroking etc...
Convert the text in string `t` and adds closed paths to the current path, for subsequent filling/stroking etc...
Typically you'll have to use `pathtopoly()` or `getpath()` or `getpathflat()` then
work through the one or more path(s). Or use `textoutlines()`.
Expand All @@ -176,6 +176,8 @@ end
valign=:baseline)
Convert text to a graphic path and apply `action`.
Note that this function discards any current path, so use `textpath()` to include text into other graphic constructions.
"""
function textoutlines(s::AbstractString, pos::Point=O, action::Symbol=:none;
halign=:left,
Expand Down
6 changes: 6 additions & 0 deletions test/morepolytests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@ end

@testset "insertvertices tests" begin
pgon = star(Point(20, 20), 200, 12, 0.7, π/7, vertices=true)
setline(5)
sethue("magenta")
prettypoly(pgon, :stroke, () -> circle(O, 20, :fill))
originallength = length(pgon)
@test length(insertvertices!(pgon)) == 2originallength
sethue("black")
setline(2)
prettypoly(pgon, :stroke, () -> circle(O, 10, :stroke))
end

@test finish() == true
11 changes: 8 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@ function run_all_tests()
end

if get(ENV, "LUXOR_KEEP_TEST_RESULTS", false) == "true"
cd(mktempdir())
@info("...Keeping the results")
# they changed mktempdir in v1.3
if VERSION <= v"1.2"
cd(mktempdir())
else
cd(mktempdir(cleanup=false))
end
@info("...Keeping the results in: $(pwd())")
run_all_tests()
@info("Test images saved in: $(pwd())")
@info("Test images were saved in: $(pwd())")
else
mktempdir() do tmpdir
cd(tmpdir) do
Expand Down

0 comments on commit 4384e7a

Please sign in to comment.