From 26147e891afa5f746f6b86a281f0effca1d43fe7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 12 Oct 1998 03:28:55 +0000 Subject: [PATCH] . original commit: d345c15ae070713df4dbf7bcacd648b42c25761b --- collects/tests/mred/item.ss | 14 +++++++++++--- collects/tests/mred/radiobox-steps.txt | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/collects/tests/mred/item.ss b/collects/tests/mred/item.ss index 2c295cd0..b7d286ee 100644 --- a/collects/tests/mred/item.ss +++ b/collects/tests/mred/item.ss @@ -158,7 +158,7 @@ m) last-m)]) (set! last-m m) - (popup-menu m x y))))]) + (popup-menu m (inexact->exact x) (inexact->exact y)))))]) (sequence (apply super-init args)))) @@ -987,13 +987,21 @@ (let ([e (make-object control-event% 'radio-box)]) (send rb set-selection p) (send rb command e)))) + (define (mk-err exn?) + (lambda (f) + (lambda (rb p) + (with-handlers ([exn? void]) + (f rb p) + (error "no exn raisd"))))) + (define type-err (mk-err exn:application:type?)) + (define mismatch-err (mk-err exn:application:mismatch?)) (define do-sel (lambda (sel n) (for-each (lambda (rb) (sel rb (n rb))) rbs))) - (define sel-minus (lambda (sel) (do-sel sel (lambda (rb) -1)))) + (define sel-minus (lambda (sel) (do-sel (type-err sel) (lambda (rb) -1)))) (define sel-first (lambda (sel) (do-sel sel (lambda (rb) 0)))) (define sel-middle (lambda (sel) (do-sel sel (lambda (rb) (floor (/ (send rb get-number) 2)))))) (define sel-last (lambda (sel) (do-sel sel (lambda (rb) (sub1 (send rb get-number)))))) - (define sel-N (lambda (sel) (do-sel sel (lambda (rb) (send rb get-number))))) + (define sel-N (lambda (sel) (do-sel (mismatch-err sel) (lambda (rb) (send rb get-number))))) (define (make-selectors title sel) (define hp2 (make-object horizontal-panel% p)) (send hp2 stretchable-height #f) diff --git a/collects/tests/mred/radiobox-steps.txt b/collects/tests/mred/radiobox-steps.txt index 10ff58d6..da4304f9 100644 --- a/collects/tests/mred/radiobox-steps.txt +++ b/collects/tests/mred/radiobox-steps.txt @@ -19,9 +19,10 @@ Click "Select First", "Select Middle", "Select Last" then in all radioboxes each time. (For the two-button box, the second one counts as `middle'.) -Click "Select -1" and "Select N". Nothing should happen. Select the - last button in each box and try "Select -1" again. Nothing - should happen. Return the selection to the first item in each box. +Click "Select -1" and "Select N". Nothing should happen (because the + appropriate exceptions are caught). Select the last button in each + box and try "Select -1" again. Nothing should happen. Return the + selection to the first item in each box. Repeat the two steps for the "Select XXX by Simulate" buttons. In this case, "Callback Ok" should be printed three times when any button