Skip to content

Commit afd0a67

Browse files
committed
fix set-overlay-renderers to accept a renderer tree
... the contract specified a renderer tree, but the method only accepted a list of renderers.
1 parent 29d1394 commit afd0a67

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plot-gui-lib/plot/private/gui/snip2d.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
(define the-overlay-renderers #f)
199199

200200
(define/public (set-overlay-renderers renderers)
201-
(set! the-overlay-renderers renderers)
201+
(set! the-overlay-renderers (flatten renderers))
202202
(refresh))
203203

204204
(define (draw-overlay-renderers dc x y left top right bottom)

plot-test/plot/tests/PRs/snip-overlay-renderers.rkt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
;; test exists to ensure that the overlay plot area is created at least once
77
;; during the testing process, and any initialization problems are caught
88
;; early.
9+
;;
10+
;; An additional bug was found where the `set-overlay-renderers` would only
11+
;; accept a flat list of renderers instead of a renderer tree as advertised by
12+
;; the method contract -- this unit tests also verifies that
13+
;; `set-overlay-renderers` does in fact accept renderer trees.
914

1015
(define snip-overlay-renderers
1116
(test-suite
@@ -34,8 +39,11 @@
3439
(check-not-exn
3540
(lambda ()
3641
;; The 2d-plot-area% for the overlay area is created on-demand when
37-
;; overlay renderers are present
38-
(send snip set-overlay-renderers (list (function cos -3 3)))
42+
;; overlay renderers are present. Also the overlay renderers are a
43+
;; renderer tree (nested lists) to ensure that these are accepted by
44+
;; the method.
45+
(send snip set-overlay-renderers
46+
(list (function cos -3 3) (list (vrule -1) (vrule 1))))
3947
(send snip draw dc 0 0 0 0 10 10 0 0 'no-caret)))
4048
(send tl show #f)))))
4149

0 commit comments

Comments
 (0)