hal/capture-specification-tests.lisp
in-package#:luv.tests
deftestcapture-specifications-have-stable-wiki-paths-and-live-redefinition
let*
name"capture-protocol-test"
first
make-instance'luv:capture-specification:namename:figure-id"ABC12G":kind:image:description"first":extension"png":renderer#'identity
second
make-instance'luv:capture-specification:namename:figure-id"ABC12G":kind:image:description"second":extension"webp":layout:portrait:renderer#'identity
unwind-protect
deftestcapture-web-derivative-is-smaller-and-keeps-the-original
let*
directory
uiop:ensure-directory-pathname
merge-pathnames
formatnil"luv-capture-web-test-~36R/"
randommost-positive-fixnum
uiop:temporary-directory
specification
make-instance'luv:capture-specification:name"web-derivative-test":figure-id"WEB12G":kind:image:description"responsive image test":extension"png":renderer#'identity
original
responsive
unwind-protect
progn
ensure-directories-existoriginal
ok
probe-fileoriginal
ok
probe-fileresponsive
let*
entry
variants
getfentry:variants
variant
find768variants:key
lambda
item
getfitem:width
ok
string="WEB12G-web-derivative-test.png"
getfentry:file
ok
eq:landscape
getfentry:layout
ok
equal'
480768
mapcar
lambda
variantsitem
getfitem:width
ok
string="WEB12G-web-derivative-test-768w.webp"
getfvariant:file
ok
uiop:delete-directory-treedirectory:validatet:if-does-not-exist:ignore
defclass capture-specification
A named recipe for one generated wiki image or video. The semantic metadata is inspectable and retained in source; RENDERER is the ordinary named function installed by DEFINE-CAPTURE. Rendered bytes live under the capture output directory and do not belong in Git. #IVRWI8
defun register-capture-specification
(specification)defun capture-output-pathname
(specification directory)defun find-capture-specification
(name &key (errorp t))define-arithmetic-operator =
Test whether two compatible scalars are equal.
defun capture-responsive-image-pathname
(pathname &optional (width +capture-web-image-width+))defun write-rgba-png
(pathname pixels width height format)define-arithmetic-operator *
Multiplication and scalar scaling.
defun prepare-capture-web-media
(specification pathname)Create the small public-index derivative for captured media at PATHNAME. Image originals get 480w and 768w WebPs whenever those are true downscales. Films get a card-sized WebP poster from their first frame. Originals remain untouched and retain their stable capture identity. #IVRWI8
defun capture-media-dimensions
(pathname)defun capture-manifest-entry
(specification directory)