OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / tests / bevel.tcl
1 # This file creates a visual test for bevels drawn around text in text
2 # widgets.  It is part of the Tk visual test suite, which is invoked
3 # via the "visual" script.
4
5 catch {destroy .t}
6 toplevel .t
7 wm title .t "Visual Tests for Borders in Text Widgets"
8 wm iconname .t "Text Borders"
9 wm geom .t +0+0
10
11 text .t.t -width 60 -height 30 -setgrid true -xscrollcommand {.t.h set} \
12         -font {Courier 12} \
13         -yscrollcommand {.t.v set} -wrap none -relief raised -bd 2
14 scrollbar .t.v -orient vertical -command ".t.t yview"
15 scrollbar .t.h -orient horizontal -command ".t.t xview"
16 button .t.quit -text Quit -command {destroy .t}
17 pack .t.quit -side bottom -pady 3 -ipadx 4 -ipady 2
18 pack .t.h -side bottom -fill x
19 pack .t.v -side right -fill y
20 pack .t.t -expand yes -fill both
21 wm minsize .t 1 1
22
23 if {[winfo depth .t] > 1} {
24     .t.t tag configure r1 -relief raised -borderwidth 2 -background #b2dfee
25     .t.t tag configure r2 -relief raised -borderwidth 2 -background #b2dfee \
26             -offset 2
27     .t.t tag configure s1 -relief sunken -borderwidth 2 -background #b2dfee
28 } else {
29     .t.t tag configure r1 -relief raised -borderwidth 2 -background white
30     .t.t tag configure r2 -relief raised -borderwidth 2 -background white \
31             -offset 2
32     .t.t tag configure s1 -relief sunken -borderwidth 2 -background white
33 }
34 .t.t tag configure indent1 -lmargin1 100
35 .t.t tag configure indent2 -lmargin1 200
36
37 .t.t insert end {This display contains a bunch of raised and sunken
38 regions to exercise the bevel-drawing facilities of
39 DisplayLineBackground.  The letters have the following
40 significance:
41
42 r - should appear raised
43 u - should appear raised and also slightly offset vertically
44 s - should appear sunken
45 S - should appear solid
46 n - preceding relief should extend right to end of line.
47 * - should appear "normal"
48 x - extra long lines to allow horizontal scrolling.
49
50 Try scrolling the text both vertically and horizontally to
51 be sure that the bevels are still drawn correctly.
52
53 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
54
55 Pass 1 (side bevels):
56
57 }
58 .t.t insert end ****
59 .t.t insert end rrrrrrr r1
60 .t.t insert end uuuu r2
61 .t.t insert end ************
62 .t.t insert end ssssssssssssssssss s1
63 .t.t insert end \n\n****************
64 .t.t insert end rrrrrrrrrrrrrrn\n r1
65
66 .t.t insert end "\nPass 2 (top bevels):\n\n"
67 .t.t insert end rrrrrrrrrrrrrr r1
68 .t.t insert end rrrrr {r1 dummy}
69 .t.t insert end rrrrrrrrrrrrrrrrrrr r1
70 .t.t insert end \n************
71 .t.t insert end rrrrrrrrrrrrrrrrr r1
72 .t.t insert end ***********\n
73 .t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r1
74 .t.t insert end \n\n***
75 .t.t insert end rrrrrrrrrrrrrrrrrrr r1
76 .t.t insert end ***********\n*
77 .t.t insert end rrrrrrrrr r1
78 .t.t insert end ********
79 .t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
80 .t.t insert end \n\n*
81 .t.t insert end *** dummy
82 .t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
83 .t.t insert end n\nrrrrrrrrrrrrrrr {r1 indent1}
84 .t.t insert end \n\n***
85 .t.t insert end rrr r1
86 .t.t insert end \n
87 .t.t insert end rrrr {r1 indent1}
88
89 .t.t insert end \n\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n
90 .t.t insert end "Pass 3 (bottom bevels):\n\n"
91 .t.t insert end *******
92 .t.t insert end ********** dummy
93 .t.t insert end rrrrrrrrrrrrrrrr r1
94 .t.t insert end **********\n
95 .t.t insert end rrrrrrrrr r1
96 .t.t insert end uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu r2
97 .t.t insert end \n********************
98 .t.t insert end rrrrrrrrrrrrrrr r1
99 .t.t insert end ************\n\n*
100 .t.t insert end rrrrrrrrrrrr r1
101 .t.t insert end ********
102 .t.t insert end rrrrrrrrrrrrrrrrrrrrrrrrr r1
103 .t.t insert end \n*****
104 .t.t insert end rrrrrrrrrrrrrrrrrrrr r1
105 .t.t insert end **********\n\n
106 .t.t insert end rrrrrrrrrrrrrrr {r1 indent1}
107 .t.t insert end \n** dummy
108 .t.t insert end **
109 .t.t insert end rrrrrrrrrrrrrrrrrrrrn\n r1
110 .t.t insert end \n
111 .t.t insert end rrrr {r1 indent1}
112 .t.t insert end \n***
113 .t.t insert end rrr r1
114
115 .t.t insert end \n\nMiscellaneous:\n\n
116 .t.t insert end rrr r1
117 .t.t insert end *****
118 .t.t insert end rrr r1
119 foreach i {1 2 3} {
120     .t.t insert end \n
121     .t.t insert end ***
122     .t.t insert end rrrrr r1
123 }
124 .t.t insert end \n
125 .t.t insert end rrr r1
126 .t.t insert end *****
127 .t.t insert end rrr r1
128
129 font configure TkFixedFont -size 20
130 .t.t tag configure sol100 -relief solid -borderwidth 100 \
131                           -foreground red -font TkFixedFont
132 .t.t tag configure sol12 -relief solid -borderwidth 12 \
133                           -foreground red -font TkFixedFont
134 .t.t tag configure big -font TkFixedFont
135 set ind [.t.t index end]
136
137 .t.t insert end "\n\nBorders do not leak on the neighbour chars"
138 .t.t insert end "\nOnly \"S\" is on dark background"
139 .t.t insert end {
140  xxx
141  x} {} S sol100 {x
142  xxx}
143
144 .t.t insert end "\n\nA very thick border grows toward the inside of the tagged area only"
145 .t.t insert end "\nOnly \"S\" is on dark background"
146 .t.t insert end {
147  xxxx} {} SSSSS sol100 {xxxx
148  x} {} SSSSSSSSSSSSSSSSSS sol100 {x
149  xxx} {} SSSSSSSSS sol100 xxxx {}
150
151 .t.t insert end "\n\nA thinner border is continuous"
152 .t.t insert end {
153  xxxx} {} SSSSS sol12 {xxxx
154  x} {} SSSSSSSSSSSSSSSSSS sol12 {x
155  xxx} {} SSSSSSSSS sol12 xxxx {}
156
157 .t.t tag add big $ind end
158