diff --git a/plug-ins/script-fu/test/frameworks/testing.scm b/plug-ins/script-fu/test/frameworks/testing.scm index 02811150b9a5a6c20d9b7aa3f52f93027093b99a..48733e88c9f566319f94ee6945fe3daa96a398cb 100644 --- a/plug-ins/script-fu/test/frameworks/testing.scm +++ b/plug-ins/script-fu/test/frameworks/testing.scm @@ -443,11 +443,31 @@ (define (testing:path-to-color-profile name) (string-append "/work/colorProfilesICC/" name)) +; Return a new layer in the given image, not inserted. +; The new layer initial attributes are hard-coded. +; The new layer is not added i.e. inserted in the image. +(define (testing:layer-new testImage) + (gimp-layer-new + testImage + "LayerNew" ; name + 21 22 ; dimensions + RGB-IMAGE ; mode + 50.0 ; opacity + LAYER-MODE-NORMAL)) + +; Return a new layer in the given image, inserted. +; The new layer initial attributes are hard-coded. +(define (testing:layer-new-inserted testImage) + (let ((newLayer (testing:layer-new testImage))) + (gimp-image-insert-layer + testImage + newLayer + 0 0) ; parent, position within parent + newLayer)) -; float comparison utility +; float comparison utility ; are a and b relatively equal, to within epsilon? - (define (equal-relative? a b epsilon) (<= (abs (- a b)) (* epsilon (max (abs a) (abs b))))) diff --git a/plug-ins/script-fu/test/meson.build b/plug-ins/script-fu/test/meson.build index 8679cb27e55bcc14f6cfd5ecb04259535b46b220..394dca7d9e4d84f44024402880e1879352bb8a7d 100644 --- a/plug-ins/script-fu/test/meson.build +++ b/plug-ins/script-fu/test/meson.build @@ -69,6 +69,10 @@ test_scripts = [ 'tests' / 'PDB' / 'edit' / 'buffer.scm', 'tests' / 'PDB' / 'edit' / 'edit.scm', 'tests' / 'PDB' / 'edit' / 'edit-multi-layer.scm', + 'tests' / 'PDB' / 'edit' / 'edit-cut.scm', + # this is on old test script, that crashes GIMP + # if the crash is fixed, don't install this script + 'tests' / 'PDB' / 'edit' / 'edit-crash.scm', 'tests' / 'PDB' / 'gimp' / 'gimp.scm', 'tests' / 'PDB' / 'gimp' / 'PDB.scm', diff --git a/plug-ins/script-fu/test/tests/PDB/context/context-resource.scm b/plug-ins/script-fu/test/tests/PDB/context/context-resource.scm index e7a3a7e2c095fe52fd4fafc661fb611e80446180..831f26eb6a7050ede90f68274e4fde56ba57a4d5 100644 --- a/plug-ins/script-fu/test/tests/PDB/context/context-resource.scm +++ b/plug-ins/script-fu/test/tests/PDB/context/context-resource.scm @@ -1,5 +1,11 @@ ; test resource methods of Context +; !!! This requires a fresh install of GIMP, +; so that the context is the default, +; and not the user's last choice from prior session. + +(script-fu-use-v3) + ; function to test methods on Resource for a valid Resource ID. @@ -10,32 +16,37 @@ (assert `(integer? ,resource)) ; get-name returns a string - (assert `(string? (car (gimp-resource-get-name ,resource)))) + (assert `(string? (gimp-resource-get-name ,resource))) ; id-is-valid returns truth - (assert-PDB-true `(gimp-resource-id-is-valid ,resource)) + (assert `(gimp-resource-id-is-valid ,resource)) + + ; since 3.0rc3 resource-get-identifiers is private to libgimp ; gimp-resource-get-identifiers succeeds ; it returns a triplet - (assert `(gimp-resource-get-identifiers ,resource)) + ;(assert `(gimp-resource-get-identifiers ,resource)) ; gimp-resource-get-identifiers returns numeric for is-internal ; Some of the fresh gimp active resource are internal, some not !!! - (assert `(number? (car (gimp-resource-get-identifiers ,resource)))) + ;(assert `(number? (gimp-resource-get-identifiers ,resource))) ; name from get-identifiers is same as from gimp-resource-get-name ; name is second field of triplet i.e. cadr - (assert `(string=? (cadr (gimp-resource-get-identifiers ,resource)) - (car (gimp-resource-get-name ,resource)))) + ;(assert `(string=? (cadr (gimp-resource-get-identifiers ,resource)) + ; (gimp-resource-get-name ,resource))) + ; gimp-resource-is-editable succeeds ; Returns a wrapped boolean - ; !!! Not checking the result, only that it succeeds. - (assert `(gimp-resource-is-editable ,resource)) + ; !!! Checking the result. + ; Since the test should be run with context the fresh default, + ; all should be resources owned by GIMP and not editable. + (assert `(not (gimp-resource-is-editable ,resource))) ; The fresh gimp active resources are all system resources i.e. not editable ; returns 0 for #f - (assert-PDB-false `(gimp-resource-is-editable ,resource)) + (assert `(not (gimp-resource-is-editable ,resource))) ) ; "Test Parasite") ; name @@ -43,18 +54,26 @@ -; test context-get-resource returns active resource of given className +; Since 3.0rc2 context-get-resource is private +; It returns active resource of given className +; (define testGradient (gimp-context-get-resource "GimpGradient")) +; context-get-resource requires a valid type name +; (assert-error `(gimp-context-get-resource "InvalidTypeName") +; "Procedure execution of gimp-context-get-resource failed") + ; This is setup, not asserted. -(define testBrush (car (gimp-context-get-resource "GimpBrush"))) -(define testFont (car (gimp-context-get-resource "GimpFont"))) -(define testGradient (car (gimp-context-get-resource "GimpGradient"))) -(define testPalette (car (gimp-context-get-resource "GimpPalette"))) -(define testPattern (car (gimp-context-get-resource "GimpPattern"))) +(test! "gimp-context-get-") + +(define testBrush (gimp-context-get-brush)) +(define testFont (gimp-context-get-font)) +(define testGradient (gimp-context-get-gradient)) +(define testPalette (gimp-context-get-palette)) +(define testPattern (gimp-context-get-pattern)) ; FUTURE Dynamics and other Resource subclasses -; test methods on active resource ID's +(test! "methods on active resource ID's") (test-resource-methods testBrush) (test-resource-methods testFont) @@ -63,39 +82,17 @@ (test-resource-methods testPattern) -; test more specific context methods return same result -; as the general context-get-resource -; ID's are numeric -; test equality of numeric IDs -(assert `(= (car(gimp-context-get-brush)) - ,testBrush)) -(assert `(= (car(gimp-context-get-font)) - ,testFont)) -(assert `(= (car(gimp-context-get-gradient)) - ,testGradient)) -(assert `(= (car(gimp-context-get-palette)) - ,testPalette)) -(assert `(= (car(gimp-context-get-pattern)) - ,testPattern)) - - -; test resource-id-is-foo methods +(test! "resource-id-is-foo methods") ; the resource IDs from setup work with the specific id-is-foo methods - -(assert-PDB-true `(gimp-resource-id-is-brush ,testBrush)) -(assert-PDB-true `(gimp-resource-id-is-font ,testFont)) -(assert-PDB-true `(gimp-resource-id-is-gradient ,testGradient)) -(assert-PDB-true `(gimp-resource-id-is-palette ,testPalette)) -(assert-PDB-true `(gimp-resource-id-is-pattern ,testPattern)) +(assert `(gimp-resource-id-is-brush ,testBrush)) +(assert `(gimp-resource-id-is-font ,testFont)) +(assert `(gimp-resource-id-is-gradient ,testGradient)) +(assert `(gimp-resource-id-is-palette ,testPalette)) +(assert `(gimp-resource-id-is-pattern ,testPattern)) -; test errors - - -; context-get-resource requires a valid type name -(assert-error `(gimp-context-get-resource "InvalidTypeName") - "Procedure execution of gimp-context-get-resource failed") +(script-fu-use-v2) diff --git a/plug-ins/script-fu/test/tests/PDB/display/display.scm b/plug-ins/script-fu/test/tests/PDB/display/display.scm index 04d377349d3d931049f5a598c783129e7dac3796..e89c43158a450c17529e4a1189094a1f5f672462 100644 --- a/plug-ins/script-fu/test/tests/PDB/display/display.scm +++ b/plug-ins/script-fu/test/tests/PDB/display/display.scm @@ -11,15 +11,19 @@ ; Testing has visible results: displays appear as tabs in the GIMP app -; Testing throws GLib CRITICAL; must not export G_DEBUG=fatal_criticals +; Testing might throw GLib CRITICAL; must not export G_DEBUG=fatal_criticals + +(script-fu-use-v3) + ; setup ; an image -(define testImage (testing:load-test-image "gimp-logo.png")) +(define testImage (testing:load-test-image-basic-v3)) +; loaded "gimp-logo.png" ; a second image -(define testImage2 (car (gimp-image-new 21 22 RGB))) +(define testImage2 (gimp-image-new 21 22 RGB)) ; new @@ -28,11 +32,10 @@ (assert `(gimp-display-new ,testImage)) ; store the ID of another new display on same image -; FUTURE: not wrapped in a list -(define testDisplay (car (gimp-display-new testImage))) +(define testDisplay (gimp-display-new testImage)) ; new display has a valid ID -(assert-PDB-true `(gimp-display-id-is-valid ,testDisplay)) +(assert `(gimp-display-id-is-valid ,testDisplay)) ; can get many displays of same image (assert `(gimp-display-new ,testImage)) @@ -40,7 +43,7 @@ ; id-is-valid returns false for an invalid ID -(assert-PDB-false `(gimp-display-id-is-valid 666)) +(assert `(not (gimp-display-id-is-valid 666))) ; misc @@ -49,7 +52,7 @@ ; FIXME the docs for the API says the type varies by platform, but it is always GBytes? ; What varies is the interpretations of the GBytes: ; as sequence of characters, or as sequence of bytes of a multi-bit number -(assert `(vector? (car (gimp-display-get-window-handle ,testDisplay)))) +(assert `(vector? (gimp-display-get-window-handle ,testDisplay))) ; get-window-handle is safe from invalid ID (assert-error `(gimp-display-get-window-handle 666) "Invalid value for argument 0") @@ -86,7 +89,7 @@ ; Make displays of gimp-logo now show the testImage2 that is not now displayed (assert `(gimp-displays-reconnect ,testImage ,testImage2 )) ; display ID is still valid -(assert-PDB-true `(gimp-display-id-is-valid ,testDisplay)) +(assert `(gimp-display-id-is-valid ,testDisplay)) ; effective. TODO no API to know what image is in a display. ; reconnect is safe from invalid image ID @@ -100,10 +103,12 @@ ; succeeds (assert `(gimp-display-delete ,testDisplay)) ; effective: display ID is no longer valid -(assert-PDB-false `(gimp-display-id-is-valid ,testDisplay)) +(assert `(not (gimp-display-id-is-valid ,testDisplay))) ; safe from invalid ID (assert-error `(gimp-display-delete ,testDisplay) "Invalid value for argument 0") ; Testing leaves two displays visible in GIMP app + +(script-fu-use-v2) diff --git a/plug-ins/script-fu/test/tests/PDB/drawable/drawable-attributes.scm b/plug-ins/script-fu/test/tests/PDB/drawable/drawable-attributes.scm index 5f86edebda54bd4f3894eaa06ea50b57cc84bd2a..e876f9e9243c16eec54f848534c31bf33a5bc254 100644 --- a/plug-ins/script-fu/test/tests/PDB/drawable/drawable-attributes.scm +++ b/plug-ins/script-fu/test/tests/PDB/drawable/drawable-attributes.scm @@ -1,52 +1,56 @@ ; test get/set attributes of drawable +; The test script uses v3 binding of return values +(script-fu-use-v3) + ; setup -(define testImage (testing:load-test-image "gimp-logo.png")) -; Wilber has one layer -; car is vector, first element is a drawable -(define testDrawable (vector-ref (car (gimp-image-get-layers testImage)) 0)) +(define testImage (testing:load-test-image-basic-v3)) +; Loaded "gimp-logo.png" i.e. Wilber having one layer +(define testDrawable (vector-ref (gimp-image-get-layers testImage) 0)) ; a drawable is represented by an ID ; As an item, it is type Drawable -(assert-PDB-true `(gimp-item-id-is-drawable ,testDrawable)) +(assert `(gimp-item-id-is-drawable ,testDrawable)) -; getters +(test! "getters of Drawable") ; only testing getters that are not of the superclass Item -; Returned single values are wrapped in a list. - ; bytes per pixel -(assert `(number? (car (gimp-drawable-get-bpp ,testDrawable)))) +(assert `(number? (gimp-drawable-get-bpp ,testDrawable))) ; height and width are single numbers -(assert `(number? (car (gimp-drawable-get-height ,testDrawable)))) -(assert `(number? (car (gimp-drawable-get-width ,testDrawable)))) +(assert `(number? (gimp-drawable-get-height ,testDrawable))) +(assert `(number? (gimp-drawable-get-width ,testDrawable))) ; offset is list of two numbers (assert `(list? (gimp-drawable-get-offsets ,testDrawable))) + +; since 3.0rc2 drawable-get-format is private to libgimp ; formats are strings encoded for babl -(assert `(string? (car (gimp-drawable-get-format ,testDrawable)))) -(assert `(string? (car (gimp-drawable-get-thumbnail-format ,testDrawable)))) +; (assert `(string? (gimp-drawable-get-format ,testDrawable))) + +; Since 3.0rc2, this is private to libgimp +;(assert `(string? (gimp-drawable-get-thumbnail-format ,testDrawable))) ; the test drawable has transparency ; FUTURE: inconsistent naming, should be gimp-drawable-get-alpha? -(assert-PDB-true `(gimp-drawable-has-alpha ,testDrawable)) +(assert `(gimp-drawable-has-alpha ,testDrawable)) ; the test drawable has image base type RGB -(assert-PDB-true `(gimp-drawable-is-rgb ,testDrawable)) -(assert-PDB-false `(gimp-drawable-is-gray ,testDrawable)) -(assert-PDB-false `(gimp-drawable-is-indexed ,testDrawable)) +(assert `(gimp-drawable-is-rgb ,testDrawable)) +(assert `(not (gimp-drawable-is-gray ,testDrawable))) +(assert `(not (gimp-drawable-is-indexed ,testDrawable))) ; the test drawable has type RGBA -(assert `(= (car (gimp-drawable-type ,testDrawable)) +(assert `(= (gimp-drawable-type ,testDrawable) RGBA-IMAGE)) @@ -64,3 +68,5 @@ ; TODO setters + +(script-fu-use-v2) diff --git a/plug-ins/script-fu/test/tests/PDB/drawable/drawable.scm b/plug-ins/script-fu/test/tests/PDB/drawable/drawable.scm index adcb88d61e141e80553a7cf9cc89e0edc8aabefa..d023ff317768e7549b4d1501f5027df6c0b7c391 100644 --- a/plug-ins/script-fu/test/tests/PDB/drawable/drawable.scm +++ b/plug-ins/script-fu/test/tests/PDB/drawable/drawable.scm @@ -48,18 +48,18 @@ ; thumbnails +; Since 3.0 rc2 these are private to libgimp +;(assert `(gimp-drawable-thumbnail +; ,testDrawable +; 1 1 ; thumbnail width height +; )) -(assert `(gimp-drawable-thumbnail - ,testDrawable - 1 1 ; thumbnail width height - )) - -(assert `(gimp-drawable-sub-thumbnail - ,testDrawable - 1 1 ; origin - 2 2 ; width, height - 2 2 ; thumbnail width height - )) +;(assert `(gimp-drawable-sub-thumbnail +; ,testDrawable +; 1 1 ; origin +; 2 2 ; width, height +; 2 2 ; thumbnail width height +; )) ;gimp-drawable-extract-component is tested drawable-ops diff --git a/plug-ins/script-fu/test/tests/PDB/edit/edit-crash.scm b/plug-ins/script-fu/test/tests/PDB/edit/edit-crash.scm new file mode 100644 index 0000000000000000000000000000000000000000..8e4f0687887277049cfcdd93ac0b906fa8351c00 --- /dev/null +++ b/plug-ins/script-fu/test/tests/PDB/edit/edit-crash.scm @@ -0,0 +1,201 @@ +; Test methods of Edit module of the PDB + +; This tests some of the general cases. +; See elsewhere for other cases e.g. edit-multi-layer.scm + +; TODO the "Paste In Place" methods are not in the PDB? + +; TODO the "Paste As" distinctions between Layer and Floating Sel +; are not in the PDB + + +(script-fu-use-v3) + + +; setup +; Load test image that already has drawable +(define testImage (testing:load-test-image-basic-v3)) + +; get all the root layers +; testImage has exactly one root layer. +(define testLayers (gimp-image-get-layers testImage)) +;testLayers is-a vector + +(define testLayer (vector-ref testLayers 0)) + +; !!! Testing requires initial condition: clipboard is empty. +; But there is no programmatic way to empty the clipboard, +; or even to determine if the clipboard is empty. +; So these tests might not pass when you run this test file +; in the wrong order. + + + + +(test! "named-copy") + +(define testBuffer (gimp-edit-named-copy + (make-vector 1 testLayer) + "testBufferName")) +; There is one named buffer +(assert `(= (length (gimp-buffers-get-name-list "")) 1)) + + + +(test! "paste") + +; ordinary paste is to a drawable + +; paste always returns a layer, even when clipboard empty +; FIXME: this is undocumented in the PDB, +; where it seems to imply that a layer is always returned. +(assert-error `(gimp-edit-paste + ,testLayer + TRUE) ; paste-into + "Procedure execution of gimp-edit-paste failed" ) + +; paste-as-new-image returns NULL image when clipboard empty +; paste-as-new is deprecated +(assert `(= (gimp-edit-paste-as-new-image) + -1)) ; the NULL ID +; named-paste-as-new-image returns a new image +(assert `(gimp-image-id-is-valid (gimp-edit-named-paste-as-new-image "testBufferName"))) + +(test! "copy") + +; copy when: +; - no selection +; - image has one drawable +; - one drawable is passed +; returns true and clip has one drawable +(assert `(gimp-edit-copy ,testLayers)) + +; paste when clipboard is not empty returns a vector of length one +(assert `(= (vector-length (gimp-edit-paste + ,testLayer + TRUE)) ; paste-into + 1)) +; get reference to pasted layer +(define testPastedLayer (vector-ref (gimp-image-get-layers testImage) + 0)) + +; !!! this is not what happens in the GUI, the pasted layer is NOT floating +; The pasted layer is floating +(assert `(gimp-layer-is-floating-sel ,testPastedLayer)) + + + +(test! "copy-visible") + +; copy-visible takes only an image +; it puts one drawable on clip +(assert `(gimp-edit-copy-visible ,testImage)) + + + + +(test! "named-paste") + +; There is one named buffer +(assert `(= (length (gimp-buffers-get-name-list "")) 1)) + +; named-paste returns just the floating sel +(assert `(gimp-edit-named-paste + ,testLayer + "testBufferName" + #f)) ; paste-into + + +(test! "paste into") +; paste when clipboard is not empty returns a vector of length one +; returns (#(x)) +(assert `(= (vector-length (gimp-edit-paste ,testLayer TRUE)) ; paste-into + 1)) + +; The first pasted floating layer was anchored (merged into) first layer +; The ID of the floating sel is now invalid +(assert `(not (gimp-item-id-is-valid ,testPastedLayer))) +; Can't do this, it throws CRITICAL +;(assert-error `(gimp-layer-is-floating-sel ,testPastedLayer) +; "Procedure") + +; There are now two layers +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) + +(define testPastedLayer2 (vector-ref (gimp-image-get-layers testImage) + 0)) +; the new layer is now floating. +(assert `(gimp-layer-is-floating-sel ,testPastedLayer2)) + + + + + +; paste specifying no destination layer is an error. +; You cannot paste into an empty image because you must pass a destination layer. +; !!! This is different from the GUI +(assert-error `(gimp-edit-paste -1 TRUE) + "Invalid value for argument 0") + + + + + + +(test! "edit-cut when selection") + +; setup, create a selection +(assert `(gimp-selection-all ,testImage)) +(assert `(not (gimp-selection-is-empty ,testImage))) + +(assert `(gimp-edit-cut (make-vector 1 (vector-ref ,testLayers 0)))) +; There are still two layers +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) +; !!! No API method is-clipboard-empty + + +(test! "edit-named-cut when selection") +(assert `(gimp-edit-named-cut (make-vector 1 (vector-ref ,testLayers 0)) "testBufferName2")) +; There are still two layers +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) +; There is two named buffer +(assert `(= (length (gimp-buffers-get-name-list "")) + 2)) + + +(test! "cut when no selection") + +; setup, delete selection +(assert `(gimp-selection-none ,testImage)) +(assert `(gimp-selection-is-empty ,testImage)) + +; cut when no selection cuts given layers out of image +; Cut one of two layers. +; returns #t when succeeds +(assert `(gimp-edit-cut (make-vector 1 (vector-ref ,testLayers 0)))) +; effective: count layers now 0 +; FIXME, the count of layers should be 1, since we cut only one of 2 +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 0)) + + + +; TODO test cross image paste, of different modes + + +; copy returns false when is a selection +; but it doesn't intersect any chosen layers +; When one layer is offset from another and bounds of layer +; do not intersect bounds of selection. +; TODO + +; cleanup +; delete buffers, other tests may expect no buffers +(gimp-buffer-delete "testBufferName") +(gimp-buffer-delete "testBufferName2") + +; for debugging individual test file +(testing:show testImage) + + +(script-fu-use-v2) diff --git a/plug-ins/script-fu/test/tests/PDB/edit/edit-cut.scm b/plug-ins/script-fu/test/tests/PDB/edit/edit-cut.scm new file mode 100644 index 0000000000000000000000000000000000000000..e5cb03a8742eb2a3d9f4544c5f521e97641aa64a --- /dev/null +++ b/plug-ins/script-fu/test/tests/PDB/edit/edit-cut.scm @@ -0,0 +1,155 @@ +; Test cut methods of Edit module of the PDB + +; See elsewhere for other cases e.g. copy, paste + + +(script-fu-use-v3) + + +; setup + +; Load test image that already has drawable +(define testImage (testing:load-test-image-basic-v3)) + +; get all the root layers +; testImage has exactly one root layer. +(define testLayers (gimp-image-get-layers testImage)) +;testLayers is-a vector +(define testLayer (vector-ref testLayers 0)) + +; returns a new floating sel layer +;(define makeFloatingSel ) +; paste when clipboard is not empty returns a vector of length one +;(assert `(= (vector-length (gimp-edit-paste ,testLayer TRUE)) ; paste-into +; 1)) + +; function to create a multi-layer image +; Defines globally: testImage, testLayer, testLayer2 +(define (make-multi-layer-image) + (define testImage (testing:load-test-image-basic-v3)) + ; get root layers + (define testLayers (gimp-image-get-layers testImage)) + ;testLayers is-a vector + (define testLayer (vector-ref testLayers 0)) + (assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 1)) + (define testLayer2 (testing:layer-new-inserted testImage)) + (assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 2))) + + + + +(test! "edit-cut when selection") + +; setup, create a selection +(assert `(gimp-selection-all ,testImage)) +(assert `(not (gimp-selection-is-empty ,testImage))) + +; edit-cut requires a vector of drawables to cut from. +; Pass it only the first layer. +(assert `(gimp-edit-cut (vector ,testLayer))) +; There are still one layers in the image +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 1)) +; !!! No API method is-clipboard-empty + + +(test! "edit-named-cut when selection does not remove the layer") + +; setup: count current named buffers +; earlier tests left a buffer? +(define bufferCount (length (gimp-buffers-get-name-list ""))) ; empty regex string + +(assert `(gimp-edit-named-cut (vector ,testLayer) "testBufferName2")) +; There are still one layers +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 1)) + +(test! "edit-named-cut when selection creates buffer") +; There is another named buffer +(assert `(= (length (gimp-buffers-get-name-list "")) + (+ ,bufferCount 1))) + + +(test! "cut from single layer image when no selection removes the layer") + +; setup, delete selection +(assert `(gimp-selection-none ,testImage)) +(assert `(gimp-selection-is-empty ,testImage)) + +; cut when no selection cuts given layers out of image +; Cut the only layer out. +; returns #t when succeeds +(assert `(gimp-edit-cut (vector ,testLayer))) +; effective: count layers now 0 +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 0)) + + + +(test! "cut a floating selection") + +; Restore a layer to the image +(define testLayer2 (testing:layer-new-inserted testImage)) +; assert layer is inserted in image + +(define testFloatingSelInVector + ; edit-paste returns a vector containing a floating-sel + (gimp-edit-paste + testLayer2 + TRUE)); paste-into + +; edit-cut takes that vector +(assert `(gimp-edit-cut ,testFloatingSelInVector)) + +; edit-cut effective: ID no longer valid +(assert `(not (gimp-item-id-is-valid + (vector-ref ,testFloatingSelInVector 0)))) + + +(test! "sequential cuts from a multi layer image") + +; setup restore the testImage +(define testImage (testing:load-test-image-basic-v3)) +; get root layers +(define testLayers (gimp-image-get-layers testImage)) +;testLayers is-a vector +(define testLayer (vector-ref testLayers 0)) +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 1)) +(define testLayer2 (testing:layer-new-inserted testImage)) +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 2)) + +(gimp-selection-none testImage) +(assert `(gimp-selection-is-empty ,testImage)) + +; cut the original layer, one of two layers. + +; cut when no selection cuts given layers out of image +; returns #t when succeeds +(assert `(gimp-edit-cut (vector ,testLayer))) +; effective: count layers now 1 +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 1)) + +; cut the second layer +(assert `(gimp-edit-cut (vector ,testLayer2))) +; effective: count layers now 0 +(assert `(= (vector-length (gimp-image-get-layers ,testImage)) + 0)) + + +(test! "multiple cuts at once from a multi layer image") + +(make-multi-layer-image) +; edit-cut takes a vector of many layers +; FIXME: this should not throw an error? both layers ARE inserted? +(assert-error `(gimp-edit-cut (vector ,testLayer ,testLayer2)) + "Procedure execution of gimp-edit-cut failed on invalid input arguments:") +; Item 'Background' (12) cannot be used because it has not been added to an image + + +;(gimp-display-new testImage) + + +(script-fu-use-v2) \ No newline at end of file diff --git a/plug-ins/script-fu/test/tests/PDB/edit/edit-multi-layer.scm b/plug-ins/script-fu/test/tests/PDB/edit/edit-multi-layer.scm index 3880aa84ed359c287f0c1c61637513a352e0f51f..69469bbb4d418458416fb57f875dedb336655ab3 100644 --- a/plug-ins/script-fu/test/tests/PDB/edit/edit-multi-layer.scm +++ b/plug-ins/script-fu/test/tests/PDB/edit/edit-multi-layer.scm @@ -18,20 +18,9 @@ (assert `(= (gimp-image-get-width ,testImage) 128)) -; Add a layer -(define testLayer2 (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL)) -; Insert new layer -(assert `(gimp-image-insert-layer - ,testImage - ,testLayer2 - 0 0)) ; parent, position within parent +; Add a layer already inserted in image +(define testLayer2 (testing:layer-new-inserted testImage)) + ; get all the root layers ; testImage has two layers at root. diff --git a/plug-ins/script-fu/test/tests/PDB/edit/edit.scm b/plug-ins/script-fu/test/tests/PDB/edit/edit.scm index 8e4f0687887277049cfcdd93ac0b906fa8351c00..fe873036420790f8d1d63c0e436973e4747a5f07 100644 --- a/plug-ins/script-fu/test/tests/PDB/edit/edit.scm +++ b/plug-ins/script-fu/test/tests/PDB/edit/edit.scm @@ -108,16 +108,16 @@ (test! "paste into") ; paste when clipboard is not empty returns a vector of length one -; returns (#(x)) (assert `(= (vector-length (gimp-edit-paste ,testLayer TRUE)) ; paste-into 1)) ; The first pasted floating layer was anchored (merged into) first layer -; The ID of the floating sel is now invalid +; The ID of the first floating sel is now invalid ! (assert `(not (gimp-item-id-is-valid ,testPastedLayer))) -; Can't do this, it throws CRITICAL -;(assert-error `(gimp-layer-is-floating-sel ,testPastedLayer) -; "Procedure") +; The first floating sel MUST NOT BE USED AGAIN ! +(assert-error `(gimp-layer-is-floating-sel ,testPastedLayer) + "Invalid value for argument 0") + ; There are now two layers (assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) @@ -130,9 +130,11 @@ +(test! "paste into empty image") ; paste specifying no destination layer is an error. -; You cannot paste into an empty image because you must pass a destination layer. +; You cannot paste into an empty image having no layers +; because you must pass a destination layer. ; !!! This is different from the GUI (assert-error `(gimp-edit-paste -1 TRUE) "Invalid value for argument 0") @@ -140,46 +142,6 @@ - - -(test! "edit-cut when selection") - -; setup, create a selection -(assert `(gimp-selection-all ,testImage)) -(assert `(not (gimp-selection-is-empty ,testImage))) - -(assert `(gimp-edit-cut (make-vector 1 (vector-ref ,testLayers 0)))) -; There are still two layers -(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) -; !!! No API method is-clipboard-empty - - -(test! "edit-named-cut when selection") -(assert `(gimp-edit-named-cut (make-vector 1 (vector-ref ,testLayers 0)) "testBufferName2")) -; There are still two layers -(assert `(= (vector-length (gimp-image-get-layers ,testImage)) 2)) -; There is two named buffer -(assert `(= (length (gimp-buffers-get-name-list "")) - 2)) - - -(test! "cut when no selection") - -; setup, delete selection -(assert `(gimp-selection-none ,testImage)) -(assert `(gimp-selection-is-empty ,testImage)) - -; cut when no selection cuts given layers out of image -; Cut one of two layers. -; returns #t when succeeds -(assert `(gimp-edit-cut (make-vector 1 (vector-ref ,testLayers 0)))) -; effective: count layers now 0 -; FIXME, the count of layers should be 1, since we cut only one of 2 -(assert `(= (vector-length (gimp-image-get-layers ,testImage)) - 0)) - - - ; TODO test cross image paste, of different modes @@ -192,7 +154,6 @@ ; cleanup ; delete buffers, other tests may expect no buffers (gimp-buffer-delete "testBufferName") -(gimp-buffer-delete "testBufferName2") ; for debugging individual test file (testing:show testImage) diff --git a/plug-ins/script-fu/test/tests/PDB/filter/filter-ops.scm b/plug-ins/script-fu/test/tests/PDB/filter/filter-ops.scm index 28c3560315c4ab35e7e6e3d901c2ac184dec91b1..b2190ca35eccd8aa3065415a3c296c46462d9b55 100644 --- a/plug-ins/script-fu/test/tests/PDB/filter/filter-ops.scm +++ b/plug-ins/script-fu/test/tests/PDB/filter/filter-ops.scm @@ -196,9 +196,8 @@ (test! "optional display result images") - -(gimp-display-new testImage) -(gimp-displays-flush) +;(gimp-display-new testImage) +;(gimp-displays-flush) ; The result should be one image, with ripple applied destructively, ; and with the background layer having two NDE effects: spherize and engrave NDE. diff --git a/plug-ins/script-fu/test/tests/PDB/filter/filter.scm b/plug-ins/script-fu/test/tests/PDB/filter/filter.scm index ca7e6eec559d10ac7b12cede921c4368369658b8..78060d550ea3ec1a9d7687ed43e62d7523285d1e 100644 --- a/plug-ins/script-fu/test/tests/PDB/filter/filter.scm +++ b/plug-ins/script-fu/test/tests/PDB/filter/filter.scm @@ -59,11 +59,13 @@ ; That is, a method on named subclass of Filter, not on an instance. ; The name is qualified by "gegl:" -(test! "get number arguments") +; since 3.0rc2 filter-get-number-arguments private to libgimp +;(test! "get number arguments") ; This is a class method on the "subclass" of Filter, not on an instance. -(assert `(= (gimp-drawable-filter-get-number-arguments "gegl:ripple") - 8)) +;(assert `(= (gimp-drawable-filter-get-number-arguments "gegl:ripple") +; 8)) +; since 3.0rc2 filter-get-pspec private to libgimp ; get the pspec for the first argument ; FIXME: fails SF unhandled return type GParam ; (gimp-drawable-filter-get-pspec "gegl:ripple" 1) @@ -91,7 +93,7 @@ ; optional display result images -(gimp-display-new testImage) -(gimp-displays-flush) +;(gimp-display-new testImage) +;(gimp-displays-flush) (script-fu-use-v2) \ No newline at end of file diff --git a/plug-ins/script-fu/test/tests/PDB/gimp/gimp.scm b/plug-ins/script-fu/test/tests/PDB/gimp/gimp.scm index 2eec019845ff252af4d1dd37844fc423bbfc1fe3..34948dc6ee9b70627c83d95022bc219f8e1b9d57 100644 --- a/plug-ins/script-fu/test/tests/PDB/gimp/gimp.scm +++ b/plug-ins/script-fu/test/tests/PDB/gimp/gimp.scm @@ -3,9 +3,9 @@ ; Generally speaking, prefix is "gimp-get" - +; since 3.0rc2 get-color-configuration is private to libgimp ; The serialized color configuration is a string -(assert '(string? (car (gimp-get-color-configuration)))) +; (assert '(string? (car (gimp-get-color-configuration)))) ; The default comment on images is a string (assert '(string? (car (gimp-get-default-comment)))) diff --git a/plug-ins/script-fu/test/tests/PDB/image/image-color-profile.scm b/plug-ins/script-fu/test/tests/PDB/image/image-color-profile.scm index 512d7863f9bcef8fcf582c31a0e801aeb8f531dd..78defa3dfef0f5f7d2e94c7b2e4fe61c050c86e9 100644 --- a/plug-ins/script-fu/test/tests/PDB/image/image-color-profile.scm +++ b/plug-ins/script-fu/test/tests/PDB/image/image-color-profile.scm @@ -24,6 +24,8 @@ ; Coated_Fogra39L_VIGC_300.icc 8.7Mb, CMYK? +; Since 3.0rc3, all getters of color profile are PRIVATE to libgimp !!! + ; setup @@ -33,7 +35,8 @@ (define colorImage (car (gimp-image-new 21 22 RGB))) ; setup a testProfile -(define testProfile (car (gimp-image-get-color-profile colorImage))) +; Now PRIVATE +;(define testProfile (car (gimp-image-get-color-profile colorImage))) ; testProfile is a Scheme vector, a C GBytes ; testProfile is the default effective one, named sRGBGimp @@ -43,16 +46,18 @@ ; Initial profiles on an image +; Now PRIVATE + ; the test image has no assigned color profile -(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) - 0)) +;(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) +; 0)) ; the test image has no assigned simulation color profile -(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) - 0)) +;(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) +; 0)) ; the test image has an effective profile of a generated profile (named sRGBGimp) ; Is different length than one named sRGB2014 promulgated by ICC organization? -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 672)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 672)) ; Setting profile @@ -76,14 +81,15 @@ TRUE )) ; black point compensation ; effective: profile is now a longer vector -(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) - 3024)) - +; Now PRIVATE +;(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) +; 3024)) +; convert-color-profile is now PRIVATE to libgimp ; convert from raw profile that is empty vector fails -(assert-error `(gimp-image-convert-color-profile ,testImage ,testProfile) - "Procedure execution of gimp-image-convert-color-profile failed: Data does not appear to be an ICC color profile ") +;(assert-error `(gimp-image-convert-color-profile ,testImage ,emptyTestProfile) +; "Procedure execution of gimp-image-convert-color-profile failed: Data does not appear to be an ICC color profile ") ; simulation profile @@ -95,16 +101,16 @@ ,testImage (testing:path-to-color-profile "sRGB2014.icc"))) ; effective -(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) - 3024)) +;(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) +; 3024)) ; You can set the simulation profile from any profile (even not compatible i.e. CMYK.) (assert `(gimp-image-set-simulation-profile-from-file ,testImage (testing:path-to-color-profile "CGATS001Compat-v2-micro.icc"))) ; effective -(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) - 8464)) +;(assert `(= (vector-length (car (gimp-image-get-simulation-profile ,testImage))) +; 8464)) ; You can set the simulation profile from a large CMYK file ; This is a stress test: a large profile @@ -131,11 +137,11 @@ (assert `(= (car (gimp-image-get-base-type ,testImage)) GRAY)) ; Not effective on setting the color profile, it was cleared. -(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) - 0)) +;(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) +; 0)) ; effective at changing the effective color profile -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 544)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 544)) ; mode GRAY image with no color profile set can be set to a GRAY profile @@ -146,11 +152,11 @@ COLOR-RENDERING-INTENT-PERCEPTUAL TRUE )) ; Effective on setting the color profile -(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) - 290)) +;(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) +; 290)) ; effective at changing the effective color profile -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 290)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 290)) ; setting profile GRAY=>RGB fails @@ -163,8 +169,8 @@ "Procedure execution of gimp-image-set-color-profile-from-file failed: " "ICC profile validation failed: Color profile is not for grayscale color space")) ; color profile is same as before -(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) - 290)) +;(assert `(= (vector-length (car (gimp-image-get-color-profile ,testImage))) +; 290)) ; for debugging individual test file: diff --git a/plug-ins/script-fu/test/tests/PDB/image/image-mode.scm b/plug-ins/script-fu/test/tests/PDB/image/image-mode.scm index d569d230a288921c33b27f085f0e333172625c3c..531990c15b3967b46a0307b62022cb8851fbc211 100644 --- a/plug-ins/script-fu/test/tests/PDB/image/image-mode.scm +++ b/plug-ins/script-fu/test/tests/PDB/image/image-mode.scm @@ -1,6 +1,10 @@ ; test combinations of mode conversion ; COLOR=>GRAY=>INDEXED=>GRAY + +; Since 3.0rc3, getters of color profile are private to libgimp + + ; setup (define testImage (testing:load-test-image "gimp-logo.png")) @@ -15,8 +19,8 @@ (assert `(= (car (gimp-image-get-base-type ,testImage)) GRAY)) ; effective color profile is the built-in one for GRAY -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 544)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 544)) ; convert GRAY=>INDEXED (assert `(gimp-image-convert-indexed @@ -32,8 +36,8 @@ (assert `(= (car (gimp-image-get-base-type ,testImage)) INDEXED)) ; effective color profile is the built-in one for COLOR -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 672)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 672)) ; convert INDEXED=>GRAY (assert `(gimp-image-convert-grayscale ,testImage)) @@ -41,8 +45,8 @@ (assert `(= (car (gimp-image-get-base-type ,testImage)) GRAY)) ; effective color profile is the built-in one for GRAY -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 544)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 544)) ; convert GRAY=>COLOR (assert `(gimp-image-convert-rgb ,testImage)) @@ -50,8 +54,8 @@ (assert `(= (car (gimp-image-get-base-type ,testImage)) RGB)) ; effective color profile is the built-in one for RGB -(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) - 672)) +;(assert `(= (vector-length (car (gimp-image-get-effective-color-profile ,testImage))) +; 672)) diff --git a/plug-ins/script-fu/test/tests/PDB/image/image-new.scm b/plug-ins/script-fu/test/tests/PDB/image/image-new.scm index 1035de16d025a6e1835789a3c4ee0cabb5234a1b..13ee230f59c0b9a705cb70f7fa010cabd35c8cbb 100644 --- a/plug-ins/script-fu/test/tests/PDB/image/image-new.scm +++ b/plug-ins/script-fu/test/tests/PDB/image/image-new.scm @@ -90,8 +90,6 @@ (gimp-image-get-floating-sel ,testImage) -1)) -; TODO floating-sel-attached-to - ; new image has unit having ID 1 @@ -104,14 +102,16 @@ (gimp-image-get-name ,testImage) "[Untitled]")) +; since 3.0rc image-get-metadata private to libgimp ; new image has empty metadata string -(assert `(string=? - (gimp-image-get-metadata ,testImage) - "")) +;(assert `(string=? +; (gimp-image-get-metadata ,testImage) +; "")) -(test! "new image has an effective color profile") -(assert `(gimp-image-get-effective-color-profile ,testImage)) +; since 3.0rc image-get-metadata private to libgimp +;(test! "new image has an effective color profile") +;(assert `(gimp-image-get-effective-color-profile ,testImage)) diff --git a/plug-ins/script-fu/test/tests/PDB/item/item-layer-group-2.scm b/plug-ins/script-fu/test/tests/PDB/item/item-layer-group-2.scm index 9a34a1ea44457f013f89dcaba8f8575580f8f264..7985a4974818e7ba369cade8876d1fce68e782f2 100644 --- a/plug-ins/script-fu/test/tests/PDB/item/item-layer-group-2.scm +++ b/plug-ins/script-fu/test/tests/PDB/item/item-layer-group-2.scm @@ -14,14 +14,7 @@ ; gimp-logo.png has only one layer ; another layer for reorder tests -(define testLayer2 (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL)) +(define testLayer2 (testing:layer-new testImage)) ; group-new not throw diff --git a/plug-ins/script-fu/test/tests/PDB/item/item-layer-group.scm b/plug-ins/script-fu/test/tests/PDB/item/item-layer-group.scm index 650e10a61939982d1079bab80be1b5141ec462df..011b6be3130273707a393e72117d95a37da6d0ee 100644 --- a/plug-ins/script-fu/test/tests/PDB/item/item-layer-group.scm +++ b/plug-ins/script-fu/test/tests/PDB/item/item-layer-group.scm @@ -13,14 +13,7 @@ ; gimp-logo.png has only one layer ; another layer for reorder tests -(define testLayer2 (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL)) +(define testLayer2 (testing:layer-new testImage)) ; group-new not throw diff --git a/plug-ins/script-fu/test/tests/PDB/layer/layer-mask.scm b/plug-ins/script-fu/test/tests/PDB/layer/layer-mask.scm index 872fcc175fb5b4e6c37b3457e9beaef3eb53da03..00029087afb8ab516d574f4b6c704b810e6a4295 100644 --- a/plug-ins/script-fu/test/tests/PDB/layer/layer-mask.scm +++ b/plug-ins/script-fu/test/tests/PDB/layer/layer-mask.scm @@ -9,18 +9,9 @@ (script-fu-use-v3) -; setup -; +; setup (define testImage (gimp-image-new 21 22 RGB)) - -(define testLayer (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL)) +(define testLayer (testing:layer-new testImage)) ; assert layer is not inserted in image diff --git a/plug-ins/script-fu/test/tests/PDB/layer/layer-new.scm b/plug-ins/script-fu/test/tests/PDB/layer/layer-new.scm index 1a921aa00c91ddc252cf6661f2a1bbf635073879..20d238cd44429596011c57cc5729e574effaf7fc 100644 --- a/plug-ins/script-fu/test/tests/PDB/layer/layer-new.scm +++ b/plug-ins/script-fu/test/tests/PDB/layer/layer-new.scm @@ -8,14 +8,7 @@ (define testImage (gimp-image-new 21 22 RGB)) -(define testLayer (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL)) +(define testLayer (testing:layer-new testImage)) diff --git a/plug-ins/script-fu/test/tests/PDB/layer/layer-ops.scm b/plug-ins/script-fu/test/tests/PDB/layer/layer-ops.scm index b961e758dd2bdaf96007a03bcf0bcccef282a082..ed3090f940ba41f24b3b40cc760e7be7dbc4bfb2 100644 --- a/plug-ins/script-fu/test/tests/PDB/layer/layer-ops.scm +++ b/plug-ins/script-fu/test/tests/PDB/layer/layer-ops.scm @@ -6,18 +6,10 @@ -; setup +; setup (define testImage (gimp-image-new 21 22 RGB)) - -(define testLayer (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew#2" - 50.0 - LAYER-MODE-NORMAL)) +(define testLayer (testing:layer-new testImage)) ; assert layer is not inserted in image diff --git a/plug-ins/script-fu/test/tests/PDB/paint/paint.scm b/plug-ins/script-fu/test/tests/PDB/paint/paint.scm index df0d0d83f7cbf4948a61806d58d10f33f5f92920..8593b53b1ad01996e15a1b723137ed71af97bb00 100644 --- a/plug-ins/script-fu/test/tests/PDB/paint/paint.scm +++ b/plug-ins/script-fu/test/tests/PDB/paint/paint.scm @@ -14,6 +14,9 @@ ; only that the operations says it succeeded. +(script-fu-use-v3) + + ; Define an aux testing function ; that tests the "-default" kind of paint operation. ; Takes an operation (first-class function) @@ -23,23 +26,14 @@ ; the PDB procedure paint-op succeeds (assert `(,paint-op ,testLayer ; target - #(4.0 4.0)))) ; float array)) + #(4.0 4.0)))) ; float array -; setup -(define testImage (car (gimp-image-new 21 22 RGB))) - -(define - testLayer (car (gimp-layer-new - testImage - 21 - 22 - RGB-IMAGE - "LayerNew" - 50.0 - LAYER-MODE-NORMAL))) +; setup +(define testImage (gimp-image-new 21 22 RGB)) +(define testLayer (testing:layer-new testImage)) ; assert layer is not inserted in image @@ -188,3 +182,5 @@ 50.0 ; pressure `(4.0 49.0)) ; strokes "in script, expected type: vector for argument 3 to gimp-airbrush") + +(script-fu-use-v2) \ No newline at end of file diff --git a/plug-ins/script-fu/test/tests/PDB/pdb.scm b/plug-ins/script-fu/test/tests/PDB/pdb.scm index fb86c413234f3da95e6ae7ff1127e918f33a52fc..f7343b512a5570fd8f0693bafc73f744b182755e 100644 --- a/plug-ins/script-fu/test/tests/PDB/pdb.scm +++ b/plug-ins/script-fu/test/tests/PDB/pdb.scm @@ -8,7 +8,6 @@ ; The test files might be organized in directories in the repo, ; but all flattened into the /tests directory when installed. -; images (testing:load-test "image-new.scm") (testing:load-test "image-precision.scm") (testing:load-test "image-indexed.scm") @@ -26,10 +25,11 @@ (testing:load-test "layer-new.scm") (testing:load-test "layer-ops.scm") (testing:load-test "layer-mask.scm") -; TODO layer stack ops +; TODO layer stack ops, moving up and down? -; broken until GimpUnit is bound -;(testing:load-test "text-layer-new.scm") +; TODO broken until ScriptFu marshalls GimpUnit +; and it crosses the wire? +; (testing:load-test "text-layer-new.scm") (testing:load-test "vectors-new.scm") (testing:load-test "vectors-stroke.scm") @@ -38,6 +38,7 @@ (testing:load-test "selection-from.scm") (testing:load-test "selection-by.scm") (testing:load-test "selection-by-shape.scm") +; TODO test floating-sel- methods (testing:load-test "channel-new.scm") (testing:load-test "channel-attributes.scm") @@ -77,22 +78,29 @@ (testing:load-test "edit.scm") (testing:load-test "edit-multi-layer.scm") (testing:load-test "buffer.scm") +(testing:load-test "edit-cut.scm") + ; gimp module, gimp-get methods -(testing:load-test "gimp.scm") + +; Since 3.0rc2 private to libgimp ; gimp PDB as a queryable store i.e. database -(testing:load-test "PDB.scm") +; (testing:load-test "PDB.scm") +; test methods on PDBProcedure +;(testing:load-test "procedures.scm") + ; test gimp as a refreshable set of installed resources (testing:load-test "refresh.scm") -; test methods on PDBProcedure -(testing:load-test "procedures.scm") + ; test methods on DrawableFilter -(testing:load-test "filters.scm") +(testing:load-test "filter.scm") (testing:load-test "filter-ops.scm") -; Only run when not headless -; (testing:load-test "display.scm") +; Only run when not headless i.e. +; when testing is interactive using SF Console +(testing:load-test "display.scm") +; TODO gimp-file- ops ; TODO undo ; TODO progress diff --git a/plug-ins/script-fu/test/tests/PDB/resource/brush.scm b/plug-ins/script-fu/test/tests/PDB/resource/brush.scm index 40b5b64711919c3c680d159c1e267128696562b4..fee0bf47e0535bdc98213ed3e38fc7d8e3c0e2bd 100644 --- a/plug-ins/script-fu/test/tests/PDB/resource/brush.scm +++ b/plug-ins/script-fu/test/tests/PDB/resource/brush.scm @@ -81,10 +81,12 @@ (assert `(equal? (gimp-brush-get-info ,testNewBrush) `(11 11 1 0))) +; Since 3.0rc2 brush-get-pixels is private to libgimp + ; get-pixels returns a list of attributes ; It is is long so we don't compare. ; This test is just that it doesn't crash or return #f. -(assert `(gimp-brush-get-pixels ,testNewBrush)) +; (assert `(gimp-brush-get-pixels ,testNewBrush)) @@ -100,12 +102,15 @@ -; Kind non-generated brush +(test! "Kind non-generated brush") ; Brush named "z Pepper" is non-generated and is a system brush always installed +; Since 3.0rc2 resource-get-by-name is private to libgimp +; (gimp-resource-get-by-name "GimpBrush" "z Pepper")) + ; setup, not an assert -(define testNongenBrush (gimp-resource-get-by-name "GimpBrush" "z Pepper")) +(define testNongenBrush (gimp-brush-get-by-name "z Pepper")) ; brush says itself is not generated diff --git a/plug-ins/script-fu/test/tests/PDB/resource/resource-ops.scm b/plug-ins/script-fu/test/tests/PDB/resource/resource-ops.scm index 1bab13a1fff96bd76439a34cce347c2c763ddef5..4c2dfdbaf5db687e0e92106f6ec76d3da96163d9 100644 --- a/plug-ins/script-fu/test/tests/PDB/resource/resource-ops.scm +++ b/plug-ins/script-fu/test/tests/PDB/resource/resource-ops.scm @@ -8,19 +8,23 @@ ; since subsequent test scripts expect v2 (script-fu-use-v3) + + +; Since 3.0rc2 resource-get-by-name is private to libgimp + ; setup -(define systemFont (gimp-resource-get-by-name "GimpFont" "Sans-serif")) -(define systemBrush (gimp-resource-get-by-name "GimpBrush" "2. Star")) +(define systemFont (gimp-font-get-by-name "Sans-serif")) +(define systemBrush (gimp-brush-get-by-name "2. Star")) -(test! "resource get by name") +(test! " get by name") ; get-by-name, which is generic and takes a "resource type name" ; get-by-name on non-existent name returns C NULL i.e. invalid ID -(assert `(= (gimp-resource-get-by-name "GimpBrush" "Agate") - -1)) +;(assert `(= (gimp-resource-get-by-name "GimpBrush" "Agate") +; -1)) ; each of the specific get-by-name returns C NULL i.e. invalid ID ; on invalid name @@ -39,8 +43,8 @@ ; "Error") ; get-by-name on existent name returns valid positive ID -(assert `(> (gimp-resource-get-by-name "GimpFont" "Sans-serif") - 0)) +;(assert `(> (gimp-resource-get-by-name "GimpFont" "Sans-serif") +; 0)) (assert `(> (gimp-brush-get-by-name "2. Star") 0)) (assert `(> (gimp-font-get-by-name "Sans-serif") 0)) diff --git a/plug-ins/script-fu/test/tests/Plugins/gegl.scm b/plug-ins/script-fu/test/tests/Plugins/gegl.scm index a81fc112b4d5fa131e0025dd9325ff1eccbaa157..122c1fcd8fa2ed11456c6a53d45128a4cbe95dc9 100644 --- a/plug-ins/script-fu/test/tests/Plugins/gegl.scm +++ b/plug-ins/script-fu/test/tests/Plugins/gegl.scm @@ -108,10 +108,10 @@ (set! testLayer (gimp-layer-new testImage + "LayerNew" 4 4 RGB-IMAGE - "LayerNew" 50.0 LAYER-MODE-MULTIPLY)) ; NORMAL ; must insert layer in image @@ -129,10 +129,10 @@ (set! testLayer (gimp-layer-new testImage + "LayerNew" 4 4 GRAY-IMAGE ; GRAY - "LayerNew" 50.0 LAYER-MODE-NORMAL)) ; must insert layer in image @@ -372,7 +372,8 @@ (define (testGeglFiltersTakingNoArg) - (map testGeglFilter gegl-filter-names2)) + ; change this to names2 for a shorter test + (map testGeglFilter gegl-filter-names)) ; tests Gegl wrappers taking an aux input ; Most filters have input a single layer