Allowing paths in big-bang's record? argument and adjusting a test to make use of that feature. It would also be good to allow bitmap to take paths, but that is non-trivial, because of its assumption that non-literal strings are module paths

This commit is contained in:
Jay McCarthy 2011-07-02 20:13:27 -07:00
parent 3dcb19007d
commit de9aec3051
2 changed files with 6 additions and 7 deletions

View File

@ -390,7 +390,7 @@
;; -> String or false
(define/private (recordable-directory)
(and (string? record?) (directory-exists? record?) record?))
(and (path-string? record?) (directory-exists? record?) record?))
;; Frame Custodian ->* (-> Void) (-> Void)
;; adds the stop animation and image creation button,

View File

@ -1,6 +1,7 @@
#lang racket
(require 2htdp/universe 2htdp/image (only-in lang/imageeq image=?))
(require 2htdp/universe 2htdp/image (only-in lang/imageeq image=?)
racket/runtime-path)
(define (draw-number n)
(place-image (text (number->string n) 44 'red) 50 50 (empty-scene 100 100)))
@ -9,13 +10,12 @@
(place-image stop 50 50 (empty-scene 100 100)))
(define stop (text "STOP" 44 'red))
(define dir "images0")
(define-runtime-path dir "images0")
(unless (directory-exists? dir)
(make-directory dir))
(parameterize ([current-directory dir])
(for-each delete-file (directory-list)))
(with-output-to-file (format "./~a/index.html" dir)
(with-output-to-file (build-path dir "index.html")
(lambda ()
(displayln "<html><body><img src=\"i-animated.gif\" /></body></html>"))
#:exists 'replace)
@ -31,6 +31,5 @@
(define j (draw-stop 5))
(unless (image=? (crop 0 0 100 100 i) j)
(fprintf (current-error-port)
"this test needs to be revised -- the way 'world' writes images adds an extra pixel -- think! \n"))
(eprintf "this test needs to be revised -- the way 'world' writes images adds an extra pixel -- think! \n"))