adjust contract for test:button-push so it isn't so ugly

original commit: 977fd37913e04d9ae6f7127f037c428c6b86a630
This commit is contained in:
Robby Findler 2012-08-29 14:52:29 -05:00
parent c1dd757d5e
commit 5e895a0725

View File

@ -852,25 +852,30 @@
(define test:mouse-click mouse-click) (define test:mouse-click mouse-click)
(define test:new-window new-window) (define test:new-window new-window)
(provide/doc (define (label-of-enabled/shown-button-in-top-level-window? str)
(proc-doc/names
test:button-push
(-> (or/c (λ (str)
(and (string? str)
(test:top-level-focus-window-has? (test:top-level-focus-window-has?
(λ (c) (λ (c)
(and (is-a? c button%) (and (is-a? c button%)
(string=? (send c get-label) str) (string=? (send c get-label) str)
(send c is-enabled?) (send c is-enabled?)
(send c is-shown?)))))) (send c is-shown?)))))
(and/c (is-a?/c button%) (define (enabled-shown-button? btn)
(λ (btn)
(and (send btn is-enabled?) (and (send btn is-enabled?)
(send btn is-shown?))) (send btn is-shown?)))
(λ (btn)
(define (button-in-top-level-focusd-window? btn)
(test:top-level-focus-window-has? (test:top-level-focus-window-has?
(λ (c) (eq? c btn)))))) (λ (c) (eq? c btn))))
(provide/doc
(proc-doc/names
test:button-push
(-> (or/c (and/c string?
label-of-enabled/shown-button-in-top-level-window?)
(and/c (is-a?/c button%)
enabled-shown-button?
button-in-top-level-focusd-window?))
void?) void?)
(button) (button)
@{Simulates pushing @racket[button]. If a string is supplied, the @{Simulates pushing @racket[button]. If a string is supplied, the