PIKApp/plug-ins/script-fu/test/tests/PDB/image/image-layers.scm

59 lines
1.6 KiB
Scheme

; test Image methods of PDB
; where methods deal with layers owned by image.
; setup
; Load test image that already has drawable
(define testImage (testing:load-test-image "wilber.png"))
; get-layers
; procedure returns (1 #(<layerID>)) ....in the REPL
; the testImage has one layer
(assert `(= (car (pika-image-get-layers ,testImage ))
1))
; get-layers returns second result a vector of ID's
; !!! use cadr to get second result
(assert `(vector? (cadr (pika-image-get-layers ,testImage ))))
; the vector also has one element
(assert `(= (vector-length (cadr (pika-image-get-layers ,testImage )))
1))
; the vector can be indexed at first element
; and is a numeric ID
(assert `(number?
(vector-ref (cadr (pika-image-get-layers ,testImage ))
0)))
; store the layer ID
(define testLayer (vector-ref (cadr (pika-image-get-layers testImage ))
0))
; FIXME seems to fail??? because name is actually "Background"
; the same layer can be got by name
; FIXME app shows layer name is "wilber.png" same as image name
(assert `(= (car (pika-image-get-layer-by-name ,testImage "Background"))
,testLayer))
; the single layer's position is zero
; pika-image-get-layer-position is deprecated
(assert `(= (car (pika-image-get-item-position ,testImage ,testLayer))
0))
; TODO pika-image-get-layer-by-tattoo
; the single layer is selected in freshly opened image
(assert `(= (car (pika-image-get-selected-layers ,testImage ))
1))
; TODO test selected layer is same layer