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# Copyright (c) 1998-1999 by Scriptics Corporation.
8# All rights reserved.
9#
10# RCS: @(#) $Id: macscrollbar.test,v 1.5 2002/07/13 20:28:35 dgp Exp $
11
12package require tcltest 2.1
13namespace import -force tcltest::configure
14namespace import -force tcltest::testsDirectory
15configure -testdir [file join [pwd] [file dirname [info script]]]
16configure -loadfile [file join [testsDirectory] constraints.tcl]
17tcltest::loadTestedCommands
18
19update
20
21# Tests for display and layout
22wm geometry . 50x300
23scrollbar .s
24pack .s -fill y -expand 1
25update
26test macscroll-1.1 {TkpDisplayScrollbar procedure} {macOnly} {
27    list [.s configure -width] [.s configure -bd]
28} {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
29test macscroll-1.2 {TkpDisplayScrollbar procedure} {macOnly} {
30    # Exercise drawing 3D relief
31    pack .s -fill y -expand 1 -anchor center
32    .s configure -bd 4
33    update
34    focus .s
35    update
36} {}
37test macscroll-1.3 {TkpDisplayScrollbar procedure} {macOnly} {
38    pack .s -fill y -expand 1 -anchor e
39    update
40    set x [.s configure -width]
41    pack .s -fill y -expand 1 -anchor w
42    update
43    list [.s configure -width] $x
44} {{-width width Width 16 16} {-width width Width 16 16}}
45test macscroll-1.4 {TkpDisplayScrollbar procedure} {macOnly} {
46    wm geometry . 300x50
47    .s configure -bd 0 -orient horizontal
48    pack .s -fill x -expand 1 -anchor center
49    update
50    set x [.s configure -width]
51    pack .s -fill x -expand 1 -anchor n
52    update
53    set y [.s configure -width]
54    pack .s -fill x -expand 1 -anchor s
55    update
56    list [.s configure -width] $x $y
57} {{-width width Width 16 16} {-width width Width 16 16} {-width width Width 16 16}}
58test macscroll-1.5 {TkpDisplayScrollbar procedure} {macOnly} {
59    wm geometry . 300x16
60    .s configure -bd 0 -orient horizontal
61    pack .s -fill x -expand 1 -anchor s
62    update
63    wm geometry . 300x15
64    update
65    wm geometry . 300x14
66    update
67} {}
68test macscroll-1.6 {TkpDisplayScrollbar procedure} {macOnly} {
69    # Check the drawing of the resize hack
70    wm geometry . 20x300
71    wm resizable . 1 1
72    .s configure -bd 0 -orient vertical
73    pack .s -fill y -expand 1 -anchor e
74    update
75    set x [.s identify 12 295]
76    wm resizable . 0 0
77    update
78    set y [.s identify 12 295]
79    wm resizable . 1 1
80    pack .s -fill y -expand 1 -anchor center
81    update
82    list $x $y [.s identify 12 295]
83} {{} arrow2 arrow2}
84test macscroll-1.7 {TkpDisplayScrollbar procedure} {macOnly} {
85    wm geometry . 300x300
86    pack .s -fill y -expand 1 -anchor e
87    catch {destroy .s2}
88    scrollbar .s2 -orient horizontal
89    place .s2 -x 0 -y 284 -width 300
90} {}
91
92deleteWindows
93# cleanup
94::tcltest::cleanupTests
95return
96