more tests
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
The ZPLGFA Golang package implements some functions to convert PNG, JPEG and GIF files to ZPL compatible ^GF-elements ([Graphic Fields](https://www.zebra.com/us/en/support-downloads/knowledge-articles/gf-graphic-field-zpl-command.html)).
|
The ZPLGFA Golang package implements some functions to convert PNG, JPEG and GIF files to ZPL compatible ^GF-elements ([Graphic Fields](https://www.zebra.com/us/en/support-downloads/knowledge-articles/gf-graphic-field-zpl-command.html)).
|
||||||
|
|
||||||
|
If you need a ready to use application and don't want to hassle around with source code, take a look at the [ZPLGFA CLI Tool](https://github.com/SimonWaldherr/zplgfa/tree/master/cmd/zplgfa) which is based on this package.
|
||||||
|
|
||||||
## install
|
## install
|
||||||
|
|
||||||
1. [install Golang](https://golang.org/doc/install)
|
1. [install Golang](https://golang.org/doc/install)
|
||||||
|
|||||||
7
tests/README.md
Normal file
7
tests/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# ZPLGFA Tests
|
||||||
|
|
||||||
|
This folder contains some test cases for the ZPLGFA package.
|
||||||
|
The test coverage can be seen at the [coveralls](https://coveralls.io/github/SimonWaldherr/zplgfa?branch=master) project page.
|
||||||
|
|
||||||
|
[](https://coveralls.io/github/SimonWaldherr/zplgfa?branch=master)
|
||||||
|
|
||||||
BIN
tests/test4.jpg
Normal file
BIN
tests/test4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
tests/test5.png
Normal file
BIN
tests/test5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
File diff suppressed because one or more lines are too long
@@ -185,9 +185,6 @@ func ConvertToGraphicField(source image.Image, graphicType GraphicType) string {
|
|||||||
lastLine = curLine
|
lastLine = curLine
|
||||||
case Binary:
|
case Binary:
|
||||||
GraphicFieldData += fmt.Sprintf("%s", line)
|
GraphicFieldData += fmt.Sprintf("%s", line)
|
||||||
default:
|
|
||||||
graphicType = CompressedASCII
|
|
||||||
GraphicFieldData += fmt.Sprintln(CompressASCII(hexstr))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package zplgfa
|
package zplgfa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"image"
|
"image"
|
||||||
_ "image/gif"
|
_ "image/gif"
|
||||||
@@ -81,7 +82,13 @@ func Test_ConvertToZPL(t *testing.T) {
|
|||||||
gfimg = strings.Replace(gfimg, " ", "", -1)
|
gfimg = strings.Replace(gfimg, " ", "", -1)
|
||||||
gfimg = strings.Replace(gfimg, "\n", "", -1)
|
gfimg = strings.Replace(gfimg, "\n", "", -1)
|
||||||
|
|
||||||
|
switch graphictype {
|
||||||
|
case "Binary":
|
||||||
|
gfimg = base64.StdEncoding.EncodeToString([]byte(gfimg))
|
||||||
|
}
|
||||||
|
|
||||||
if gfimg != zplstring {
|
if gfimg != zplstring {
|
||||||
|
log.Printf("ConvertToZPL Test for file \"%s\" failed, wanted: \n%s\ngot: \n%s\n", filename, zplstring, gfimg)
|
||||||
t.Fatalf("Testcase %d ConvertToZPL failed", i)
|
t.Fatalf("Testcase %d ConvertToZPL failed", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user