home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tk4.0 / tests / util.test < prev    next >
Encoding:
Text File  |  1994-12-17  |  2.3 KB  |  71 lines

  1. # This file is a Tcl script to test out the procedures in the file
  2. # tkUtil.c.  It is organized in the standard fashion for Tcl tests.
  3. #
  4. # Copyright (c) 1994 The Regents of the University of California.
  5. # Copyright (c) 1994 Sun Microsystems, Inc.
  6. #
  7. # See the file "license.terms" for information on usage and redistribution
  8. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9. #
  10. # @(#) util.test 1.3 94/12/17 15:55:00
  11.  
  12. if {[string compare test [info procs test]] == 1} then \
  13.   {source defs}
  14.  
  15. foreach i [winfo children .] {
  16.     destroy $i
  17. }
  18. wm geometry . {}
  19. raise .
  20.  
  21. listbox .l -width 20 -height 5 -relief sunken -bd 2
  22. pack .l
  23. .l insert 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  24. update
  25. test util-1.1 {Tk_GetScrollInfo procedure} {
  26.     list [catch {.l yview moveto a b} msg] $msg
  27. } {1 {wrong # args: should be ".l yview moveto fraction"}}
  28. test util-1.2 {Tk_GetScrollInfo procedure} {
  29.     list [catch {.l yview moveto xyz} msg] $msg
  30. } {1 {expected floating-point number but got "xyz"}}
  31. test util-1.3 {Tk_GetScrollInfo procedure} {
  32.     .l yview 0
  33.     .l yview moveto .5
  34.     .l yview
  35. } {0.5 0.75}
  36. test util-1.4 {Tk_GetScrollInfo procedure} {
  37.     list [catch {.l yview scroll a} msg] $msg
  38. } {1 {wrong # args: should be ".l yview scroll number units|pages"}}
  39. test util-1.5 {Tk_GetScrollInfo procedure} {
  40.     list [catch {.l yview scroll a b c} msg] $msg
  41. } {1 {wrong # args: should be ".l yview scroll number units|pages"}}
  42. test util-1.6 {Tk_GetScrollInfo procedure} {
  43.     list [catch {.l yview scroll xyz units} msg] $msg
  44. } {1 {expected integer but got "xyz"}}
  45. test util-1.7 {Tk_GetScrollInfo procedure} {
  46.     .l yview 0
  47.     .l yview scroll 2 pages
  48.     .l nearest 0
  49. } {6}
  50. test util-1.8 {Tk_GetScrollInfo procedure} {
  51.     .l yview 15
  52.     .l yview scroll -2 pages
  53.     .l nearest 0
  54. } {9}
  55. test util-1.9 {Tk_GetScrollInfo procedure} {
  56.     .l yview 0
  57.     .l yview scroll 2 units
  58.     .l nearest 0
  59. } {2}
  60. test util-1.10 {Tk_GetScrollInfo procedure} {
  61.     .l yview 15
  62.     .l yview scroll -2 units
  63.     .l nearest 0
  64. } {13}
  65. test util-1.11 {Tk_GetScrollInfo procedure} {
  66.     list [catch {.l yview scroll 3 zips} msg] $msg
  67. } {1 {bad argument "zips": must be units or pages}}
  68. test util-1.12 {Tk_GetScrollInfo procedure} {
  69.     list [catch {.l yview dropdead 3 times} msg] $msg
  70. } {1 {unknown option "dropdead": must be moveto or scroll}}
  71.