fix AFP digitization setup with CA
Fixing some unfortunate changes introduced by !53558 (merged): changed errors back to fatals; fix possible double initialization; put testing macro to a separate file.
(this is a copy of !53685 (closed) but merging to 22.0
instead of incorrect master
)
Edited by Petr Balek