MCPcopy Create free account
hub / github.com/LevInteractive/imageup / TestGetDimensions

Function TestGetDimensions

gcp_test.go:60–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestGetDimensions(t *testing.T) {
61 tests := []struct {
62 filename string
63 width int
64 height int
65 }{
66 {"./testdata/ben.jpg", 2000, 1500},
67 {"./testdata/acai.jpg", 4032, 3024},
68 {"./testdata/dog.jpg", 4592, 3448},
69 {"./testdata/small-png.png", 167, 167},
70 }
71
72 for _, tt := range tests {
73 width, height, err := GetDimensions(openFile(tt.filename))
74 if err != nil {
75 t.Errorf("Received unexpected error when getting dimensions: %s", err)
76 }
77 if width != tt.width {
78 t.Errorf("GetDimensions(%s) has wrong width. Expected %d to be %d", tt.filename, width, tt.width)
79 }
80 if height != tt.height {
81 t.Errorf("GetDimensions(%s) has wrong height dims. Expected %d to be %d", tt.filename, height, tt.height)
82 }
83 }
84}
85
86func TestManipulate(t *testing.T) {
87 tests := []struct {

Callers

nothing calls this directly

Calls 2

GetDimensionsFunction · 0.85
openFileFunction · 0.85

Tested by

no test coverage detected