File: test-display.scm

package info (click to toggle)
gimp 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 222,880 kB
  • sloc: ansic: 870,914; python: 10,965; lisp: 10,857; cpp: 7,355; perl: 4,536; sh: 1,753; xml: 972; yacc: 609; lex: 348; javascript: 150; makefile: 42
file content (56 lines) | stat: -rw-r--r-- 1,493 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env gimp-script-fu-interpreter-3.0

; Calls scheme (display ...)
; Tests it prints to any stdout console where Gimp was started.

; Then calls (error ...)
; Tests Gimp declares an error.

; in v2, (display ...) did not go to the terminal,
; but was prepended to any error message,
; or disappeared when there was no error.



(define (script-fu-test-display)

  ;       test display function

  ; display shows a passed string
  (display "foo")

  ; display shows repr of any atom or list
  (display '(1 2 "bar"))

  ; print is not defined in R5RS
  ; same as display but adds newline

  (gimp-message "Called display: expect foo(1 2 bar)#<CLOSURE> in terminal")



  ;       test error function

  ; Call to error yields:
  ;    dialog when Gimp Error Console not open
  ;    else text in the open Gimp Error Console
  (gimp-message "Called error: expect Gimp dialog, OR error in Gimp Error Console.")
  ; Scheme objects print their representation.
  ; Here gimp-message should print as #<CLOSURE>
  (error "Reason" gimp-message)

  ; Call to error returns to Gimp, this should not be reached.
  (gimp-message "Test failed: unreachable statement was reached.")
)

(script-fu-register "script-fu-test-display"
    "Test scheme display and error functions"
    "Test (display ...) to console, and (error ...) returns err to Gimp"
    "lkk"
    "lkk"
    "2024"
    ""
)

(script-fu-menu-register "script-fu-test-display"
                         "<Image>/Filters/Development/Demos")