Skip to content

Commit

Permalink
inkscape: add unit test for ps2pdf plugin
Browse files Browse the repository at this point in the history
to prevent future regressen add a smal test,
to check if ps2pdf plugin is working
by createing a .ps / .eps file and converting it back to svg
  • Loading branch information
tuxcoder committed Apr 19, 2024
1 parent 9bf31ea commit fae8ec3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkgs/applications/graphics/inkscape/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, boehmgc
, boost
, cairo
, callPackage
, cmake
, desktopToDarwinBundle
, fetchurl
Expand Down Expand Up @@ -172,6 +173,8 @@ stdenv.mkDerivation rec {
done
'';

passthru.tests.ps2pdf-plugin = callPackage ./test-ps2pdf-plugin.nix { };

meta = with lib; {
description = "Vector graphics editor";
homepage = "https://www.inkscape.org";
Expand Down
27 changes: 27 additions & 0 deletions pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ inkscape, runCommand, writeTextFile }:

let
svg_file = writeTextFile {
name = "test.svg";
text = ''
<?xml version="1.0" encoding="UTF-8"?>
<svg width="50" height="50" version="1.1">
<ellipse cx="1" cy="1" rx="1" ry="1" />
</svg>'';
};
in
runCommand "inkscape-test-eps"
{
nativeBuildInputs = [ inkscape ];
} ''
echo ps test
inkscape ${svg_file} --export-type=ps -o test.ps
inkscape test.ps -o test.ps.svg
echo eps test
inkscape ${svg_file} --export-type=eps -o test.eps
inkscape test.eps -o test.eps.svg
# inkscape does not return an error code, only does not create files
[[ -f test.ps.svg && -f test.eps.svg ]] && touch $out
''

0 comments on commit fae8ec3

Please sign in to comment.