From f3676130e05c45911fe2c5ba086c3f534cbf4e45 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 11 Nov 1998 03:40:33 +0000 Subject: [PATCH] . original commit: 26a2046f95ea35d87f2f78085a1a311282c1008f --- collects/tests/mred/choice-list-steps.txt | 21 +++++++------- collects/tests/mred/gauge-steps.txt | 15 +++++----- collects/tests/mred/item.ss | 35 +++++++++++++++++------ collects/tests/mred/slider-steps.txt | 8 +++--- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/collects/tests/mred/choice-list-steps.txt b/collects/tests/mred/choice-list-steps.txt index 9665d86f..3d3856b0 100644 --- a/collects/tests/mred/choice-list-steps.txt +++ b/collects/tests/mred/choice-list-steps.txt @@ -28,11 +28,12 @@ If there are no items: For a multi-selection list, jump down to "Multiple Selections". If there are items, select each once in order (single-click for - lists). After each solection, "Selected N" should appear in the - window (where N is the position of the item, counting from 0), - followed by "Callback Ok". This should be printed even if the - selection is technically unchanged. Select the last one a second time - to make sure. + lists). After each solection, "Changed N" should appear in the + console (where N is the position of the item, counting from 0) for a + choice item, "Change (N)" for a list box; in either case, the + "Changed" line is followed by "Callback Ok". This should be printed + even if the selection is technically unchanged. Select the last one a + second time to make sure. For a choice, click to pop-up the menu, but don't select anything. for a list, click in an area without items and in the scroll bar(s). In @@ -69,7 +70,7 @@ Repeat the above four steps for the "by name" buttons. (There's nothing equivalent to -1 for the "by name" buttons.) Repeat the four steps for the "by Simulate" buttons; in addition to - having the selections change, the "Selected N" and "Callback Ok" + having the selections change, the "Changed N" and "Callback Ok" messages should print in the console. For the -1 and X cases, "event selection value mismatch" should print in the console, and the selection should not change. @@ -86,9 +87,9 @@ Choose clear again. Nothing should happen. Click on all parts of the control. The callback should never be invoked. -Click on all the "Select" buttons. Nothing should happen, except for - the "by Simulate" buttons. for "by Simulate", the console should - contain an error messaage: "Callback for empty choice/list" +Click on all the "Select" buttons. For the top buttons and "by + Simulate" buttons (but not the "bad" ones), an exception should be + reported. Nothing should happend for the "by Name" buttons. Click on "Check". The empty item list should be reported in the console. @@ -177,7 +178,7 @@ Double-Click >> Lists Only << ------------ Double-click on "Alpha". The console should report the first click - in the normal way, and then report "Selected -1" followed by + in the normal way, and then report "Changed -1" followed by "Double-click", then "Callback Ok". Double-click on "Gamma". Same as above, except that the initial diff --git a/collects/tests/mred/gauge-steps.txt b/collects/tests/mred/gauge-steps.txt index 2b4695f6..7f5610b3 100644 --- a/collects/tests/mred/gauge-steps.txt +++ b/collects/tests/mred/gauge-steps.txt @@ -1,7 +1,6 @@ -The gauge should be initially empty (i.e., set to 0), and - have a maximum value of 10 (although there's no indication - of the maximum). +The gauge should be initially empty (i.e., set to 0), and have a + maximum value of 10 (although there's no indication of the maximum). Click "+". The gauge should go up by one. @@ -9,9 +8,11 @@ Click "-". It should go back down to zero. Click "+" five times. The gauge should be at the halfway point. -Click "-" ten times. Click "+" once. The gauge should be at one. +Click "-" ten times. (Five type errors.) Click "+" once. The gauge + should be at one. -Click "+" twelve times. Click "-" once. The gauge should be at nine. +Click "+" twelve times. (Three mismatch errors.) Click "-" once. The + gauge should be at nine. Click "-" four times. The gauge should be at the halfway point. @@ -29,6 +30,6 @@ Click "Smaller" once more. The range is now 4, so the gauge value Click "Bigger" and the gauge should be 80% full. -Click "Smaller" six times. The minimum gauge range is 1, so click - "Bigger" once and the gauge should be at halfway. +Click "Smaller" six times. (Two type errors.) The minimum gauge range + is 1, so click "Bigger" once and the gauge should be at halfway. diff --git a/collects/tests/mred/item.ss b/collects/tests/mred/item.ss index 4e1ceaaa..a8636f17 100644 --- a/collects/tests/mred/item.ss +++ b/collects/tests/mred/item.ss @@ -1165,6 +1165,18 @@ (set! actual-content '("Alpha" "Beta" "Gamma")) (set! actual-user-data (list #f #f #f)))) null)) + (define sel (if list? + (make-object button% + "Add Select First" cdp + (lambda (b e) + (send c select 0 #t))) + null)) + (define unsel (if list? + (make-object button% + "Unselect" cdp + (lambda (b e) + (send c select (send c get-selection) #f))) + null)) (define (make-selectors method mname numerical?) (define p2 (make-object horizontal-panel% p)) (send p2 stretchable-height #f) @@ -1172,7 +1184,9 @@ (make-object button% (string-append "Select Bad -1" mname) p2 (lambda (b e) - (method -1)))) + (with-handlers ([exn:application:type? void]) + (method -1) + (error "expected a type exception"))))) (make-object button% (string-append "Select First" mname) p2 (lambda (b e) @@ -1188,9 +1202,11 @@ (make-object button% (string-append "Select Bad X" mname) p2 (lambda (b e) - (method (if numerical? - (send c get-number) - #f)))) + (with-handlers ([exn:application:mismatch? void]) + (method (if numerical? + (send c get-number) + #f)) + (error "expected a mismatch exception")))) #f) (define dummy-1 (make-selectors (ivar c set-selection) "" #t)) (define dummy-2 (make-selectors (lambda (p) @@ -1229,11 +1245,14 @@ (unless (= n (send c find-string s)) (error "bad find-string result"))) (loop (add1 n) (cdr l) (cdr lud)))) - (unless (and (not (send c get-string -1)) - (not (send c get-string (send c get-number)))) - (error "out-of-bounds did not return #f")) + (let ([bad (lambda (exn? i) + (with-handlers ([exn? void]) + (send c get-string i) + (error "out-of-bounds: no exn")))]) + (bad exn:application:type? -1) + (bad exn:application:mismatch? (send c get-number))) (unless (not (send c find-string "nada")) - (error "bad find-string result for nada")) + (error "find-string of nada wasn't #f")) (for-each (lambda (e) (check-callback-event c c e commands #t)) diff --git a/collects/tests/mred/slider-steps.txt b/collects/tests/mred/slider-steps.txt index 1a71ee0a..41fb488b 100644 --- a/collects/tests/mred/slider-steps.txt +++ b/collects/tests/mred/slider-steps.txt @@ -7,11 +7,11 @@ Change the slider value in each way allowed by the control (dragging, drag, one callback may be reported for the whole drag, or intermediate callbacks may be reported. -Click "Up" until the slider is at the top. Clicking when the slider - is at its maximum value should have no effect. Click "Down" once - aand verify that the slider is at 11. +Click "Up" until the slider is at the top; a mismatch exception should + be reported. Click "Down" once aand verify that the slider is at 10. -Repeat the above step for "Down". +Repeat the above step for "Down" (checking for an exception when the + slider is already at its minimum value). Repeat the above two steps for "Simulate Up" and "Simulate Down". For the simulates, the console should report "Callback Ok" for each click.