MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestBackground

Method TestBackground

processing/flatten_test.go:48–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48func (s *FlattenTestSuite) TestBackground() {
49 testCases := []testCase[flattenTestCase]{
50 // Basic background tests with 32-bpp-with-alpha.bmp
51 {
52 opts: flattenTestCase{
53 name: "32-bpp-red-jpeg",
54 sourceFile: "test-images/bmp/32-bpp-with-alpha.bmp",
55 background: &color.Red,
56 format: imagetype.JPEG,
57 },
58 outSize: flattenTestOutSize,
59 },
60 {
61 opts: flattenTestCase{
62 name: "32-bpp-red-png",
63 sourceFile: "test-images/bmp/32-bpp-with-alpha.bmp",
64 background: &color.Red,
65 format: imagetype.PNG,
66 },
67 outSize: flattenTestOutSize,
68 },
69 {
70 opts: flattenTestCase{
71 name: "32-bpp-none-jpeg",
72 sourceFile: "test-images/bmp/32-bpp-with-alpha.bmp",
73 background: nil,
74 format: imagetype.JPEG,
75 },
76 outSize: flattenTestOutSize,
77 },
78 {
79 opts: flattenTestCase{
80 name: "32-bpp-none-png",
81 sourceFile: "test-images/bmp/32-bpp-with-alpha.bmp",
82 background: nil,
83 format: imagetype.PNG,
84 },
85 outSize: flattenTestOutSize,
86 },
87 // RGB16 source should stay RGB16
88 {
89 opts: flattenTestCase{
90 name: "16-bpp-gray-rgb16",
91 sourceFile: "test-images/png/16-bpp.png",
92 background: &color.Gray,
93 format: imagetype.PNG,
94 },
95 outSize: flattenTestOutSize,
96 outInterpretation: vips.InterpretationRGB16,
97 },
98 {
99 opts: flattenTestCase{
100 name: "16-bpp-red-rgb16",
101 sourceFile: "test-images/png/16-bpp.png",
102 background: &color.Red,
103 format: imagetype.PNG,
104 },
105 outSize: flattenTestOutSize,

Callers

nothing calls this directly

Calls 2

RunMethod · 0.80
processImageAndCheckMethod · 0.80

Tested by

no test coverage detected