Skip to content

Commit 6d89265

Browse files
committed
fix color-list->bitmap's interpretation of the color argument
related to #148
1 parent 180248d commit 6d89265

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

htdp-lib/2htdp/private/image-more.rkt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@
15841584
(bytes-set! bytes (+ j 3) (color-blue c))]
15851585
[else
15861586
(define str (if (string? c) c (symbol->string c)))
1587-
(define clr (or (send the-color-database find-color str)
1587+
(define clr (or (string->color-object/f str)
15881588
(send the-color-database find-color "black")))
15891589
(bytes-set! bytes j 255) ;; this should probably (send clr alpha) when that's possible
15901590
(bytes-set! bytes (+ j 1) (send clr red))

htdp-test/2htdp/tests/test-image.rkt

+9
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,15 @@
22162216
(rectangle 1 1 'solid (color 5 5 5))
22172217
(rectangle 1 1 'solid (color 6 6 6)))))
22182218

2219+
(test (equal? (color-list->bitmap (list "MediumGreen") 1 1)
2220+
(color-list->bitmap (list "black") 1 1))
2221+
=>
2222+
#f)
2223+
(test (equal? (color-list->bitmap (list "DarkPink") 1 1)
2224+
(color-list->bitmap (list "black") 1 1))
2225+
=>
2226+
#f)
2227+
22192228
(test (color-list->bitmap '() 0 0) => (empty-scene 0 0))
22202229
(test (color-list->bitmap '() 0 10) => (empty-scene 0 10))
22212230
(test (color-list->bitmap '() 4 0) => (empty-scene 4 0))

0 commit comments

Comments
 (0)