home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / tests / macscrollbar.test < prev    next >
Encoding:
Text File  |  1997-08-15  |  2.8 KB  |  102 lines  |  [TEXT/ALFA]

  1. # This file is a Tcl script to test out scrollbar widgets and
  2. # the "scrollbar" command of Tk.  This file only tests Macintosh
  3. # specific features.  It is organized in the standard fashion for 
  4. # Tcl tests.
  5. #
  6. # Copyright (c) 1996 Sun Microsystems, Inc.
  7. #
  8. # See the file "license.terms" for information on usage and redistribution
  9. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  10. #
  11. # SCCS: @(#) macscrollbar.test 1.3 97/06/24 13:48:34
  12.  
  13. # Only run this test on the Macintosh
  14. if {$tcl_platform(platform) != "macintosh"} return
  15.  
  16. if {[info procs test] != "test"} {
  17.     source defs
  18. }
  19.  
  20. foreach i [winfo children .] {
  21.     destroy $i
  22. }
  23. wm geometry . {}
  24. raise .
  25. update
  26.  
  27. # Tests for display and layout
  28. wm geometry . 50x300
  29. scrollbar .s
  30. pack .s -fill y -expand 1
  31. update
  32. test macscroll-1.1 {TkpDisplayScrollbar procedure} {
  33.     list [.s configure -width] [.s configure -bd]
  34. } {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
  35. test macscroll-1.2 {TkpDisplayScrollbar procedure} {
  36.     # Exercise drawing 3D relief
  37.     pack .s -fill y -expand 1 -anchor center
  38.     .s configure -bd 4
  39.     update
  40.     focus .s
  41.     update
  42. } {}
  43. test macscroll-1.3 {TkpDisplayScrollbar procedure} {
  44.     pack .s -fill y -expand 1 -anchor e
  45.     update
  46.     set x [.s configure -width]
  47.     pack .s -fill y -expand 1 -anchor w
  48.     update
  49.     list [.s configure -width] $x
  50. } {{-width width Width 16 16} {-width width Width 16 16}}
  51. test macscroll-1.4 {TkpDisplayScrollbar procedure} {
  52.     wm geometry . 300x50
  53.     .s configure -bd 0 -orient horizontal
  54.     pack .s -fill x -expand 1 -anchor center
  55.     update
  56.     set x [.s configure -width]
  57.     pack .s -fill x -expand 1 -anchor n
  58.     update
  59.     set y [.s configure -width]
  60.     pack .s -fill x -expand 1 -anchor s
  61.     update
  62.     list [.s configure -width] $x $y
  63. } {{-width width Width 16 16} {-width width Width 16 16} {-width width Width 16 16}}
  64. test macscroll-1.5 {TkpDisplayScrollbar procedure} {
  65.     wm geometry . 300x16
  66.     .s configure -bd 0 -orient horizontal
  67.     pack .s -fill x -expand 1 -anchor s
  68.     update
  69.     wm geometry . 300x15
  70.     update
  71.     wm geometry . 300x14
  72.     update
  73. } {}
  74. test macscroll-1.6 {TkpDisplayScrollbar procedure} {
  75.     # Check the drawing of the resize hack
  76.     wm geometry . 20x300
  77.     wm resizable . 1 1
  78.     .s configure -bd 0 -orient vertical
  79.     pack .s -fill y -expand 1 -anchor e
  80.     update
  81.     set x [.s identify 12 295]
  82.     wm resizable . 0 0
  83.     update
  84.     set y [.s identify 12 295]
  85.     wm resizable . 1 1
  86.     pack .s -fill y -expand 1 -anchor center
  87.     update
  88.     list $x $y [.s identify 12 295]
  89. } {{} arrow2 arrow2}
  90. test macscroll-1.7 {TkpDisplayScrollbar procedure} {
  91.     wm geometry . 300x300
  92.     pack .s -fill y -expand 1 -anchor e
  93.     catch {destroy .s2}
  94.     scrollbar .s2 -orient horizontal
  95.     place .s2 -x 0 -y 284 -width 300
  96. } {}
  97.  
  98. foreach i [winfo children .] {
  99.     destroy $i
  100. }
  101. concat {}
  102.