;;; Copyright (c) 2023 Teddy Wing
;;;
;;; This file is part of XFDF.
;;;
;;; XFDF is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; XFDF is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with XFDF. If not, see .
(defpackage :xfdf-test
(:use :cl
:1am
:xfdf))
(in-package :xfdf-test)
(test generates-xfdf-xml
(let ((xfdf-string
(with-output-to-string (xfdf-stream)
(xfdf:write-xfdf
xfdf-stream
'(("checkbox-on" . t)
("checkbox-off" . nil)
("text" . "123 Fake Street, Springfield"))))))
(is (string=
xfdf-string
"
Yes
Off
123 Fake Street, Springfield
"))))
(test generates-hierarchical-xfdf
(let ((xfdf-string
(with-output-to-string (xfdf-stream)
(xfdf:write-xfdf
xfdf-stream
'(("topmostSubform[0]"
. (("Page1[0]"
. (("c1_01[1]" . "2")
("f1_02[0]" . "Homer J.")
("f1_03[0]" . "Simpson")))
("Page2[0]"
. (("f2_02[0]" . "1234")))))
("bottommostSubform[0]"
. (("Page1[0]"
. (("f1_01[0]" . "Annoyed grunt!"))))))))))
(is (string=
xfdf-string
"
2
Homer J.
Simpson
1234
Annoyed grunt!
"))))