forked from gen2brain/go-fitz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfitz_content_types_test.go
152 lines (110 loc) · 2.85 KB
/
fitz_content_types_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package fitz
import (
_ "embed"
"testing"
)
func testContentType(want string, b []byte, t *testing.T) {
if got := contentType(b); got != want {
t.Errorf("contentType([]byte) = '%v'; want '%v'", got, want)
}
}
//go:embed testdata/test.bmp
var bmp []byte
func TestContentTypeBMP(t *testing.T) {
testContentType("image/bmp", bmp, t)
}
//go:embed testdata/test.epub
var epub []byte
func TestContentTypeEPUB(t *testing.T) {
testContentType("application/epub+zip", epub, t)
}
//go:embed testdata/test.mobi
var mobi []byte
func TestContentTypeMOBI(t *testing.T) {
testContentType("application/x-mobipocket-ebook", mobi, t)
}
//go:embed testdata/test.cbz
var cbz []byte
func TestContentTypeCBZ(t *testing.T) {
testContentType("application/zip", cbz, t)
}
//go:embed testdata/test.fb2
var fb2 []byte
func TestContentTypeFB2(t *testing.T) {
testContentType("text/xml", fb2, t)
}
//go:embed testdata/test.gif
var gif []byte
func TestContentTypeGIF(t *testing.T) {
testContentType("image/gif", gif, t)
}
//go:embed testdata/test.jb2
var jb2 []byte
func TestContentTypeJBIG2(t *testing.T) {
testContentType("image/x-jb2", jb2, t)
}
//go:embed testdata/test.jpg
var jpg []byte
func TestContentTypeJPEG(t *testing.T) {
testContentType("image/jpeg", jpg, t)
}
//go:embed testdata/test.jp2
var jp2 []byte
func TestContentTypeJPEG2000(t *testing.T) {
testContentType("image/jp2", jp2, t)
}
//go:embed testdata/test.jxr
var jxr []byte
func TestContentTypeJPEGXR(t *testing.T) {
testContentType("image/vnd.ms-photo", jxr, t)
}
//go:embed testdata/test.pam
var pam []byte
func TestContentTypePAM(t *testing.T) {
testContentType("image/x-portable-arbitrarymap", pam, t)
}
//go:embed testdata/test.pbm
var pbm []byte
func TestContentTypePBM(t *testing.T) {
testContentType("image/x-portable-bitmap", pbm, t)
}
//go:embed testdata/test.pdf
var pdf []byte
func TestContentTypePDF(t *testing.T) {
testContentType("application/pdf", pdf, t)
}
//go:embed testdata/test.psd
var psd []byte
func TestContentTypePSD(t *testing.T) {
testContentType("image/vnd.adobe.photoshop", psd, t)
}
//go:embed testdata/test.pfm
var pfm []byte
func TestContentTypePFM(t *testing.T) {
testContentType("image/x-portable-floatmap", pfm, t)
}
//go:embed testdata/test.pgm
var pgm []byte
func TestContentTypePGM(t *testing.T) {
testContentType("image/x-portable-greymap", pgm, t)
}
//go:embed testdata/test.ppm
var ppm []byte
func TestContentTypePPM(t *testing.T) {
testContentType("image/x-portable-pixmap", ppm, t)
}
//go:embed testdata/test.svg
var svg []byte
func TestContentTypeSVG(t *testing.T) {
testContentType("image/svg+xml", svg, t)
}
//go:embed testdata/test.tif
var tif []byte
func TestContentTypeTIFF(t *testing.T) {
testContentType("image/tiff", tif, t)
}
//go:embed testdata/test.xps
var xps []byte
func TestContentTypeXPS(t *testing.T) {
testContentType("application/oxps", xps, t)
}