summaryrefslogtreecommitdiffstats
path: root/tests/bevel.tcl
blob: 4af60f3f0cce9d4616c8a91f8e079167a1576b7a (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# This file creates a visual test for bevels drawn around text in text
# widgets.  It is part of the Tk visual test suite, which is invoked
# via the "visual" script.

catch {destroy .t}
toplevel .t
wm title .t "Visual Tests for Borders in Text Widgets"
wm iconname .t "Text Borders"
wm geom .t +0+0

text .t.t -width 60 -height 30 -setgrid true -xscrollcommand {.t.h set} \
	-font {Courier 12} \
	-yscrollcommand {.t.v set} -wrap none -relief raised -bd 2
scrollbar .t.v -orient vertical -command ".t.t yview"
scrollbar .t.h -orient horizontal -command ".t.t xview"
button .t.quit -text Quit -command {destroy .t}
pack .t.quit -side bottom -pady 3 -ipadx 4 -ipady 2
pack .t.h -side bottom -fill x
pack .t.v -side right -fill y
pack .t.t -expand yes -fill both
wm minsize .t 1 1

if {[winfo depth .t] > 1} {
    .t.t tag configure r1 -relief raised -borderwidth 2 -background #b2dfee
    .t.t tag configure r2 -relief raised -borderwidth 2 -background #b2dfee \
	    -offset 2
    .t.t tag configure s1 -relief sunken -borderwidth 2 -background #b2dfee
} else {
    .t.t tag configure r1 -relief raised -borderwidth 2 -background white
    .t.t tag configure r2 -relief raised -borderwidth 2 -background white \
	    -offset 2
    .t.t tag configure s1 -relief sunken -borderwidth 2 -background white
}
.t.t tag configure indent1 -lmargin1 100
.t.t tag configure indent2 -lmargin1 200

.t.t insert end {This display contains a bunch of raised and sunken
regions to exercise the bevel-drawing facilities of
DisplayLineBackground.  The letters have the following
significance:

r - should appear raised
u - should appear raised and also slightly offset vertically
s - should appear sunken
S - should appear solid
n - preceding relief should extend right to end of line.
* - should appear "normal"
x - extra long lines to allow horizontal scrolling.

Try scrolling the text both vertically and horizontally to
be sure that the bevels are still drawn correctly.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Pass 1 (side bevels):

}
.t.t insert end ****
.t.t insert end rrrrrrr r1
.t.t insert end uuuu r2
.t.t insert end ************
.t.t insert end ssssssssssssssssss s1
.t.t insert end \n\n****************
.t.t insert end rrrrrrrrrrrrrrn\n r1

.t.t insert end "\nPass 2 (top bevels):\n\n"
.t.t insert end rrrrrrrrrrrrrr r1
.t.t insert end rrrrr {r1 dummy}
.t.t insert end rrrrrrrrrrrrrrrrrrr r1
.t.t insert end \n************
.t.t insert end rrrrrrrrrrrrrrrrr r1
.t.t insert end ***********\n
.t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r1
.t.t insert end \n\n***
.t.t insert end rrrrrrrrrrrrrrrrrrr r1
.t.t insert end ***********\n*
.t.t insert end rrrrrrrrr r1
.t.t insert end ********
.t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
.t.t insert end \n\n*
.t.t insert end *** dummy
.t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
.t.t insert end n\nrrrrrrrrrrrrrrr {r1 indent1}
.t.t insert end \n\n***
.t.t insert end rrr r1
.t.t insert end \n
.t.t insert end rrrr {r1 indent1}

.t.t insert end \n\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n
.t.t insert end "Pass 3 (bottom bevels):\n\n"
.t.t insert end *******
.t.t insert end ********** dummy
.t.t insert end rrrrrrrrrrrrrrrr r1
.t.t insert end **********\n
.t.t insert end rrrrrrrrr r1
.t.t insert end uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu r2
.t.t insert end \n********************
.t.t insert end rrrrrrrrrrrrrrr r1
.t.t insert end ************\n\n*
.t.t insert end rrrrrrrrrrrr r1
.t.t insert end ********
.t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
.t.t insert end \n*****
.t.t insert end rrrrrrrrrrrrrrrrrrrr r1
.t.t insert end **********\n\n
.t.t insert end rrrrrrrrrrrrrrr {r1 indent1}
.t.t insert end \n** dummy
.t.t insert end **
.t.t insert end rrrrrrrrrrrrrrrrrrrrn\n r1
.t.t insert end \n
.t.t insert end rrrr {r1 indent1}
.t.t insert end \n***
.t.t insert end rrr r1

.t.t insert end \n\nMiscellaneous:\n\n
.t.t insert end rrr r1
.t.t insert end *****
.t.t insert end rrr r1
foreach i {1 2 3} {
    .t.t insert end \n
    .t.t insert end ***
    .t.t insert end rrrrr r1
}
.t.t insert end \n
.t.t insert end rrr r1
.t.t insert end *****
.t.t insert end rrr r1

font configure TkFixedFont -size 20
.t.t tag configure sol100 -relief solid -borderwidth 100 \
                          -foreground red -font TkFixedFont
.t.t tag configure sol12 -relief solid -borderwidth 12 \
                          -foreground red -font TkFixedFont
.t.t tag configure big -font TkFixedFont
set ind [.t.t index end]

.t.t insert end "\n\nBorders do not leak on the neighbour chars"
.t.t insert end "\nOnly \"S\" is on dark background"
.t.t insert end {
 xxx
 x} {} S sol100 {x
 xxx}

.t.t insert end "\n\nA very thick border grows toward the inside of the tagged area only"
.t.t insert end "\nOnly \"S\" is on dark background"
.t.t insert end {
 xxxx} {} SSSSS sol100 {xxxx
 x} {} SSSSSSSSSSSSSSSSSS sol100 {x
 xxx} {} SSSSSSSSS sol100 xxxx {}

.t.t insert end "\n\nA thinner border is continuous"
.t.t insert end {
 xxxx} {} SSSSS sol12 {xxxx
 x} {} SSSSSSSSSSSSSSSSSS sol12 {x
 xxx} {} SSSSSSSSS sol12 xxxx {}

.t.t tag add big $ind end