84 lines
2.2 KiB
Scheme
84 lines
2.2 KiB
Scheme
; Test various operations on image
|
|
|
|
|
|
; setup
|
|
(define testImage (car (pika-image-new 21 22 RGB)))
|
|
|
|
|
|
; transformations
|
|
|
|
; flip
|
|
(assert `(pika-image-flip ,testImage ORIENTATION-HORIZONTAL))
|
|
(assert `(pika-image-flip ,testImage ORIENTATION-VERTICAL))
|
|
; TODO rotate scale resize policy
|
|
|
|
(assert-error `(pika-image-flip ,testImage ORIENTATION-UNKNOWN)
|
|
(string-append
|
|
"Procedure execution of pika-image-flip failed on invalid input arguments: "
|
|
"Procedure 'pika-image-flip' has been called with value 'PIKA_ORIENTATION_UNKNOWN'"
|
|
" for argument 'flip-type' (#2, type PikaOrientationType). This value is out of range."))
|
|
|
|
; rotate
|
|
(assert `(pika-image-rotate ,testImage ROTATE-90))
|
|
(assert `(pika-image-rotate ,testImage ROTATE-180))
|
|
(assert `(pika-image-rotate ,testImage ROTATE-270))
|
|
|
|
; scale
|
|
; up
|
|
(assert `(pika-image-scale ,testImage 100 100))
|
|
|
|
; down to min
|
|
(assert `(pika-image-scale ,testImage 1 1))
|
|
|
|
; up to max
|
|
; Performance:
|
|
; This seems to work fast when previous scaled to 1,1
|
|
; but then seems to slow down testing
|
|
; unless we scale down afterwards.
|
|
; This seems glacial if not scaled to 1,1 prior.
|
|
(assert `(pika-image-scale ,testImage 524288 524288))
|
|
|
|
; down to min
|
|
(assert `(pika-image-scale ,testImage 1 1))
|
|
|
|
|
|
; policy ops
|
|
|
|
; 0 means non-interactive
|
|
(assert `(pika-image-policy-color-profile ,testImage 0))
|
|
(assert `(pika-image-policy-rotate ,testImage 0))
|
|
|
|
|
|
|
|
; freezing and unfreezing (avoid updates to dialogs)
|
|
; Used for performance.
|
|
(assert `(pika-image-freeze-channels ,testImage))
|
|
(assert `(pika-image-freeze-layers ,testImage))
|
|
(assert `(pika-image-freeze-vectors ,testImage))
|
|
(assert `(pika-image-thaw-channels ,testImage))
|
|
(assert `(pika-image-thaw-layers ,testImage))
|
|
(assert `(pika-image-thaw-vectors ,testImage))
|
|
|
|
; clean-all makes image not dirty
|
|
(assert `(pika-image-clean-all ,testImage))
|
|
(assert `(=
|
|
(car (pika-image-is-dirty ,testImage))
|
|
0))
|
|
|
|
; TODO test flatten is effective
|
|
; crop
|
|
|
|
|
|
; painting ops
|
|
; TODO
|
|
; heal
|
|
; erase
|
|
; smudge
|
|
; pencil
|
|
; clone
|
|
; airbrush
|
|
|
|
; cannot flatten empty image
|
|
(assert-error `(pika-image-flatten ,testImage)
|
|
"Procedure execution of pika-image-flatten failed: Cannot flatten an image without any visible layer.")
|