From 1ccceccb018f9e005f1d5b7b0ef7f69f1ab73f8a Mon Sep 17 00:00:00 2001 From: bootchk Date: Mon, 11 Dec 2023 10:07:14 -0500 Subject: [PATCH] Fix #10460 --- app/pdb/vectors-cmds.c | 4 +-- libgimp/gimpvectors_pdb.c | 4 +-- pdb/groups/vectors.pdb | 6 ++-- .../script-fu/test/tests/PDB/vectors-new.scm | 33 +++++++++++-------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/app/pdb/vectors-cmds.c b/app/pdb/vectors-cmds.c index 2db2b6d777..826cfb7485 100644 --- a/app/pdb/vectors-cmds.c +++ b/app/pdb/vectors-cmds.c @@ -2464,7 +2464,7 @@ register_vectors_procs (GimpPDB *pdb) gimp_param_spec_vectors ("vectors", "vectors", "The vectors object to export, or %NULL for all in the image", - FALSE, + TRUE, GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE)); gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); @@ -2493,7 +2493,7 @@ register_vectors_procs (GimpPDB *pdb) gimp_param_spec_vectors ("vectors", "vectors", "The vectors object to export, or %NULL for all in the image", - FALSE, + TRUE, GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE)); gimp_procedure_add_return_value (procedure, gimp_param_spec_string ("string", diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c index a500d93df2..df6c3b124f 100644 --- a/libgimp/gimpvectors_pdb.c +++ b/libgimp/gimpvectors_pdb.c @@ -1191,7 +1191,7 @@ gimp_vectors_import_from_string (GimpImage *image, * gimp_vectors_export_to_file: * @image: The image. * @file: The SVG file to create. - * @vectors: The vectors object to export, or %NULL for all in the image. + * @vectors: (nullable): The vectors object to export, or %NULL for all in the image. * * save a path as an SVG file. * @@ -1234,7 +1234,7 @@ gimp_vectors_export_to_file (GimpImage *image, /** * gimp_vectors_export_to_string: * @image: The image. - * @vectors: The vectors object to export, or %NULL for all in the image. + * @vectors: (nullable): The vectors object to export, or %NULL for all in the image. * * Save a path as an SVG string. * diff --git a/pdb/groups/vectors.pdb b/pdb/groups/vectors.pdb index 70591063b1..07930c30ea 100644 --- a/pdb/groups/vectors.pdb +++ b/pdb/groups/vectors.pdb @@ -1266,7 +1266,8 @@ HELP desc => 'The image' }, { name => 'file', type => 'file', desc => 'The SVG file to create.' }, - { name => 'vectors', type => 'vectors', no_validate => 1, + { name => 'vectors', type => 'vectors', + no_validate => 1, none_ok => 1, desc => 'The vectors object to export, or %NULL for all in the image' } ); @@ -1302,7 +1303,8 @@ HELP @inargs = ( { name => 'image', type => 'image', desc => 'The image' }, - { name => 'vectors', type => 'vectors', no_validate => 1, + { name => 'vectors', type => 'vectors', + no_validate => 1, none_ok => 1, desc => 'The vectors object to export, or %NULL for all in the image' } ); diff --git a/plug-ins/script-fu/test/tests/PDB/vectors-new.scm b/plug-ins/script-fu/test/tests/PDB/vectors-new.scm index 59431ba9dd..bec960b94b 100644 --- a/plug-ins/script-fu/test/tests/PDB/vectors-new.scm +++ b/plug-ins/script-fu/test/tests/PDB/vectors-new.scm @@ -70,17 +70,24 @@ (assert `(= (car (gimp-image-get-vectors ,testImage)) 1)) -; FIXME: crashes in gimpvectors-export.c line 234 -; possibly because path has no strokes? -; export to string succeeds -;(assert `(gimp-vectors-export-to-string -; ,testImage -; ,testPath)) -; export-to-string all -; FAIL: crashes -; PDB doc says 0 should work, and ScriptFu is marshalling to a null GimpVectors* -; so the PDB function in C is at fault? -;(assert `(gimp-vectors-export-to-string -; ,testImage -; 0)) +; export methods + +; export string succeeds +(assert `(gimp-vectors-export-to-string + ,testImage + ,testPath)) + +; export string all succeeds +; passing 0 for path means "all" +(assert `(gimp-vectors-export-to-string + ,testImage + 0)) + +; export file all succeeds +(assert `(gimp-vectors-export-to-file + ,testImage + "tmp.svg" + 0)) + +