Tests: Add unit tests
This commit is contained in:
parent
69d302248c
commit
33b08f15e5
2 changed files with 14 additions and 0 deletions
|
@ -35,4 +35,11 @@ func TestOpenJpeg(t *testing.T) {
|
|||
t.Error("img must not be nil")
|
||||
}
|
||||
})
|
||||
t.Run("filename empty", func(t *testing.T) {
|
||||
img, err := OpenJpeg("", 0)
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, "filename missing", err.Error())
|
||||
assert.Nil(t, img)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -81,3 +81,10 @@ func TestParseQuality(t *testing.T) {
|
|||
assert.Equal(t, Quality(100), ParseQuality("100"))
|
||||
})
|
||||
}
|
||||
|
||||
func TestQuality_String(t *testing.T) {
|
||||
assert.Equal(t, "95", QualityBest.String())
|
||||
assert.Equal(t, "92", QualityHigh.String())
|
||||
assert.Equal(t, "75", QualityBad.String())
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue