summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/image/font/sfnt/sfnt_test.go')
-rw-r--r--vendor/golang.org/x/image/font/sfnt/sfnt_test.go74
1 files changed, 74 insertions, 0 deletions
diff --git a/vendor/golang.org/x/image/font/sfnt/sfnt_test.go b/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
index 85d96a96f..dc1c9c54f 100644
--- a/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
+++ b/vendor/golang.org/x/image/font/sfnt/sfnt_test.go
@@ -43,6 +43,16 @@ func cubeTo(xa, ya, xb, yb, xc, yc fixed.Int26_6) Segment {
}
}
+func translate(dx, dy fixed.Int26_6, s Segment) Segment {
+ translateArgs(&s.Args, dx, dy)
+ return s
+}
+
+func transform(txx, txy, tyx, tyy int16, dx, dy fixed.Int26_6, s Segment) Segment {
+ transformArgs(&s.Args, txx, txy, tyx, tyy, dx, dy)
+ return s
+}
+
func checkSegmentsEqual(got, want []Segment) error {
if len(got) != len(want) {
return fmt.Errorf("got %d elements, want %d\noverall:\ngot %v\nwant %v",
@@ -378,6 +388,70 @@ func TestTrueTypeSegments(t *testing.T) {
lineTo(614, 1638),
lineTo(614, 0),
lineTo(205, 0),
+ }, {
+ // five
+ // - contour #0
+ moveTo(0, 0),
+ lineTo(0, 100),
+ lineTo(400, 100),
+ lineTo(400, 0),
+ lineTo(0, 0),
+ }, {
+ // six
+ // - contour #0
+ moveTo(0, 0),
+ lineTo(0, 100),
+ lineTo(400, 100),
+ lineTo(400, 0),
+ lineTo(0, 0),
+ // - contour #1
+ translate(111, 234, moveTo(205, 0)),
+ translate(111, 234, lineTo(205, 1638)),
+ translate(111, 234, lineTo(614, 1638)),
+ translate(111, 234, lineTo(614, 0)),
+ translate(111, 234, lineTo(205, 0)),
+ }, {
+ // seven
+ // - contour #0
+ moveTo(0, 0),
+ lineTo(0, 100),
+ lineTo(400, 100),
+ lineTo(400, 0),
+ lineTo(0, 0),
+ // - contour #1
+ transform(1<<13, 0, 0, 1<<13, 56, 117, moveTo(205, 0)),
+ transform(1<<13, 0, 0, 1<<13, 56, 117, lineTo(205, 1638)),
+ transform(1<<13, 0, 0, 1<<13, 56, 117, lineTo(614, 1638)),
+ transform(1<<13, 0, 0, 1<<13, 56, 117, lineTo(614, 0)),
+ transform(1<<13, 0, 0, 1<<13, 56, 117, lineTo(205, 0)),
+ }, {
+ // eight
+ // - contour #0
+ moveTo(0, 0),
+ lineTo(0, 100),
+ lineTo(400, 100),
+ lineTo(400, 0),
+ lineTo(0, 0),
+ // - contour #1
+ transform(3<<13, 0, 0, 1<<13, 56, 117, moveTo(205, 0)),
+ transform(3<<13, 0, 0, 1<<13, 56, 117, lineTo(205, 1638)),
+ transform(3<<13, 0, 0, 1<<13, 56, 117, lineTo(614, 1638)),
+ transform(3<<13, 0, 0, 1<<13, 56, 117, lineTo(614, 0)),
+ transform(3<<13, 0, 0, 1<<13, 56, 117, lineTo(205, 0)),
+ }, {
+ // nine
+ // - contour #0
+ moveTo(0, 0),
+ lineTo(0, 100),
+ lineTo(400, 100),
+ lineTo(400, 0),
+ lineTo(0, 0),
+ // - contour #1
+ transform(22381, 8192, 5996, 14188, 237, 258, moveTo(205, 0)),
+ transform(22381, 8192, 5996, 14188, 237, 258, lineTo(205, 1638)),
+ transform(22381, 8192, 5996, 14188, 237, 258, lineTo(614, 1638)),
+ transform(22381, 8192, 5996, 14188, 237, 258, lineTo(614, 0)),
+ transform(22381, 8192, 5996, 14188, 237, 258, lineTo(205, 0)),
}}
testSegments(t, "glyfTest.ttf", wants)