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