diff --git a/.gitignore b/.gitignore index b33146d..fc424e8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ testresults/ /tests/* !/tests/*.nim !/tests/*.nims +/src/blend2d-core/ +/src/blend2d/bindings/*_impl +!/tests/out +/tests/out/* \ No newline at end of file diff --git a/tests/config.nims b/tests/config.nims new file mode 100644 index 0000000..1bfc583 --- /dev/null +++ b/tests/config.nims @@ -0,0 +1,6 @@ +switch("path", "$projectDir/../src") +# --passC:"-I/home/runner/work/blend2d-nim/blend2d-nim/blend2d/src" +# --passL:"-L/home/runner/work/blend2d-nim/blend2d-nim/blend2d/build -lblend2d" + +--passC:"-I/Users/georgelemon/Development/otherpackages/blend2dnim/src/blend2d-core/src/" +--passL: "-L$HOME/.nimble/lib -lblend2d" \ No newline at end of file diff --git a/tests/test1.nim b/tests/test1.nim new file mode 100644 index 0000000..3fc7fa3 --- /dev/null +++ b/tests/test1.nim @@ -0,0 +1,38 @@ +import unittest +import std/os + +import blend2d + +test "filled background": + group main, 200, 200: + this.fillStyle(colSalmon) + main.exportAs("tests" / "out" / "filled.png") + +test "draw circle + stroke": + group mainImage, 200, 200: + let sun = circle(100, 100, 50) + sun.stroke(50, rgba(242,224,171,255)) + this.add(sun.addr, rgba(230,197,115,255)) + mainImage.exportAs("tests" / "out" / "circle.png") + +test "draw gradient": + group img, 480, 480: + let + blRoundRect = roundRect(180, 180, 120, 120, 25, 25) + linearGradient = linearGradient(0, 0, 0, 480) + linearGradient.add(0.0, ColorHex(0xFFFFFFFF)) + linearGradient.add(0.5, ColorHex(0xFF5FAFDF)) + linearGradient.add(1.0, ColorHex(0xFF2F5FDF)) + + this.fill(colWhitesmoke) + this.add(blRoundRect.addr, linearGradient) + this.add(img) + + img.exportAs("tests" / "out" / "gradient.png") + +test "draw profile": + group main, 700, 700: + this.fill(colSalmon) + let area = rect(190, 140, 320, 400, 25, 25) + this.add(area.addr, colWhite) + main.exportAs("tests" / "out" / "ui.png") \ No newline at end of file