summaryrefslogtreecommitdiffstats
path: root/tests/macscrollbar.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/macscrollbar.test')
-rw-r--r--tests/macscrollbar.test101
1 files changed, 101 insertions, 0 deletions
diff --git a/tests/macscrollbar.test b/tests/macscrollbar.test
new file mode 100644
index 0000000..0dd6646
--- /dev/null
+++ b/tests/macscrollbar.test
@@ -0,0 +1,101 @@
+# This file is a Tcl script to test out scrollbar widgets and
+# the "scrollbar" command of Tk. This file only tests Macintosh
+# specific features. It is organized in the standard fashion for
+# Tcl tests.
+#
+# Copyright (c) 1996 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# SCCS: @(#) macscrollbar.test 1.3 97/06/24 13:48:34
+
+# Only run this test on the Macintosh
+if {$tcl_platform(platform) != "macintosh"} return
+
+if {[info procs test] != "test"} {
+ source defs
+}
+
+foreach i [winfo children .] {
+ destroy $i
+}
+wm geometry . {}
+raise .
+update
+
+# Tests for display and layout
+wm geometry . 50x300
+scrollbar .s
+pack .s -fill y -expand 1
+update
+test macscroll-1.1 {TkpDisplayScrollbar procedure} {
+ list [.s configure -width] [.s configure -bd]
+} {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
+test macscroll-1.2 {TkpDisplayScrollbar procedure} {
+ # Exercise drawing 3D relief
+ pack .s -fill y -expand 1 -anchor center
+ .s configure -bd 4
+ update
+ focus .s
+ update
+} {}
+test macscroll-1.3 {TkpDisplayScrollbar procedure} {
+ pack .s -fill y -expand 1 -anchor e
+ update
+ set x [.s configure -width]
+ pack .s -fill y -expand 1 -anchor w
+ update
+ list [.s configure -width] $x
+} {{-width width Width 16 16} {-width width Width 16 16}}
+test macscroll-1.4 {TkpDisplayScrollbar procedure} {
+ wm geometry . 300x50
+ .s configure -bd 0 -orient horizontal
+ pack .s -fill x -expand 1 -anchor center
+ update
+ set x [.s configure -width]
+ pack .s -fill x -expand 1 -anchor n
+ update
+ set y [.s configure -width]
+ pack .s -fill x -expand 1 -anchor s
+ update
+ list [.s configure -width] $x $y
+} {{-width width Width 16 16} {-width width Width 16 16} {-width width Width 16 16}}
+test macscroll-1.5 {TkpDisplayScrollbar procedure} {
+ wm geometry . 300x16
+ .s configure -bd 0 -orient horizontal
+ pack .s -fill x -expand 1 -anchor s
+ update
+ wm geometry . 300x15
+ update
+ wm geometry . 300x14
+ update
+} {}
+test macscroll-1.6 {TkpDisplayScrollbar procedure} {
+ # Check the drawing of the resize hack
+ wm geometry . 20x300
+ wm resizable . 1 1
+ .s configure -bd 0 -orient vertical
+ pack .s -fill y -expand 1 -anchor e
+ update
+ set x [.s identify 12 295]
+ wm resizable . 0 0
+ update
+ set y [.s identify 12 295]
+ wm resizable . 1 1
+ pack .s -fill y -expand 1 -anchor center
+ update
+ list $x $y [.s identify 12 295]
+} {{} arrow2 arrow2}
+test macscroll-1.7 {TkpDisplayScrollbar procedure} {
+ wm geometry . 300x300
+ pack .s -fill y -expand 1 -anchor e
+ catch {destroy .s2}
+ scrollbar .s2 -orient horizontal
+ place .s2 -x 0 -y 284 -width 300
+} {}
+
+foreach i [winfo children .] {
+ destroy $i
+}
+concat {}