Merge pull request #3 from jangko/filter_bug

update tester
This commit is contained in:
andri lim 2016-01-18 09:25:39 +07:00
commit 7b364c04bb
4 changed files with 125 additions and 112 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ Temporary Items
*.exe
nimcache
bug
tester/temp.png

View File

@ -2412,7 +2412,7 @@ proc filterScanLine(output: var cstring, scanLine, prevLine: cstring, len, byteW
for i in byteWidth..len-1:
output[i] = chr(scanLine[i].uint - scanLine[i - byteWidth].uint)
else:
raise PNGError("unsupported fitler type")
raise PNGError("unsupported filter type")
proc filterZero(output: var cstring, input: cstring, w, h, bpp: int) =
#the width of a scanline in bytes, not including the filter type

View File

@ -1,4 +1,4 @@
import nimPNG, streams, math, strutils, tables, base64
import nimPNG, streams, math, strutils, tables, base64, os
type
Image = ref object
@ -979,6 +979,17 @@ proc testAutoColorModels() =
addColor16(alpha16, 257, 0, 0, 10000)
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() =
testPNGCodec()
testPngSuiteTiny()
@ -990,8 +1001,9 @@ proc doMain() =
testColorConvert2()
testPaletteToPaletteConvert()
testRGBToPaletteConvert()
test16bitColorEndianness();
testNoAutoConvert();
testAutoColorModels();
test16bitColorEndianness()
testNoAutoConvert()
testAutoColorModels()
testFilter()
doMain()

BIN
tester/tfilter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB