;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor.test) ;;;;;; ;;; Graphics (def function make-test-document/graphics/empty () (scroll-pane (document () (make-test-content/graphics/empty)))) (def function make-test-document/graphics () (scroll-pane (document () (make-test-content/graphics)))) ;;;;;; ;;; String (def function make-test-document/string/empty () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the document document))) 0))) (make-test-content/string/empty)))) (def function make-test-document/string () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the document (content-of (the widget/scroll-pane document))))) 4))) (make-test-content/string)))) ;;;;;; ;;; Text (def function make-test-document/text/empty () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the make-styled-string/string (elt (the list (elements-of (the text/paragraph (elt (the list (elements-of (the text/document (content-of (the document document))))) 0)))) 0)))) 0))) (make-test-content/text/empty)))) (def function make-test-document/text () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the styled-string/string (elt (the list (elements-of (the text/paragraph (elt (the list (elements-of (the text/document (content-of (the document document))))) 1)))) 0)))) 4))) (make-test-content/text)))) ;;;;;; ;;; List (def function make-test-document/list/empty () (scroll-pane (document (:selection '(the sequence-position (pos (the list (elements-of (the list/list (content-of (the document document))))) 0))) (make-test-content/list/empty)))) (def function make-test-document/list () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the list/element (elt (the list (elements-of (the list/list (content-of (the document document))))) 0)))) 2))) (make-test-content/list)))) ;;;;;; ;;; Table (def function make-test-document/table/empty () (scroll-pane (document (:selection '(the sequence-position (pos (the list (cells-of (the table/row (elt (the list (rows-of (the table/table (content-of (the document document))))) 0)))) 0))) (make-test-content/table/empty)))) (def function make-test-document/table () (scroll-pane (document (:selection '(the sequence-position (pos (the string (content-of (the table/cell (elt (the list (cells-of (the table/row (elt (the list (rows-of (the table/table (content-of (the document document))))) 1)))) 0)))) 25))) (make-test-content/table)))) ;;;;;; ;;; Tree (def function make-test-document/tree/empty () (scroll-pane (document (:selection '(the null (content-of (the document document)))) (make-test-content/tree/empty)))) (def function make-test-document/tree () (scroll-pane (document (:selection '(the sequence-position (pos (the string (elt (the list (children-of (the tree/node (elt (the list (children-of (the tree/node (content-of (the document document))))) 1)))) 1)) 1))) (make-test-content/tree)))) ;;;;;; ;;; Book (def function make-test-document/book/empty () (scroll-pane (document (:selection '(the sequence-position (pos (the string (title-of (the book/book (content-of (the document document))))) 0))) (make-test-content/book/empty)))) (def function make-test-document/book () (scroll-pane (document (:selection '(the sequence-position (pos (the string (title-of (the book/chapter (elt (the list (elements-of (the book/book (content-of (the document document))))) 0)))) 3))) (make-test-content/book)))) ;;;;;; ;;; XML (def function make-test-document/xml/empty () (scroll-pane (document (:selection '(content-of (the document document))) (make-test-content/xml/empty)))) (def function make-test-document/xml () (scroll-pane (document (:selection '(the sequence-position (pos (the string (value-of (the xml/attribute (elt (the list (attributes-of (the xml/element (elt (the list (children-of (the xml/element (elt (the list (children-of (the xml/element (content-of (the document document))))) 0)))) 1)))) 1)))) 2))) (make-test-content/xml)))) ;;;;;; ;;; JSON (def function make-test-document/json/empty () (scroll-pane (document (:selection '(the null (content-of (the document document)))) (make-test-content/json/empty)))) (def function make-test-document/json () (scroll-pane (document (:selection '(the sequence-position (pos (the string (text-of (the json/string (elt (the list (elements-of (the json/array (content-of (the document document))))) 4)))) 10))) (make-test-content/json)))) ;;;;;; ;;; Java (def function make-test-document/java/empty () (scroll-pane (document (:selection '(content-of (the document document))) (make-test-content/java/empty)))) (def function make-test-document/java () (scroll-pane (document (:selection '(the sequence-position (pos (the string (name-of (the java/declaration/method (content-of (the document document))))) 2))) (make-test-content/java)))) ;;;;;; ;;; Lisp form (def function make-test-document/lisp-form/empty () (scroll-pane (document (:selection '(content-of (the document document))) (make-test-content/lisp-form/empty)))) (def function make-test-document/lisp-form () (scroll-pane (document (:selection '(the sequence-position (pos (the string (elt (the list (content-of (the document document))) 0)) 3))) (make-test-content/lisp-form)))) ;;;;;; ;;; Walked lisp form (def function make-test-document/walked-lisp-form/empty () (scroll-pane (document (:selection '(content-of (the document document))) (make-test-content/walked-lisp-form/empty)))) (def function make-test-document/walked-lisp-form () (scroll-pane (document (:selection '(the sequence-position (pos (the string (slot-value (the hu.dwim.walker:function-definition-form (content-of (the document document))) 'hu.dwim.walker::docstring)) 7))) (make-test-content/walked-lisp-form)))) ;;;;;; ;;; T (def function make-test-document/t/empty () (scroll-pane (document () (make-test-content/t/empty)))) (def function make-test-document/t () (scroll-pane (document () (make-test-content/t)))) ;;;;;; ;;; Nested (def function make-test-document/nested () (scroll-pane (document (:selection '(the sequence-position (pos (the string (slot-value (the hu.dwim.walker:constant-form (elt (the list (slot-value (the hu.dwim.walker:free-application-form (slot-value (the hu.dwim.walker:if-form (elt (the list (slot-value (the hu.dwim.walker:lambda-function-form (content-of (the document document))) 'hu.dwim.walker::body)) 0)) 'hu.dwim.walker::condition)) 'hu.dwim.walker::arguments)) 0)) 'hu.dwim.walker::value)) 1))) (make-test-content/nested)))) ;;;;;; ;;; Complex (def function make-test-document/complex () (scroll-pane (document (:selection '(the sequence-position (pos (the string (slot-value (the hu.dwim.walker:function-definition-form (content-of (content-of (the table/cell (elt (the list (cells-of (the table/row (elt (the list (rows-of (the table/table (content-of (the document document))))) 1)))) 1))))) 'hu.dwim.walker::docstring)) 7))) (make-test-content/complex)))) ;;;;;; ;;; Wow (def function make-test-document/wow () (scroll-pane (document () (make-test-content/wow)))) ;;;;;; ;;; Test (def suite* (test/document :in test)) (def test test/document/graphics () (finishes (make-test-document/graphics))) (def test test/document/string () (finishes (print-document (make-test-document/string) (make-string-output-stream)))) (def test test/document/text () (finishes (print-document (make-test-document/text) (make-string-output-stream)))) (def test test/document/list () (finishes (print-document (make-test-document/list) (make-string-output-stream)))) (def test test/document/table () (finishes (print-document (make-test-document/table) (make-string-output-stream)))) (def test test/document/tree () (finishes (print-document (make-test-document/tree) (make-string-output-stream)))) (def test test/document/book () (finishes (print-document (make-test-document/book) (make-string-output-stream)))) (def test test/document/xml () (finishes (print-document (make-test-document/xml) (make-string-output-stream)))) (def test test/document/json () (finishes (print-document (make-test-document/json) (make-string-output-stream)))) (def test test/document/java () (finishes (print-document (make-test-document/java) (make-string-output-stream)))) (def test test/document/lisp-form () (finishes (print-document (make-test-document/lisp-form) (make-string-output-stream)))) (def test test/document/walked-lisp-form () (finishes (print-document (make-test-document/walked-lisp-form) (make-string-output-stream)))) (def test test/document/t () (finishes (print-document (make-test-document/t) (make-string-output-stream)))) (def test test/document/nested () (finishes (print-document (make-test-document/nested) (make-string-output-stream)))) (def test test/document/complex () (finishes (print-document (make-test-document/complex) (make-string-output-stream))))