-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from streetbyters/development
Development
- Loading branch information
Showing
5 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
# vendor/ | ||
|
||
# Editor files | ||
.idea | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package himage | ||
|
||
import ( | ||
"errors" | ||
"image/png" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestNewHimageWithPath(t *testing.T) { | ||
hImage := NewHimageWithPath(filepath.Join("test-files", "850x566.png")) | ||
if hImage.Error != nil { | ||
t.Error(hImage.Error) | ||
} | ||
|
||
if hImage.Detail.Mime != "image/png" { | ||
t.Error(errors.New("detail mime is not valid")) | ||
} | ||
|
||
if hImage.Detail.Width != 850 { | ||
t.Error(errors.New("detail width is not valid")) | ||
} | ||
|
||
if hImage.Detail.Height != 566 { | ||
t.Error(errors.New("detail height is not valid")) | ||
} | ||
|
||
if hImage.Detail.Size == 0 { | ||
t.Error(errors.New("detail size is not valid")) | ||
} | ||
|
||
if hImage.qPNG != png.DefaultCompression { | ||
t.Error(errors.New("png compression is not valid")) | ||
} | ||
|
||
if len(hImage.quality) == 0 { | ||
t.Error(errors.New("quality specs is not valid")) | ||
} | ||
} | ||
|
||
func TestNewHimageWithPathNotExistsFile(t *testing.T) { | ||
hImage := NewHimageWithPath(filepath.Join("test-files", "notfoung.png")) | ||
if hImage.Error == nil { | ||
t.Error(errors.New("invalid file open")) | ||
} | ||
} |