summaryrefslogtreecommitdiffstats
path: root/tests/macscrollbar.test
blob: b62c65ed71ddda1f3d3f66614989c0957e7c8198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: macscrollbar.test,v 1.5 2002/07/13 20:28:35 dgp Exp $

package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands

update

# Tests for display and layout
wm geometry . 50x300
scrollbar .s
pack .s -fill y -expand 1
update
test macscroll-1.1 {TkpDisplayScrollbar procedure} {macOnly} {
    list [.s configure -width] [.s configure -bd]
} {{-width width Width 16 16} {-borderwidth borderWidth BorderWidth 0 0}}
test macscroll-1.2 {TkpDisplayScrollbar procedure} {macOnly} {
    # 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} {macOnly} {
    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} {macOnly} {
    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} {macOnly} {
    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} {macOnly} {
    # 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} {macOnly} {
    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
} {}

deleteWindows
# cleanup
::tcltest::cleanupTests
return