racket/draw: pens and brushes from lists should be immutable

Closes PR 12732

original commit: 5e4b9e3acac071cc6fdd768070e7f899cda8eccb
This commit is contained in:
Matthew Flatt 2012-04-25 20:31:54 -06:00
parent 252425672e
commit faba676526

View File

@ -507,4 +507,17 @@
;; ---------------------------------------- ;; ----------------------------------------
(define (check-immutable v)
(test 'immutable 'immutable
(with-handlers ([exn:fail? (lambda (x)
(if (regexp-match #rx"immutable" (exn-message x))
'immutable
x))])
(send v set-color "red"))))
(check-immutable (send the-brush-list find-or-create-brush "white" 'solid))
(check-immutable (send the-pen-list find-or-create-pen "white" 1 'solid))
;; ----------------------------------------
(report-errs) (report-errs)