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.
7 wm title .t "Visual Tests for Borders in Text Widgets"
8 wm iconname .t "Text Borders"
11 text .t.t -width 60 -height 30 -setgrid true -xscrollcommand {.t.h set} \
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
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 \
27 .t.t tag configure s1 -relief sunken -borderwidth 2 -background #b2dfee
29 .t.t tag configure r1 -relief raised -borderwidth 2 -background white
30 .t.t tag configure r2 -relief raised -borderwidth 2 -background white \
32 .t.t tag configure s1 -relief sunken -borderwidth 2 -background white
34 .t.t tag configure indent1 -lmargin1 100
35 .t.t tag configure indent2 -lmargin1 200
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
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.
50 Try scrolling the text both vertically and horizontally to
51 be sure that the bevels are still drawn correctly.
53 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
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
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
87 .t.t insert end rrrr {r1 indent1}
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
109 .t.t insert end rrrrrrrrrrrrrrrrrrrrn\n r1
111 .t.t insert end rrrr {r1 indent1}
112 .t.t insert end \n***
113 .t.t insert end rrr r1
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
122 .t.t insert end rrrrr r1
125 .t.t insert end rrr r1
126 .t.t insert end *****
127 .t.t insert end rrr r1
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]
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"
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"
147 xxxx} {} SSSSS sol100 {xxxx
148 x} {} SSSSSSSSSSSSSSSSSS sol100 {x
149 xxx} {} SSSSSSSSS sol100 xxxx {}
151 .t.t insert end "\n\nA thinner border is continuous"
153 xxxx} {} SSSSS sol12 {xxxx
154 x} {} SSSSSSSSSSSSSSSSSS sol12 {x
155 xxx} {} SSSSSSSSS sol12 xxxx {}
157 .t.t tag add big $ind end