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

Function TestGetOrientation

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

Source from the content-addressed store, hash-verified

35}
36
37func TestGetOrientation(t *testing.T) {
38 tests := []struct {
39 filename string
40 expected int
41 }{
42 {"./testdata/ben.jpg", 1},
43 {"./testdata/acai.jpg", 6},
44 {"./testdata/dog.jpg", 6},
45 {"./testdata/small-png.png", 1},
46 {"./testdata/small-logo.jpg", 1},
47 }
48
49 for _, tt := range tests {
50 result, err := GetOrientation(openFile(tt.filename))
51 if err != nil {
52 t.Errorf("Received unexpected error when getting orientation: %s", err)
53 }
54 if result != tt.expected {
55 t.Errorf("Expected GetOrientation(%s) to be %d but got %v", tt.filename, tt.expected, result)
56 }
57 }
58}
59
60func TestGetDimensions(t *testing.T) {
61 tests := []struct {

Callers

nothing calls this directly

Calls 2

GetOrientationFunction · 0.85
openFileFunction · 0.85

Tested by

no test coverage detected