mirror of https://github.com/status-im/nimPNG.git
update tester
This commit is contained in:
parent
8e492e0f90
commit
357be6f26a
|
@ -45,3 +45,4 @@ Temporary Items
|
||||||
*.exe
|
*.exe
|
||||||
nimcache
|
nimcache
|
||||||
bug
|
bug
|
||||||
|
tester/temp.png
|
|
@ -2412,7 +2412,7 @@ proc filterScanLine(output: var cstring, scanLine, prevLine: cstring, len, byteW
|
||||||
for i in byteWidth..len-1:
|
for i in byteWidth..len-1:
|
||||||
output[i] = chr(scanLine[i].uint - scanLine[i - byteWidth].uint)
|
output[i] = chr(scanLine[i].uint - scanLine[i - byteWidth].uint)
|
||||||
else:
|
else:
|
||||||
raise PNGError("unsupported fitler type")
|
raise PNGError("unsupported filter type")
|
||||||
|
|
||||||
proc filterZero(output: var cstring, input: cstring, w, h, bpp: int) =
|
proc filterZero(output: var cstring, input: cstring, w, h, bpp: int) =
|
||||||
#the width of a scanline in bytes, not including the filter type
|
#the width of a scanline in bytes, not including the filter type
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import nimPNG, streams, math, strutils, tables, base64
|
import nimPNG, streams, math, strutils, tables, base64, os
|
||||||
|
|
||||||
type
|
type
|
||||||
Image = ref object
|
Image = ref object
|
||||||
|
@ -979,6 +979,17 @@ proc testAutoColorModels() =
|
||||||
addColor16(alpha16, 257, 0, 0, 10000)
|
addColor16(alpha16, 257, 0, 0, 10000)
|
||||||
testAutoColorModel(alpha16, 16, LCT_RGBA, 16, false)
|
testAutoColorModel(alpha16, 16, LCT_RGBA, 16, false)
|
||||||
|
|
||||||
|
proc testFilter() =
|
||||||
|
echo "test Filter"
|
||||||
|
let input = "tester" & DirSep & "tfilter.png"
|
||||||
|
let temp = "tester" & DirSep & "temp.png"
|
||||||
|
let png = loadPNG32(input)
|
||||||
|
discard savePNG32(temp, png.data, png.width, png.height)
|
||||||
|
let png2 = loadPNG32(temp)
|
||||||
|
if png.data != png2.data:
|
||||||
|
echo "testFilter failed"
|
||||||
|
quit()
|
||||||
|
|
||||||
proc doMain() =
|
proc doMain() =
|
||||||
testPNGCodec()
|
testPNGCodec()
|
||||||
testPngSuiteTiny()
|
testPngSuiteTiny()
|
||||||
|
@ -990,8 +1001,9 @@ proc doMain() =
|
||||||
testColorConvert2()
|
testColorConvert2()
|
||||||
testPaletteToPaletteConvert()
|
testPaletteToPaletteConvert()
|
||||||
testRGBToPaletteConvert()
|
testRGBToPaletteConvert()
|
||||||
test16bitColorEndianness();
|
test16bitColorEndianness()
|
||||||
testNoAutoConvert();
|
testNoAutoConvert()
|
||||||
testAutoColorModels();
|
testAutoColorModels()
|
||||||
|
testFilter()
|
||||||
|
|
||||||
doMain()
|
doMain()
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
Loading…
Reference in New Issue