-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for free drawings (pencil tool) (#34)
* feat: Add concepts/baseline for freedraw support * feat: Add handling of embedded resources * chore: Add freedraw to readme and regression test data * chore: Update readme
- Loading branch information
Showing
8 changed files
with
3,041 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package conversion | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAddPointsOffset(t *testing.T) { | ||
points := [][]float64{ | ||
{0, 0}, | ||
{32, 2}, | ||
{34, -4}, | ||
{-14, -8}, | ||
{-20, -10}, | ||
{-35, -13}, | ||
{-49, -16}, | ||
{-73, -16}, | ||
{-109, -12}, | ||
{-120, -7}, | ||
{-123, -5}, | ||
} | ||
|
||
expected := [][]float64{ | ||
{123, 16}, {155, 18}, {157, 12}, {109, 8}, {103, 6}, {88, 3}, {74, 0}, {50, 0}, {14, 4}, {3, 9}, {0, 11}, | ||
} | ||
|
||
xMin, yMin, result := AddPointsOffset(points) | ||
fmt.Println(result) | ||
|
||
svg := ConvertPointsToSvgPath(result, 297, 415, "none", "none", 2) | ||
fmt.Println(svg) | ||
|
||
assert.Equal(t, expected, result) | ||
assert.Equal(t, float64(-123), xMin) | ||
assert.Equal(t, float64(-16), yMin) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.