-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgimp-experiments.rkt
100 lines (78 loc) · 2.77 KB
/
gimp-experiments.rkt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#lang racket
;;; File:
;;; louDBus/gimp-experiments.rkt
;;; Author:
;;; Samuel A. Rebelsky
;;; Summary:
;;; A collection of experiments to check if louDBus is working okay.
;;; These experiments require that the gimp-dbus server is available.
(require louDBus/unsafe)
(define gimp (loudbus-proxy "edu.grinnell.cs.glimmer.GimpDBus"
"/edu/grinnell/cs/glimmer/gimp"
"edu.grinnell.cs.glimmer.pdb"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 0x - Legal functions calls.
; Experiment 01 - Legal function call to gimp-image-new.
(define expt01
(lambda ()
(loudbus-call gimp 'gimp_image_new 200 200 0)))
; Experiment 02 - Legal function call using dashes
(define expt02
(lambda ()
(loudbus-call gimp 'gimp-image-new 200 200 0)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 1x - Illegal function calls
; Experiment 11 - Invalid function name
(define expt11
(lambda ()
(loudbus-call gimp 'fdafdssadf)))
; Experiment 12 - Invalid number of parameters
(define expt12
(lambda ()
(loudbus-call gimp 'gimp-image-new 200)))
; Experiment 13 - Invalid parameter types. This seems to convert
; 1.5 to 1. Is that what we want?
(define expt13
(lambda ()
(loudbus-call gimp 'gimp-image-new 200 200 1.5)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 2x - loudbus-method-info
; Experiment 21 - A valid request
(define expt21
(lambda ()
(loudbus-method-info gimp 'gimp_image_new)))
; Experiment 22 - An invalid request
(define expt22
(lambda ()
(loudbus-method-info gimp 'adsfasdfa)))
; Experiment 23 - Using dashes in the function name
(define expt23
(lambda ()
(loudbus-method-info gimp 'gimp-image-new)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 3x - loudbus-services
; Experiment 31 - The basic test. (I'm not sure that there are others.)
(define expt31
(lambda ()
(loudbus-services)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 4x - loudbus-objects
; Experiment 41 - All objects for gimp
(define expt41
(lambda ()
(loudbus-objects gimp)))
; Experiment 42 - Illegal service
(define expt42
(lambda ()
(loudbus-objects "abc")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Experiment 9x - Miscellaneous type experiments
; Experiment 91 - How well do we handle reading arrays of bytes
(define expt91
(lambda ()
(loudbus-call gimp 'test_bytes_get)))
; Experiment 92 - How well do we handle sending arrays of bytes?
(define expt92
(lambda ()
(let ((data (bytes 1 255 0 126 0 22 31 8 1)))
(loudbus-call gimp 'test_bytes_put (bytes-length data) data))))