diff --git a/collects/tests/mred/README b/collects/tests/mred/README index 41717ca6..50e25584 100644 --- a/collects/tests/mred/README +++ b/collects/tests/mred/README @@ -54,6 +54,10 @@ features: "Pen 1 x 1" in a possibly different font "Pen 2 x 2" in a bold font (bold version of 1x1 font) + A line should appear across each of "Pen 0 x 0", etc. + (if the line is missing, it was probably erased when the text + was repainted, and that is bad) + the drawings under 0x0 and 1x1 should look the same: TopLeft: h-line should be left-aligned with box below it, but extend 1 extra pixel. v-line similarly should be @@ -61,12 +65,21 @@ features: touch the box - there should be 2 pixels of space. Top: Lines for the rotated L's should join in a sharp corner Second from Top: like top-left, but lines should touch the box + (so only the vertical overhang is visible) + Second from top, right: For 0x0, the X should never be + more than 1 pixel wide; this is a case + where 1x1 may be different (i.e., it may + have areas two-pixels wide) Four shape lines: First and second should be exactly the same shape, with the first hollow and the second filled. - Third shape and 2x2 shapes are ill-defined. + Third shape and all 2x2 shapes are ill-defined. Octagons: two hollow octagons exactly the same shape. + Dot (after octagons): a single pixel Line: actually two lines, but they should form a single unbroken line + Arcs: The leftmost should be the top half of a circle (it's + form via two arcs); the rightmost should be a filled + wedge from 90 degrees to 180 degress Images: MrEd logo (b & w) BB logo (color) Down-left arrow (b & w) @@ -74,6 +87,27 @@ features: Down-left arrow - red with white background BB logo, possibly reddened Down-left arrow - red with *white* background + Stippled boxes: In a blue box w/black border, three boxes: + Black and white/blue stippled arrow + (white vs. blue: depends on platform and DC) + Black and white stippled arrow + BB stippled + +The image should look the same regardless of the top radio button +setting --- Canvas, Pixmap, or Bitmap --- except that the Bitmap +setting might produce a black-and-white image. + +Clicking on the "*2" checkbox should double the size of everything +except the pen widths and bitmaps. + +Clicking on "+10" should shift everything 10 pixels down and across. +(Event when "*2" is checked, it should be a 10 pixel offset). + +Clicking on "PostScript" should produce the same image in a PostScript +file. + +The "icons" and "stipple" boxes just enable those parts of the +drawing. PostScript drawing of icons and stipples can be slow. --------------------------------------------------------------------------- diff --git a/collects/tests/mred/frame-steps.txt b/collects/tests/mred/frame-steps.txt new file mode 100644 index 00000000..a7cc90bc --- /dev/null +++ b/collects/tests/mred/frame-steps.txt @@ -0,0 +1,267 @@ + +These instructions go with the "item.ss" MrEd test file. You probably +got them by clicking on the "Get Instructions" button. + +This file mostly contains instructions for running the "Make Big +Frame" and "Make Medium Frame" tests. "Big" and "Medium" are silly +names; they're essentially the same set of tests, but for different +sets of controls. There are just too many kinds of controls to fit in +one frame. + +Note that the clock in the upper right of the "Test Selector" frame +should increment every second. + +The field of buttons at the bottom of the Selector frame open little +frames for testing individual control types in detail. Those frames +come with their own instructions. + +Make XXX Frame +-------------- + +Big Frame should contain the following on the left: + + Message (a message) (a message) + Hello (a button) + (a button) + List (a list box) + Apple + Banana + Coconut & Donut + Check (a check box) + (a check box) + Radio (a radio box) + First + Second + Third + Image Radio (a check box) + + + Choice (a choice item) + Alpha + Beta + Gamma + Delta & Rest + Text (a text field) + initial & starting + +Medium Frame should contain: + + H Slider (a horizontal slider) + V Slider (a vertical slider) + H Gauge (a horizontal slider) + V Gauge (a vertical slider) + Howdy (a canvas-message) + (a canvas-message) + Text (a media-text) + initial & starting + + +The names on labels must match the above exactly (except that <> +indicates an image). Watch out for letters that are dropped or +&s that are dropped. + +Make sure all the controls with moving parts work. + +Window Resizing +--------------- + +Stretch the window vertically. Stretch it horizontally. Unless the +frame was created with "all stechy" on, then messages, buttons, check +boxes, and radio boxes should not stretch. Choice and text items +should only strech horizontally. Sliders and gauges should only +resize in the major direction. + +If "all stretchy" was on, then everything in the left column should +stretch both directions. + +Show and Hide +------------- + +The second column in the window starts with "Hide and Show". Click it +and see that the frame disappears and reappears. The remaining +checkboxes can be un-checked to hide items. The first two hide +everything in the left column. The remained hide the corresponding +item on the left. + +Click on the canvas at the bottom of the second column. A popup menu +should accurately report the local visibility of each control. (If a +control is shown but the panel is hidden, the menu should still say +SHOWN.) + + + * hide/show all the controls through each panel + checkbox; the menu should say SHOWN for all + items + + * click each checkbox to hide an item, then click + again to show it before moving to the next item; + check the popup menu for accuracy before and after + re-showing + + * hide all of the controls, then hide and unhide the + whole panel (one of the top checkboxes); unhiding + should not show the hidden controls; unhide one + or two to convince yourself that the panel is + unhid + + * hide the panel and unhide all of the controls; + you should not see any of them; then unhide the + panel; they should all appear + + * hide the panel; hide all the controls; unhide the + panel (the controls should not appear); unhide + all the controls + + * repeat the three steps above with the other panel checkbox + +Enable and Disable +------------------ + +The third column contains checkboxes for enabling things. Note that +each radio button has its own enabler, as well as the whole radio +box. Try each one, clicking on the item to make sure it's really +disabled. + + * enable/disable all the controls through each panel + checkbox + + * click each checkbox to disble an item; click on the + item to make sure it's disabled; recheck the checkbox; + make sure the item is re-enebaled + + * disable all the controls; disable and re-enable the + whole panel; make sure the controls are still disabled + + * disable the panel; re-enable the individual controls; + make sure the controls are still not enabled; re-enable + the panel and check that the controls are enabled + + * disbale the panel; diable all the controls; enable the + panel and make sure the controls are still disabled; + enable all the controls + + * repeat the three steps above with the other panel checkbox + + * repeat the three steps for radioboxes and radio items, + sintead of panels and controls + +Relabeling +---------- + +The buttons in the fourth column toggle the labels on items. The +control should not resize itself for the new label. + +For text labels, the new label is XXXXXXXXX. For icon labels, +it depends: + + - message: + - button: + - checbox: + +Note that radio items can't be relabelled. + +Be sure to click each button twice, to make sure that the original +label is restored. + +Cursors +------- + +Checking "Control Bullseye Cursors" should change the cursor over +every control in the left column, plus the canvas in the second +column. The cursor should only apply to the "client area" of a +control, not the label if it is outside the control. The cursor should +be normal everywhere else. + +Checking "Frame Cross Cursor" should change the cursor in the +frame to a cross. It sets the cursor for the controls only when +"Controls Bullseye Cursors" is not set. + +Checking "Busy Cursor" should change the cursor to a watch everywhere +in the frame's eventspace. It overrides all other cursor settings. + +Combinations to try: + + * Bull only - just controls changed + * Cross only - all of frame changed + * Bull + Cross - controls are bullseye, cross everywhere else + - Uncheck Cross and make sure Bull still works + - Recheck Cross, uncheck Bull and make sure Cross works on + controls + * Busy only - everywhere changed + * Busy + Cross - everywhere changed + - Uncheck Busy and make sure Cross still works + - Recheck Busy, uncheck cross and make sure Busy still works + - Uncheck Busy and make sure Cross is still off + * Busy + Bull - everywhere changed + (same as above, but for Bull) + * Busy + Bull + Cross - everywhere changed + - Uncheck Busy and verify Bull + Cross + (that's enough) + +Popup Menus (Big Frame) +----------- + +Hide something. Left-click on the canvas to see the SHOW state. +Unhide that something. RIGHT-click on the canvas to get the old + SHOW state. Then left-click to see the new SHOW state. +Left-click and pick some item; verify that the canvas shows the + select index (counting from 1) +Right-click and pick some item; verify that the canvas shows the + selected index (counting from 1) + +Focus Info +---------- + +Under "Enable Text", the current focus is show as: + label value + Sometimes label is () for null (no label) + Sometimes value is just # (no known class) +but usually you can tell what it means. + +Click on various controls. Watch how the focus changes (some controls +on some platforms never get the focus). Verify that the focus +indicator is always right. (There's about a 1 second delay.) + +Event Info +---------- + +Under the focus indicator, the last event is reported. If the label of +the destination is non-null, the label is shown, otherwise the value +is shown. + +As the mouse is moved over a control's client area, the event +indicator should report the control under the mouse and `mouse' for +mouse event. This is independent of the location of the focus. + +Press a key. Instead of `mouse', the event indicator should say `key', +and report the item that currently has the focus. (Unfortunately, +under windows, the key info is immediately replaced with mouse info.) + +Event Filtering +--------------- + +When "Drop Mouse Events" is checked at the bottom of the thrid column, +all other controls (except "Drop Mouse Events" and "Drop Key Events") +shold cease to respond to mouse events. The event indicator will still +work. Keyboard events should not be affected (though it may be hard to +get the focus somewhere interesting). + +Try every control with mouse events dropped. + +"Drop Key Events" does the obvious thing. Try every keybord-responding +control with events dropped. Try dialog navigation keys on other +controls, such as TAB or left-arrow. + +Different Configuations +----------------------- + +Each Frame can be created in several different configurations (32 or +64 of them!). + +Step through the first 16 configurations, create a frame each time, +and make sure the resulting controls look right. Resize each frame and +check stretchiness before closing it. + +Go back to the default configuration and try the 3 other combinations +of label and button fonts. + diff --git a/collects/tests/mred/item.ss b/collects/tests/mred/item.ss index d7eeb5b6..850c3372 100644 --- a/collects/tests/mred/item.ss +++ b/collects/tests/mred/item.ss @@ -55,7 +55,7 @@ (lambda () (when (send frame is-shown?) (send m set-label - (let* ([w (mred:test:get-focused-window)] + (let* ([w (with-handlers ([void (lambda (x) #f)]) (mred:test:get-focused-window))] [l (and w (send w get-label))]) (format "focus: ~a ~a" (or l "") w))) (start 1000 #t)))]))) @@ -94,7 +94,7 @@ ctls)) (map (lambda (b c) (send b set-cursor c)) ctls old))) - "Bullseye Cursors") + "Control Bullseye Cursors") (make-object mred:check-box% panel (lambda (c e) (if (send c get-value) @@ -310,7 +310,7 @@ cp) items))) -(define (big-frame h-radio? v-label? null-label? stretchy? special-font?) +(define (big-frame h-radio? v-label? null-label? stretchy? special-label-font? special-button-font?) (define f (make-object active-frame% null "Tester")) @@ -343,8 +343,10 @@ (add-testers "Sub-sub-panel" tp) - (when special-font? + (when special-label-font? (send tp set-label-font special-font)) + (when special-button-font? + (send tp set-button-font special-font)) (let ([ctls (make-ctls tp cp lp add-testers ep h-radio? v-label? null-label? stretchy?)]) (add-focus-note f ep) @@ -356,12 +358,12 @@ (set! prev-frame f) f) -(define (med-frame radio-h? label-h? null-label? stretchy? special-font?) +(define (med-frame radio-h? label-h? null-label? stretchy? special-label-font? special-button-font?) (define f2 (make-object active-frame% null "Tester2")) (define hp2 (make-object mred:horizontal-panel% f2)) - (define ip2 (make-object mred:vertical-panel% hp2)) + (define ip2-0 (make-object mred:vertical-panel% hp2)) (define cp2 (make-object mred:vertical-panel% hp2)) (define ep2 (make-object mred:vertical-panel% hp2)) (define lp2 (make-object mred:vertical-panel% hp2)) @@ -377,16 +379,25 @@ (send control stretchable-in-y #t) (basic-add-testers2 name control)) basic-add-testers2)) - + + (define fp2 (make-object mred:vertical-panel% ip2-0)) + (define ip2 (make-object mred:vertical-panel% fp2)) + (make-h&s cp2 f2) - (add-disable "Previous Tester Frame" prev-frame ep2) + (add-testers2 "Sub-panel" fp2) + (add-testers2 "Sub-sub-panel" ip2) + + (when prev-frame + (add-disable "Previous Tester Frame" prev-frame ep2)) (when (not label-h?) (send ip2 set-label-position wx:const-vertical)) - (when special-font? + (when special-label-font? (send ip2 set-label-font special-font)) + (when special-button-font? + (send ip2 set-button-font special-font)) (begin (define sh (make-object mred:slider% ip2 @@ -440,14 +451,24 @@ (add-change-label "Vert Gauge" gv lp2 #f OTHER-LABEL) (add-change-label "Text" txt lp2 #f OTHER-LABEL) - (add-focus-note f2 ep2) - (send f2 set-info ep2) - - (add-cursors f2 lp2 (list sh sv - gh gv - cmt cmi - txt)) + (let* ([items (list sh sv + gh gv + cmt cmi + txt)] + [canvas (make-object popup-test-canvas% + items + (list "h slider" "v slider" + "v gauge" "v gauge" + "text msg" "image msg" + "text") + cp2)]) + + (add-focus-note f2 ep2) + (send f2 set-info ep2) + + (add-cursors f2 lp2 (cons canvas items))) + (send f2 show #t) (set! prev-frame f2) f2)) @@ -597,7 +618,7 @@ (sequence (send restp stretchable-in-y #f) (send mc set-media e) - (send e load-file (local-path "steps.txt"))) + (send e load-file (local-path "menu-steps.txt"))) (public [make-test-button (lambda (name pnl menu id) @@ -790,10 +811,10 @@ (define p (make-object mred:vertical-panel% f)) (define old-list null) (define commands (list wx:const-event-type-button-command)) - (define sema (make-semaphore)) + (define hit? #f) (define b (make-object mred:button% p (lambda (bx e) - (semaphore-post sema) + (set! hit? #t) (set! old-list (cons e old-list)) (check-callback-event b bx e commands #f)) "Hit Me")) @@ -808,14 +829,14 @@ (define e (make-object mred:button% p (lambda (c e) (sleep 1) - (wx:yield) ; try to catch a click, but not a callback - (set! sema (make-semaphore)) - (send b enable #f) - (thread (lambda () (wx:yield sema))) - (when (semaphore-wait-multiple (list sema) 0.5) - (printf "un-oh~n")) - (send b enable #t) - (semaphore-post sema)) + (set! hit? #f) + (let ([sema (make-semaphore)]) + (send b enable #f) + (thread (lambda () (sleep 0.5) (semaphore-post sema))) + (wx:yield sema) + (when hit? + (printf "un-oh~n")) + (send b enable #t))) "Disable Test")) (send f show #t)) @@ -1155,9 +1176,13 @@ (define selector (make-object mred:frame% null "Test Selector")) (define ap (make-object mred:vertical-panel% selector)) -; Test timers while we're at it: +; Test timers while we're at it. And create the "Instructions" button. (let ([clockp (make-object mred:horizontal-panel% ap)] [selector selector]) + (make-object mred:button% clockp + (lambda (b e) + (send (send (mred:edit-file (local-path "frame-steps.txt")) get-edit) lock #t)) + "Get Instructions") (make-object mred:vertical-panel% clockp) ; filler (let ([time (make-object mred:message% clockp "XX:XX:XX")]) (make-object @@ -1271,12 +1296,16 @@ (make-object mred:radio-box% p1 void "Stretchiness" -1 -1 -1 -1 '("Normal" "All Stretchy"))) - (define font-radio - (make-object mred:radio-box% p1 void "Font" + (define label-font-radio + (make-object mred:radio-box% p1 void "Label Font" + -1 -1 -1 -1 + '("Normal" "Big"))) + (define button-font-radio + (make-object mred:radio-box% p1 void "Button Font" -1 -1 -1 -1 '("Normal" "Big"))) (define next-button - (let ([basic-set (list label-h-radio label-null-radio stretchy-radio font-radio)]) + (let ([basic-set (list label-h-radio label-null-radio stretchy-radio label-font-radio button-font-radio)]) (make-next-button p2 (if radios? (cons radio-h-radio basic-set) @@ -1291,7 +1320,8 @@ (positive? (send label-h-radio get-selection)) (positive? (send label-null-radio get-selection)) (positive? (send stretchy-radio get-selection)) - (positive? (send font-radio get-selection)))) + (positive? (send label-font-radio get-selection)) + (positive? (send button-font-radio get-selection)))) (format "Make ~a Frame" size))) #t)) diff --git a/tests/mred/steps.txt b/collects/tests/mred/menu-steps.txt similarity index 100% rename from tests/mred/steps.txt rename to collects/tests/mred/menu-steps.txt