diff --git a/collects/tests/framework/keys.rkt b/collects/tests/framework/keys.rkt index 8b3f0a6c..95953e43 100644 --- a/collects/tests/framework/keys.rkt +++ b/collects/tests/framework/keys.rkt @@ -282,15 +282,20 @@ [end-expect (buff-spec-end after)]) (test (list key-sequence i) (lambda (x) (equal? x (vector text-expect start-expect end-expect))) - `(let* ([text (send (get-top-level-focus-window) get-editor)]) - (send text erase) - (send text insert ,(buff-spec-string before)) - (send text set-position ,(buff-spec-start before) ,(buff-spec-end before)) + `(let* ([qc (λ (t) (let ([c (make-channel)]) + (queue-callback (λ () (channel-put c (t)))) + (channel-get c)))] + [text (qc (λ () (send (get-top-level-focus-window) get-editor)))]) + (qc (λ () + (send text erase) + (send text insert ,(buff-spec-string before)) + (send text set-position ,(buff-spec-start before) ,(buff-spec-end before)))) ,@(map (lambda (key) `(test:keystroke ',(car key) ',(cdr key))) key-sequence) - (vector (send text get-text) - (send text get-start-position) - (send text get-end-position))))))]) + (qc (λ () + (vector (send text get-text) + (send text get-start-position) + (send text get-end-position))))))))]) (for-each process-key-sequence key-sequences)))