; test Image of mode grayscale methods of PDB

; !!! Note inconsistent use in PIKA of GRAY versus GRAYSCALE



;              Basic grayscale tests


;              setup

(define testImage (car (pika-image-new 21 22 RGB)))




; method pika-image-convert-grayscale does not error
(assert `(pika-image-convert-grayscale ,testImage))

; conversion was effective:
; basetype of grayscale is GRAY
(assert `(=
            (car (pika-image-get-base-type ,testImage))
            GRAY))

; conversion was effective:
; grayscale image has-a colormap
; colormap is-a vector of length zero, when image has no drawable.
; FIXME doc says num-bytes is returned, obsolete since GBytes
(assert `(=
            (vector-length
              (car (pika-image-get-colormap ,testImage)))
            0))

; grayscale images have precision PRECISION-U8-NON-LINEAR
; FIXME annotation of PDB procedure says PIKA_PRECISION_U8
(assert `(=
           (car (pika-image-get-precision ,testImage))
           PRECISION-U8-NON-LINEAR ))

; TODO
; drawable of grayscale image is also grayscale
;(assert `(car (pika-drawable-is-grayscale
;                 ()
;               ,testImage)

; convert precision of grayscale image succeeds
(assert `(pika-image-convert-precision
            ,testImage
            PRECISION-DOUBLE-GAMMA))




