op/clip: automatically close Path in Outlines

Unclosed path segments in Path will be automatically
closed by a line.

Fixes: https://todo.sr.ht/~eliasnaur/gio/320
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2021-12-19 17:09:54 +01:00
committed by Elias Naur
parent 0117de71d3
commit 11bb86166a
10 changed files with 123 additions and 28 deletions
-11
View File
@@ -15,17 +15,6 @@ import (
)
func TestPathOutline(t *testing.T) {
t.Run("unclosed path", func(t *testing.T) {
defer func() {
if err := recover(); err == nil {
t.Error("Outline of an open path didn't panic")
}
}()
var p clip.Path
p.Begin(new(op.Ops))
p.Line(f32.Pt(10, 10))
clip.Outline{Path: p.End()}.Op()
})
t.Run("closed path", func(t *testing.T) {
defer func() {
if err := recover(); err != nil {