diff --git a/tests/bench_jpeg.nim b/tests/bench_jpeg.nim index c5e02dd..93a5de4 100644 --- a/tests/bench_jpeg.nim +++ b/tests/bench_jpeg.nim @@ -1,19 +1,17 @@ -import benchy, jpegsuite, pixie/fileformats/jpeg, stb_image/read as stbi, - strformat, os +import benchy, pixie/fileformats/jpeg, jpegsuite, os, stb_image/read as stbi for file in jpegSuiteFiles: let data = readFile(file) - var name = file.splitPath.tail - name.setLen(min(name.len, 22)) - timeIt &"pixie {name} decode": + + timeIt "pixie " & file.splitPath.tail & " decode", 10: discard decodeJpeg(data) block: for file in jpegSuiteFiles: let data = readFile(file) var name = file.splitPath.tail - name.setLen(min(name.len, 22)) - timeIt &"stb {name} decode": + + timeIt "stb " & file.splitPath.tail & " decode", 10: var width, height, channels: int discard loadFromMemory( cast[seq[byte]](data), diff --git a/tests/test_images_draw.nim b/tests/test_images_draw.nim index e071244..c2d99f1 100644 --- a/tests/test_images_draw.nim +++ b/tests/test_images_draw.nim @@ -279,7 +279,7 @@ block: image.draw(strokeImage) image.xray("tests/images/fillOptimization.png") - # doAssert image[10, 10] == rgbx(255, 127, 63, 255) + doAssert image[10, 10] == rgbx(255, 127, 63, 255) block: let a = newImage(100, 100) diff --git a/tests/xrays.nim b/tests/xrays.nim index c13f1f9..e47a523 100644 --- a/tests/xrays.nim +++ b/tests/xrays.nim @@ -1,26 +1,17 @@ import pixie, strformat, os, strutils -proc makeDirs*(dirs: string) = - var path = "" - for dir in dirs.split("/"): - path.add dir - if not dirExists(path): - echo "mkdir ", path - createDir(path) - path.add "/" - proc xray*(image: Image, masterPath: string) = let - imagePath = "tmp/generated/" & masterPath - xRayPath = "tmp/xray/" & masterPath - makeDirs(imagePath.splitPath.head) - makeDirs(xRayPath.splitPath.head) - image.writeFile(imagePath) + generatedPath = "tmp/generated/" & masterPath + xrayPath = "tmp/xray/" & masterPath + createDir(generatedPath.splitPath.head) + createDir(xrayPath.splitPath.head) + image.writeFile(generatedPath) let master = readImage(masterPath) (score, xRay) = diff(image, master) - xRay.writeFile(xRayPath) - echo &"diff {masterPath} -> {score:0.6f}" + xRay.writeFile(xrayPath) + echo &"xray {masterPath} -> {score:0.6f}" proc xray*(mask: Mask, masterPath: string) = mask.newImage.xray(masterPath)