webp_server_go/encoder/rawconvert_test.go
Nova Kwok 543af2415f
Better configuration (#288)
* Better config

* print to log

* Upgrade golang.org/x/net

* Tidy go mods

* export WebpConfig

* Add TestConvertRawToJPG

* Add TestConvertRawToJPG

* Update Integration Tests UA

* Add README for supporting NEF

---------

Co-authored-by: Benny <benny.think@gmail.com>
2023-11-05 18:34:04 +08:00

27 lines
826 B
Go

package encoder
import (
"testing"
)
func TestConvertRawToJPG(t *testing.T) {
testCases := []struct {
rawPath string
optimizedPath string
expectedResult string
expectedStatus bool
}{
// blackbird.NEF is from https://github.com/jewright/nef-to-jpg/blob/main/photoconverter/Sample-Images/blackbird.NEF
{"../pics/blackbird.NEF", "../exhaust_test/", "../exhaust_test/blackbird.NEF_extracted.jpg", true},
{"../pics/big.jpg", "../exhaust_test/", "../pics/big.jpg", false},
}
for _, tc := range testCases {
result, status := ConvertRawToJPG(tc.rawPath, tc.optimizedPath)
if result != tc.expectedResult || status != tc.expectedStatus {
t.Errorf("ConvertRawToJPG(%s, %s) => (%s, %t), expected (%s, %t)", tc.rawPath, tc.optimizedPath, result, status, tc.expectedResult, tc.expectedStatus)
}
}
}