From c483470deb670223e6303c20bc43a12549cf8adc Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 17 Oct 2009 14:28:46 +0000 Subject: [PATCH] fix some bad aligned-pasteboard tests svn: r16348 --- .../tests/test-alignment.ss | 1 + .../aligned-pasteboard/tests/test-macro.ss | 7 +-- .../tests/test-pasteboard-lib.ss | 41 +++++++++------- .../aligned-pasteboard/tests/test-snip-lib.ss | 49 ++++++++++--------- 4 files changed, 52 insertions(+), 46 deletions(-) diff --git a/collects/mrlib/private/aligned-pasteboard/tests/test-alignment.ss b/collects/mrlib/private/aligned-pasteboard/tests/test-alignment.ss index c50871ed9e..9fff4e38a4 100644 --- a/collects/mrlib/private/aligned-pasteboard/tests/test-alignment.ss +++ b/collects/mrlib/private/aligned-pasteboard/tests/test-alignment.ss @@ -1,3 +1,4 @@ + (require mzlib/etc mzlib/list diff --git a/collects/mrlib/private/aligned-pasteboard/tests/test-macro.ss b/collects/mrlib/private/aligned-pasteboard/tests/test-macro.ss index 95c15a098b..5dcd9b60e4 100644 --- a/collects/mrlib/private/aligned-pasteboard/tests/test-macro.ss +++ b/collects/mrlib/private/aligned-pasteboard/tests/test-macro.ss @@ -1,5 +1,5 @@ (module test-macro mzscheme - + (require mzlib/etc) (provide test) ;; test: (lambda (a?) ((a? a? . -> . boolean?) a? a? . -> . (void)) @@ -11,6 +11,7 @@ (with-handlers ([exn? identity]) actual)]) - (and (not (exn? result)) - (test result expected)))))) + (unless (and (not (exn? result)) + (test result expected)) + (fprintf (current-error-port) "test failed: ~s != ~s\n" result expected)))))) ) diff --git a/collects/mrlib/private/aligned-pasteboard/tests/test-pasteboard-lib.ss b/collects/mrlib/private/aligned-pasteboard/tests/test-pasteboard-lib.ss index 9a3e36fb46..95c562091c 100644 --- a/collects/mrlib/private/aligned-pasteboard/tests/test-pasteboard-lib.ss +++ b/collects/mrlib/private/aligned-pasteboard/tests/test-pasteboard-lib.ss @@ -1,3 +1,4 @@ + (require mzlib/etc mzlib/class @@ -7,15 +8,15 @@ "../aligned-pasteboard.ss" "../aligned-editor-container.ss") -(printf "running tests for pasteboard-lib.ss~n") +;; (printf "running tests for pasteboard-lib.ss~n") ;;pasteboard-root: ((is-a?/c aligned-pasteboard<%>) -> (is-a?/c aligned-pasteboard<%>)) ;;gets the top most aligned pasteboard in the tree of pasteboards and containers (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] - [pb2 (instantiate aligned-horizontal-pasteboard% ())] - [pb3 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] + [pb2 (instantiate horizontal-pasteboard% ())] + [pb3 (instantiate vertical-pasteboard% ())] [es2 (instantiate aligned-editor-snip% () (editor pb2))] [es3 (instantiate aligned-editor-snip% () (editor pb3))] @@ -42,9 +43,9 @@ ) (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] - [pb2 (instantiate aligned-horizontal-pasteboard% ())] - [pb3 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] + [pb2 (instantiate horizontal-pasteboard% ())] + [pb3 (instantiate vertical-pasteboard% ())] [es1 (instantiate aligned-editor-snip% () (editor pb1))] [es3 (instantiate aligned-editor-snip% () (editor pb3))] @@ -73,9 +74,9 @@ ;;pasteboard-parent: ((is-a?/c pasteboard%) . -> . (is-a?/c aligned-editor-container<%>)) ;;gets the canvas or snip that the pasteboard is displayed in (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] - [pb2 (instantiate aligned-horizontal-pasteboard% ())] - [pb3 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] + [pb2 (instantiate horizontal-pasteboard% ())] + [pb3 (instantiate vertical-pasteboard% ())] [es2 (instantiate aligned-editor-snip% () (editor pb2))] [es3 (instantiate aligned-editor-snip% () (editor pb3))] @@ -102,9 +103,9 @@ ) (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] - [pb2 (instantiate aligned-horizontal-pasteboard% ())] - [pb3 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] + [pb2 (instantiate horizontal-pasteboard% ())] + [pb3 (instantiate vertical-pasteboard% ())] [es2 (instantiate aligned-editor-snip% () (editor pb2))] [es3 (instantiate aligned-editor-snip% () (editor pb3))] @@ -130,10 +131,11 @@ es3) ) +#| ;;num-sizeable: ((is-a?/c aligned-pasteboard<%>) . -> . number?) ;;the number of snips in the pasteboard that can be resized (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] [es1 (instantiate editor-snip% () (editor (instantiate text% ())))] [es2 (instantiate editor-snip% () (editor (instantiate text% ())))] [es3 (instantiate editor-snip% () (editor (instantiate text% ())))] @@ -164,11 +166,11 @@ ) (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] - [es1 (instantiate aligned-editor-snip% () (editor (instantiate aligned-vertical-pasteboard% ())))] - [es2 (instantiate aligned-editor-snip% () (editor (instantiate aligned-vertical-pasteboard% ())))] - [es3 (instantiate aligned-editor-snip% () (editor (instantiate aligned-vertical-pasteboard% ())))] - [es4 (instantiate aligned-editor-snip% () (editor (instantiate aligned-vertical-pasteboard% ())))] + ([pb1 (instantiate vertical-pasteboard% ())] + [es1 (instantiate aligned-editor-snip% () (editor (instantiate vertical-pasteboard% ())))] + [es2 (instantiate aligned-editor-snip% () (editor (instantiate vertical-pasteboard% ())))] + [es3 (instantiate aligned-editor-snip% () (editor (instantiate vertical-pasteboard% ())))] + [es4 (instantiate aligned-editor-snip% () (editor (instantiate vertical-pasteboard% ())))] [frame (instantiate frame% () (label "l") (width 10) (height 10))] [canvas (instantiate aligned-editor-canvas% () (parent frame) (editor pb1))]) @@ -202,3 +204,4 @@ ) (printf "tests done~n") +|# diff --git a/collects/mrlib/private/aligned-pasteboard/tests/test-snip-lib.ss b/collects/mrlib/private/aligned-pasteboard/tests/test-snip-lib.ss index 1d1e7944d9..8d1bc282ff 100644 --- a/collects/mrlib/private/aligned-pasteboard/tests/test-snip-lib.ss +++ b/collects/mrlib/private/aligned-pasteboard/tests/test-snip-lib.ss @@ -1,3 +1,4 @@ + (require mzlib/etc mzlib/class @@ -7,14 +8,14 @@ "../aligned-editor-container.ss" "test-macro.ss") -(printf "running tests for snip-lib.ss~n") +;;(printf "running tests for snip-lib.ss~n") ;;snip-width: ((is-a?/c aligned-pasteboard<%>) (is-a?/c snip%) . -> . number?) ;;the width of a snip in the given pasteboard (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] [es1 (instantiate editor-snip% () (editor pb1))] - [pb2 (instantiate aligned-vertical-pasteboard% ())] + [pb2 (instantiate vertical-pasteboard% ())] [frame (instantiate frame% () (label "l") (width 10) (height 10))] [canvas (instantiate aligned-editor-canvas% () (parent frame) (editor pb2))]) @@ -25,15 +26,15 @@ (sleep/yield 1) (test equal? - (snip-width pb2 es1) - 20) + (snip-width #;pb2 es1) + 20.0) (send es1 resize 200 90) (sleep/yield 1) (test equal? - (snip-width pb2 es1) - 200) + (snip-width #;pb2 es1) + 200.0) (send frame show false) ) @@ -41,9 +42,9 @@ ;;snip-height: ((is-a?/c aligned-pasteboard<%>) (is-a?/c snip%) . -> . number?) ;;the height of a snip in the given pasteboard (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] [es1 (instantiate editor-snip% () (editor pb1))] - [pb2 (instantiate aligned-vertical-pasteboard% ())] + [pb2 (instantiate vertical-pasteboard% ())] [frame (instantiate frame% () (label "l") (width 10) (height 10))] [canvas (instantiate aligned-editor-canvas% () (parent frame) (editor pb2))]) @@ -54,15 +55,15 @@ (sleep/yield 1) (test equal? - (snip-height pb2 es1) - 20) + (snip-height #;pb2 es1) + 20.0) (send es1 resize 200 90) (sleep/yield 1) (test equal? - (snip-height pb2 es1) - 90) + (snip-height #;pb2 es1) + 90.0) (send frame show false) ) @@ -95,11 +96,11 @@ ) (let* - ([pb1 (instantiate aligned-horizontal-pasteboard% ())] - [pb2 (instantiate aligned-horizontal-pasteboard% ())] - [pb3 (instantiate aligned-horizontal-pasteboard% ())] - [pb4 (instantiate aligned-horizontal-pasteboard% ())] - [pb5 (instantiate aligned-horizontal-pasteboard% ())] + ([pb1 (instantiate horizontal-pasteboard% ())] + [pb2 (instantiate horizontal-pasteboard% ())] + [pb3 (instantiate horizontal-pasteboard% ())] + [pb4 (instantiate horizontal-pasteboard% ())] + [pb5 (instantiate horizontal-pasteboard% ())] [es2 (instantiate aligned-editor-snip% () (editor pb2))] [es3 (instantiate aligned-editor-snip% () (editor pb3))] [es4 (instantiate aligned-editor-snip% () (editor pb4))] @@ -139,7 +140,7 @@ ;;fold-snip: (lambda (b?) ((any? b? . -> . b?) b? (is-a?/c snip%) . -> . b?)) ;;the application of f on all snips from snip to the end in a foldl foldr mannor (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] [es1 (instantiate editor-snip% () (editor (instantiate text% ())))] [es2 (instantiate editor-snip% () (editor (instantiate text% ())))] [es3 (instantiate editor-snip% () (editor (instantiate text% ())))] @@ -163,10 +164,10 @@ = (fold-snip (lambda (snip total-height) - (+ (snip-height pb1 snip) + (+ (snip-height #;pb1 snip) total-height)) 0 - es4) + es1) 400) (send frame show false) @@ -176,7 +177,7 @@ ;;for-each-snip: (((is-a?/c snip%) . -> . (void)) (is-a/c? snip%) . -> . (void)) ;;applies the function to all the snips (let* - ([pb1 (instantiate aligned-vertical-pasteboard% ())] + ([pb1 (instantiate vertical-pasteboard% ())] [es1 (instantiate editor-snip% () (editor (instantiate text% ())))] [es2 (instantiate editor-snip% () (editor (instantiate text% ())))] [es3 (instantiate editor-snip% () (editor (instantiate text% ())))] @@ -195,7 +196,7 @@ (for-each-snip (lambda (snip) (set! count (add1 count))) - es4) + es1) (test = @@ -204,4 +205,4 @@ (send frame show false) ) -(printf "tests done~n") +;;(printf "tests done~n")