Check-in [5a8008f56a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge with trunk
Timelines: family | ancestors | descendants | both | wtf-8-experiment
Files: files | file ages | folders
SHA1: 5a8008f56a2902169d5918993bff2dc6a0eb1490
User & Date: chw 2019-06-07 04:37:17.850
Context
2019-06-09
14:01
merge with trunk check-in: 88028e3b04 user: chw tags: wtf-8-experiment
2019-06-07
04:37
merge with trunk check-in: 5a8008f56a user: chw tags: wtf-8-experiment
04:36
add tk upstream changes check-in: 14416fb071 user: chw tags: trunk
2019-06-01
19:50
merge with trunk check-in: 13d045d6bb user: chw tags: wtf-8-experiment
Changes
Unified Diff Ignore Whitespace Patch
Changes to jni/sdl2tk/library/demos/android_accel.tcl.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	return
    }
    if {![info exists ::pos(x)]} {
	set ::pos(x) [expr [winfo width $canvas] / 4]
	set ::pos(y) [expr [winfo height $canvas] / 4]
	set ::pos(t) 0
    }
    set ::pos(x) [expr {$::pos(x) + $ix}] 
    set ::pos(y) [expr {$::pos(y) + $iy}] 
    if {$::pos(x) < 50} {
	set ::pos(x) 50
    } elseif {$::pos(x) > [winfo width $canvas] - 50} {
	set ::pos(x) [expr {[winfo width $canvas] - 50}]
    }
    if {$::pos(y) < 50} {
	set ::pos(y) 50







|
|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	return
    }
    if {![info exists ::pos(x)]} {
	set ::pos(x) [expr [winfo width $canvas] / 4]
	set ::pos(y) [expr [winfo height $canvas] / 4]
	set ::pos(t) 0
    }
    set ::pos(x) [expr {$::pos(x) + $ix}]
    set ::pos(y) [expr {$::pos(y) + $iy}]
    if {$::pos(x) < 50} {
	set ::pos(x) 50
    } elseif {$::pos(x) > [winfo width $canvas] - 50} {
	set ::pos(x) [expr {[winfo width $canvas] - 50}]
    }
    if {$::pos(y) < 50} {
	set ::pos(y) 50
Changes to jni/sdl2tk/library/demos/android_eliza.tcl.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

proc makedict {input} {
    variable dict {}
    set phraselist \
	[split [string map {\n.\n \uffff \n!\n \uffff} $input] \uffff]
    set index 0
    # Kick off the loop by grabbing the first keywords
    set phraselist [lassign $phraselist keywords responses] 
    while {$keywords ne ""} {
        dict set dict keywords $index [split $keywords \n] 
        dict set dict responses $index [split $responses \n]
        incr  index
        set phraselist [lassign $phraselist keywords responses] 
    }
}

proc dialog {} {
    . configure -bg black
    wm attributes . -fullscreen 1
    sdltk screensaver off







|

|


|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

proc makedict {input} {
    variable dict {}
    set phraselist \
	[split [string map {\n.\n \uffff \n!\n \uffff} $input] \uffff]
    set index 0
    # Kick off the loop by grabbing the first keywords
    set phraselist [lassign $phraselist keywords responses]
    while {$keywords ne ""} {
        dict set dict keywords $index [split $keywords \n]
        dict set dict responses $index [split $responses \n]
        incr  index
        set phraselist [lassign $phraselist keywords responses]
    }
}

proc dialog {} {
    . configure -bg black
    wm attributes . -fullscreen 1
    sdltk screensaver off
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
                set which [expr {int ([llength $possibleresponses] * rand())}]
                set response [lindex $possibleresponses $which]
                if {[string index $response end] eq "*"} {
                    return "[string range $response 0 end-1]$remainder?"
                } else {
                    return $response
                }
                
            }
        }
    }
    set index [expr {[llength [dict get $dict keywords]] / 2 - 1}]
    set possibleresponses [dict get $dict responses $index]
    set which [expr {int ([llength $possibleresponses] * rand())}]
    return [lindex $possibleresponses $which]







<







323
324
325
326
327
328
329

330
331
332
333
334
335
336
                set which [expr {int ([llength $possibleresponses] * rand())}]
                set response [lindex $possibleresponses $which]
                if {[string index $response end] eq "*"} {
                    return "[string range $response 0 end-1]$remainder?"
                } else {
                    return $response
                }

            }
        }
    }
    set index [expr {[llength [dict get $dict keywords]] / 2 - 1}]
    set possibleresponses [dict get $dict responses $index]
    set which [expr {int ([llength $possibleresponses] * rand())}]
    return [lindex $possibleresponses $which]
Changes to jni/sdl2tk/library/demos/android_gps.tcl.
167
168
169
170
171
172
173
174
175
176
177
178
179
canvas .c -bg black -bd 0 -highlightthickness 0
pack .c -side top -fill both -expand 1 -padx 0 -pady 0

make_items .c

bind all <Key-Break> exit

bind . <<LocationUpdate>> [list location_update .c] 
bind . <<GPSUpdate>> [list gps_update .c] 
bind . <<NMEAUpdate>> [list nmea_update .c]

change_rate .c








|
|




167
168
169
170
171
172
173
174
175
176
177
178
179
canvas .c -bg black -bd 0 -highlightthickness 0
pack .c -side top -fill both -expand 1 -padx 0 -pady 0

make_items .c

bind all <Key-Break> exit

bind . <<LocationUpdate>> [list location_update .c]
bind . <<GPSUpdate>> [list gps_update .c]
bind . <<NMEAUpdate>> [list nmea_update .c]

change_rate .c

Changes to jni/sdl2tk/library/demos/pendulum.tcl.
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
}
bind $w.c <ButtonRelease-1> {
    showPendulum %W at %x %y
    set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
}
bind $w.c <Configure> {
    %W coords plate 0 25 %w 25
    set home [expr %w/2]
    %W coords pivot [expr $home-5] 20 [expr $home+5] 30
}
bind $w.k <Configure> {
    set psh [expr %h/2]
    set psw [expr %w/2]
    %W coords x_axis 2 $psh [expr %w-2] $psh
    %W coords y_axis $psw [expr %h-2] $psw 2
    %W coords label_dtheta [expr $psw-4] 6
    %W coords label_theta [expr %w-6] [expr $psh+4]
}

# This procedure is the "business" part of the simulation that does
# simple numerical integration of the formula for a simple rotational
# pendulum.
proc recomputeAngle {} {
    global Theta dTheta pi length







|
|


|
|
|
|
|
|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
}
bind $w.c <ButtonRelease-1> {
    showPendulum %W at %x %y
    set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
}
bind $w.c <Configure> {
    %W coords plate 0 25 %w 25
    set home [expr {%w/2}]
    %W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30
}
bind $w.k <Configure> {
    set psh [expr {%h/2}]
    set psw [expr {%w/2}]
    %W coords x_axis 2 $psh [expr {%w-2}] $psh
    %W coords y_axis $psw [expr {%h-2}] $psw 2
    %W coords label_dtheta [expr {$psw-4}] 6
    %W coords label_theta [expr {%w-6}] [expr {$psh+4}]
}

# This procedure is the "business" part of the simulation that does
# simple numerical integration of the formula for a simple rotational
# pendulum.
proc recomputeAngle {} {
    global Theta dTheta pi length
Changes to jni/sdl2tk/library/demos/square.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
bind .s a animate
focus .s

# The procedure below centers the square on a given position.

proc center {x y} {
    set a [.s size]
    .s position [expr $x-($a/2)] [expr $y-($a/2)]
}

# The procedures below provide a simple form of animation where
# the box changes size in a pulsing pattern: larger, smaller, larger,
# and so on.

set inc 0







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
bind .s a animate
focus .s

# The procedure below centers the square on a given position.

proc center {x y} {
    set a [.s size]
    .s position [expr {$x-($a/2)}] [expr {$y-($a/2)}]
}

# The procedures below provide a simple form of animation where
# the box changes size in a pulsing pattern: larger, smaller, larger,
# and so on.

set inc 0
Changes to jni/sdl2tk/library/demos/wintouch.tcl.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

    gesture <type> : Where type is one of:
      zoom : Zoom gesture. %x/y is between fingers
      pan  : Pan gesture. %x/y is between fingers
      rotate : Rotate gesture. %x/y is between fingers
      twofingertap : Two finger tap gesture. %x/y is between fingers
      pressandtap : Press and tap gesture. %x/y is first finger
    
    distance <i> : For zoom/pan/twofingertap: Distance between fingers.
    angle <r> : For rotate: Rotation angle in radians.
    deltax <i> : For pressandtap: Locates second finger. Valid with begin.
    deltay <i> : For pressandtap: Locates second finger. Valid with begin.
    inertiax <i> : For pan: Inertia vector. Valid with inertia flag.
    inertiay <i> : For pan: Inertia vector. Valid with inertia flag.








|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

    gesture <type> : Where type is one of:
      zoom : Zoom gesture. %x/y is between fingers
      pan  : Pan gesture. %x/y is between fingers
      rotate : Rotate gesture. %x/y is between fingers
      twofingertap : Two finger tap gesture. %x/y is between fingers
      pressandtap : Press and tap gesture. %x/y is first finger

    distance <i> : For zoom/pan/twofingertap: Distance between fingers.
    angle <r> : For rotate: Rotation angle in radians.
    deltax <i> : For pressandtap: Locates second finger. Valid with begin.
    deltay <i> : For pressandtap: Locates second finger. Valid with begin.
    inertiax <i> : For pan: Inertia vector. Valid with inertia flag.
    inertiay <i> : For pan: Inertia vector. Valid with inertia flag.

Changes to jni/sdl2tk/macosx/README.
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

- Another command available in the tk::unsupported::MacWindowStyle namespace is:
  tk::unsupported::MacWindowStyle tabbingid window ?newId?
which can be used to get or set the tabbingIdentifier for the NSWindow
associated with a Tk Window.  See section 3 for details.

- The command:
  tk::unsupported::MacWindowStyle appearance window ?newAappearance?
is available when Tk is built and run on macOS 10.14 (Mojave) or later.  In
that case the Ttk widgets all support the "Dark Mode" appearance which was
introduced in 10.14. The command accepts the following values for the optional
newAppearance option: "aqua", "darkaqua", or "auto".  If the appearance is set
to aqua or darkaqua then the window will be displayed with the corresponding
appearance independent of any preferences settings.  If it is set to "auto"
the appearance will be determined by the preferences.  This command can be







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

- Another command available in the tk::unsupported::MacWindowStyle namespace is:
  tk::unsupported::MacWindowStyle tabbingid window ?newId?
which can be used to get or set the tabbingIdentifier for the NSWindow
associated with a Tk Window.  See section 3 for details.

- The command:
  tk::unsupported::MacWindowStyle appearance window ?newAppearance?
is available when Tk is built and run on macOS 10.14 (Mojave) or later.  In
that case the Ttk widgets all support the "Dark Mode" appearance which was
introduced in 10.14. The command accepts the following values for the optional
newAppearance option: "aqua", "darkaqua", or "auto".  If the appearance is set
to aqua or darkaqua then the window will be displayed with the corresponding
appearance independent of any preferences settings.  If it is set to "auto"
the appearance will be determined by the preferences.  This command can be
Changes to jni/sdl2tk/macosx/tkMacOSXMouseEvent.c.
49
50
51
52
53
54
55

56
57
58
59
60
61
62
@implementation TKApplication(TKMouseEvent)
- (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
{
    NSWindow *eventWindow = [theEvent window];
    NSEventType eventType = [theEvent type];
    TkWindow *winPtr, *grabWinPtr;
    Tk_Window tkwin;

#if 0
    NSTrackingArea *trackingArea = nil;
    NSInteger eventNumber, clickCount, buttonNumber;
#endif

#ifdef TK_MAC_DEBUG_EVENTS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);







>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@implementation TKApplication(TKMouseEvent)
- (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
{
    NSWindow *eventWindow = [theEvent window];
    NSEventType eventType = [theEvent type];
    TkWindow *winPtr, *grabWinPtr;
    Tk_Window tkwin;
    NSPoint local, global;
#if 0
    NSTrackingArea *trackingArea = nil;
    NSInteger eventNumber, clickCount, buttonNumber;
#endif

#ifdef TK_MAC_DEBUG_EVENTS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
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
    case NSTabletProximity:
    case NSScrollWheel:
	break;
    default: /* Unrecognized mouse event. */
	return theEvent;
    }

    /*
     * Remember the window in case we need it next time.
     */

    if (eventWindow && eventWindow != _windowWithMouse) {
	if (_windowWithMouse) {
	    [_windowWithMouse release];
	}
	_windowWithMouse = eventWindow;
	[_windowWithMouse retain];
    }

    /*
     * Compute the mouse position in Tk screen coordinates (global) and in the
     * Tk coordinates of its containing Tk Window.

     */


    NSPoint global, local = [theEvent locationInWindow];

    /*


     * If the event has no NSWindow, try using the cached NSWindow from the
     * last mouse event.
     */

    if (eventWindow == NULL) {
	eventWindow = _windowWithMouse;


    }
    if (eventWindow) {
	/*
	 * Set the local mouse position to its NSWindow flipped coordinates,
	 * with the origin at top left, and the global mouse position to the
	 * flipped screen coordinates.
	 */

	global = [eventWindow tkConvertPointToScreen: local];
	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;
    } else {

	/*
	 * As a last resort, with no NSWindow to work with, set both local and
	 * global to the screen coordinates.
	 */














	local.y = tkMacOSXZeroScreenHeight - local.y;
	global = local;
    }

    /*
     * Find the toplevel which corresponds to the event NSWindow.
     */


    winPtr = TkMacOSXGetTkWindow(eventWindow);
    if (winPtr == NULL) {
	tkwin = TkMacOSXGetCapture();
	winPtr = (TkWindow *) tkwin;
    } else {
	tkwin = (Tk_Window) winPtr;
    }
    if (!tkwin) {
#ifdef TK_MAC_DEBUG_EVENTS
	TkMacOSXDbgMsg("tkwin == NULL");
#endif
	return theEvent;	/* Give up.  No window for this event. */








<
<
<
<
<
<
<
<
<
<
<
<

|
>


>
|
|
<
>
>
|
<
<
|
|
|
>
>
|
<
<
<
<
<
<
|
<



>

<
|


>
>
>
>
>
>
>
>
>
>
>
>
>
|
<



|


>
|
<
<
<
<







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
    case NSTabletProximity:
    case NSScrollWheel:
	break;
    default: /* Unrecognized mouse event. */
	return theEvent;
    }

    /*












     * Compute the mouse position in Tk screen coordinates (global) and in the
     * Tk coordinates of its containing Tk Window (local). If a grab is in effect,
     * the local coordinates should be relative to the grab window.
     */

    if (eventWindow) {
	local = [theEvent locationInWindow];
	global = [eventWindow tkConvertPointToScreen: local];

	tkwin = TkMacOSXGetCapture();
	if (tkwin) {
	    winPtr = (TkWindow *) tkwin;


	    eventWindow = TkMacOSXDrawableWindow(winPtr->window);
	    if (eventWindow) {
		local = [eventWindow tkConvertPointFromScreen: global];
	    } else {
		return theEvent;
	    }






	}

	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;
    } else {

	/*

	 * If the event has no NSWindow, the location is in screen coordinates.
	 */

	global = [theEvent locationInWindow];
	tkwin = TkMacOSXGetCapture();
	if (tkwin) {
	    winPtr = (TkWindow *) tkwin;
	    eventWindow = TkMacOSXDrawableWindow(winPtr->window);
	} else {
	    eventWindow = [NSApp mainWindow];
	}
	if (!eventWindow) {
	    return theEvent;
	}
	local = [eventWindow tkConvertPointFromScreen: global];
	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;

    }

    /*
     * Make sure tkwin is the toplevel which should receive the event.
     */

    if (!tkwin) {
	winPtr = TkMacOSXGetTkWindow(eventWindow);




	tkwin = (Tk_Window) winPtr;
    }
    if (!tkwin) {
#ifdef TK_MAC_DEBUG_EVENTS
	TkMacOSXDbgMsg("tkwin == NULL");
#endif
	return theEvent;	/* Give up.  No window for this event. */
Changes to jni/sdl2tk/macosx/tkMacOSXPrivate.h.
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
@interface TKApplication : NSApplication {
@private
    Tcl_Interp *_eventInterp;
    NSMenu *_servicesMenu;
    TKMenu *_defaultMainMenu, *_defaultApplicationMenu;
    NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems;
    NSArray *_defaultHelpMenuItems;
    NSWindow *_windowWithMouse;
    NSAutoreleasePool *_mainPool;
#ifdef __i386__
    /* The Objective C runtime used on i386 requires this. */
    int _poolLock;
    int _macMinorVersion;
    Bool _isDrawing;
#endif







<







259
260
261
262
263
264
265

266
267
268
269
270
271
272
@interface TKApplication : NSApplication {
@private
    Tcl_Interp *_eventInterp;
    NSMenu *_servicesMenu;
    TKMenu *_defaultMainMenu, *_defaultApplicationMenu;
    NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems;
    NSArray *_defaultHelpMenuItems;

    NSAutoreleasePool *_mainPool;
#ifdef __i386__
    /* The Objective C runtime used on i386 requires this. */
    int _poolLock;
    int _macMinorVersion;
    Bool _isDrawing;
#endif
Changes to jni/sdl2tk/macosx/tkMacOSXWindowEvent.c.
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w);
#endif
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);

    if (winPtr) {
	TkGenWMDestroyEvent((Tk_Window) winPtr);
	if (_windowWithMouse == w) {
	    _windowWithMouse = nil;
	    [w release];
	}
    }

    /*
     * If necessary, TkGenWMDestroyEvent() handles [close]ing the window, so
     * can always return NO from -windowShouldClose: for a Tk window.
     */








<
<
<
<







194
195
196
197
198
199
200




201
202
203
204
205
206
207
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w);
#endif
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);

    if (winPtr) {
	TkGenWMDestroyEvent((Tk_Window) winPtr);




    }

    /*
     * If necessary, TkGenWMDestroyEvent() handles [close]ing the window, so
     * can always return NO from -windowShouldClose: for a Tk window.
     */

Changes to jni/sdl2tk/macosx/tkMacOSXWm.c.
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    return [self convertScreenToBase:point];
}
#else
- (NSPoint) tkConvertPointToScreen: (NSPoint) point
{
    NSRect pointrect;
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectToScreen:pointrect].origin;
}
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    NSRect pointrect;
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectFromScreen:pointrect].origin;
}
#endif

@end

#pragma mark -







|
<
<
<




|
<
<
<







337
338
339
340
341
342
343
344



345
346
347
348
349



350
351
352
353
354
355
356
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    return [self convertScreenToBase:point];
}
#else
- (NSPoint) tkConvertPointToScreen: (NSPoint) point
{
    NSRect pointrect = {point, {0,0}};



    return [self convertRectToScreen:pointrect].origin;
}
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    NSRect pointrect = {point, {0,0}};



    return [self convertRectFromScreen:pointrect].origin;
}
#endif

@end

#pragma mark -
Changes to jni/sdl2tk/macosx/ttkMacOSXTheme.c.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
static CGFloat darkInactiveSelectedTab[4] = {
    159.0 / 255, 160.0 / 255, 161.0 / 255, 1.0
};
static CGFloat darkFocusRing[4] = {
    38.0 / 255, 113.0 / 255, 159.0 / 255, 1.0
};
static CGFloat darkFocusRingTop[4] = {
    50.0 / 255, 124.0 / 255, 171.0 / 255, 1.0 
};
static CGFloat darkFocusRingBottom[4] = {
    57.0 / 255, 130.0 / 255, 176.0 / 255, 1.0 
};
static CGFloat darkTabSeparator[4] = {0.0, 0.0, 0.0, 0.25};
static CGFloat darkTrack[4] = {1.0, 1.0, 1.0, 0.25};
static CGFloat darkFrameTop[4] = {1.0, 1.0, 1.0, 0.0625};
static CGFloat darkFrameBottom[4] = {1.0, 1.0, 1.0, 0.125};
static CGFloat darkFrameAccent[4] = {0.0, 0.0, 0.0, 0.0625};
static CGFloat darkTopGradient[8] = {







|


|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
static CGFloat darkInactiveSelectedTab[4] = {
    159.0 / 255, 160.0 / 255, 161.0 / 255, 1.0
};
static CGFloat darkFocusRing[4] = {
    38.0 / 255, 113.0 / 255, 159.0 / 255, 1.0
};
static CGFloat darkFocusRingTop[4] = {
    50.0 / 255, 124.0 / 255, 171.0 / 255, 1.0
};
static CGFloat darkFocusRingBottom[4] = {
    57.0 / 255, 130.0 / 255, 176.0 / 255, 1.0
};
static CGFloat darkTabSeparator[4] = {0.0, 0.0, 0.0, 0.25};
static CGFloat darkTrack[4] = {1.0, 1.0, 1.0, 0.25};
static CGFloat darkFrameTop[4] = {1.0, 1.0, 1.0, 0.0625};
static CGFloat darkFrameBottom[4] = {1.0, 1.0, 1.0, 0.125};
static CGFloat darkFrameAccent[4] = {0.0, 0.0, 0.0, 0.0625};
static CGFloat darkTopGradient[8] = {
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
    CGFloat x = bounds.origin.x, y = bounds.origin.y;
    CGFloat w = bounds.size.width, h = bounds.size.height;
    CGPoint topPart[4] = {
	{x, y + h}, {x, y + 1}, {x + w - 1, y + 1}, {x + w - 1, y + h}
    };
    CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
    CGRect outerRect = CGRectInset(bounds, -3, -3);
    
    CGContextSaveGState(context);
    CGContextSetShouldAntialias(context, false);
    CGContextBeginPath(context);
    strokeColor = [NSColor colorWithColorSpace: deviceRGB
				    components: darkFocusRingTop
					 count: 4];
    CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor));







|







1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
    CGFloat x = bounds.origin.x, y = bounds.origin.y;
    CGFloat w = bounds.size.width, h = bounds.size.height;
    CGPoint topPart[4] = {
	{x, y + h}, {x, y + 1}, {x + w - 1, y + 1}, {x + w - 1, y + h}
    };
    CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
    CGRect outerRect = CGRectInset(bounds, -3, -3);

    CGContextSaveGState(context);
    CGContextSetShouldAntialias(context, false);
    CGContextBeginPath(context);
    strokeColor = [NSColor colorWithColorSpace: deviceRGB
				    components: darkFocusRingTop
					 count: 4];
    CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor));
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
    static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND;

    if (TkMacOSXInDarkMode(tkwin)) {
	BEGIN_DRAWING(d)
	NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
	CGFloat fill[4];
	GetBackgroundColor(dc.context, tkwin, 1, fill);
	
	/*
	 * Lighten the background to provide contrast.
	 */
	
	for (int i = 0; i < 3; i++) {
		fill[i] += 9.0 / 255.0;
	}
	background = [NSColor colorWithColorSpace: deviceRGB
	    components: fill
	    count: 4];
	CGContextSetFillColorWithColor(dc.context, CGCOLOR(background));







|



|







1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
    static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND;

    if (TkMacOSXInDarkMode(tkwin)) {
	BEGIN_DRAWING(d)
	NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
	CGFloat fill[4];
	GetBackgroundColor(dc.context, tkwin, 1, fill);

	/*
	 * Lighten the background to provide contrast.
	 */

	for (int i = 0; i < 3; i++) {
		fill[i] += 9.0 / 255.0;
	}
	background = [NSColor colorWithColorSpace: deviceRGB
	    components: fill
	    count: 4];
	CGContextSetFillColorWithColor(dc.context, CGCOLOR(background));
Changes to jni/sdl2tk/tests/arc.tcl.
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

bind .t.c <Shift-1> {
    set curx %x
    set cury %y
}

bind .t.c <Shift-B1-Motion> {
    .t.c move circle [expr %x-$curx] [expr %y-$cury]
    set curx %x
    set cury %y
}

# The binding below flashes the closest item to the mouse.

bind .t.c <Control-c> {







|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

bind .t.c <Shift-1> {
    set curx %x
    set cury %y
}

bind .t.c <Shift-B1-Motion> {
    .t.c move circle [expr {%x-$curx}] [expr {%y-$cury}]
    set curx %x
    set cury %y
}

# The binding below flashes the closest item to the mouse.

bind .t.c <Control-c> {
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
	    set delta -5
	}
	if {$i <= 5} {
	    set delta 5
	}
	incr i $delta
	c -start $i
	c -extent [expr 360-2*$i]
	after 20
	update
    }
}

bind .t.c b {set go 0}








|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
	    set delta -5
	}
	if {$i <= 5} {
	    set delta 5
	}
	incr i $delta
	c -start $i
	c -extent [expr {360-2*$i}]
	after 20
	update
    }
}

bind .t.c b {set go 0}

Changes to jni/sdl2tk/tests/button.test.
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
    # 1. button with text
    .b configure -text "Sample text"
    pack .b
    set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]]
    set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    set result [expr $expectedwidth == [winfo reqwidth .b]]
    set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5]
    set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedheight == [winfo reqheight .b]]
    # 2. button with a bitmap image
    # there is no access to characteristics the predefined bitmaps,
    # so define one as an image (copied from questhead.xbm)
    set myquesthead [image create bitmap -data {
        #define myquesthead_width 20
        #define myquesthead_height 22
        static unsigned char myquesthead_bits[] = {
           0xf8, 0x1f, 0x00, 0xac, 0x2a, 0x00, 0x56, 0x55, 0x00, 0xeb, 0xaf, 0x00,
           0xf5, 0x5f, 0x01, 0xfb, 0xbf, 0x00, 0x75, 0x5d, 0x01, 0xfb, 0xbe, 0x02,
           0x75, 0x5d, 0x05, 0xab, 0xbe, 0x0a, 0x55, 0x5f, 0x07, 0xab, 0xaf, 0x00,
           0xd6, 0x57, 0x01, 0xac, 0xab, 0x00, 0xd8, 0x57, 0x00, 0xb0, 0xaa, 0x00,
           0x50, 0x55, 0x00, 0xb0, 0x0b, 0x00, 0xd0, 0x17, 0x00, 0xb0, 0x0b, 0x00,
           0x58, 0x15, 0x00, 0xa8, 0x2a, 0x00};
    }]
    .b configure -image $myquesthead
    set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedwidth == [winfo reqwidth .b]]
    set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedheight == [winfo reqheight .b]]
} -cleanup {
    destroy .b
} -result {1 1 1 1}

test button-5.25 {ConfigureButton - computing geometry} -setup {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
} -body {







|




|


















|



|







3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
    # 1. button with text
    .b configure -text "Sample text"
    pack .b
    set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]]
    set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    set result [expr {$expectedwidth == [winfo reqwidth .b]}]
    set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5]
    set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr {$expectedheight == [winfo reqheight .b]}]
    # 2. button with a bitmap image
    # there is no access to characteristics the predefined bitmaps,
    # so define one as an image (copied from questhead.xbm)
    set myquesthead [image create bitmap -data {
        #define myquesthead_width 20
        #define myquesthead_height 22
        static unsigned char myquesthead_bits[] = {
           0xf8, 0x1f, 0x00, 0xac, 0x2a, 0x00, 0x56, 0x55, 0x00, 0xeb, 0xaf, 0x00,
           0xf5, 0x5f, 0x01, 0xfb, 0xbf, 0x00, 0x75, 0x5d, 0x01, 0xfb, 0xbe, 0x02,
           0x75, 0x5d, 0x05, 0xab, 0xbe, 0x0a, 0x55, 0x5f, 0x07, 0xab, 0xaf, 0x00,
           0xd6, 0x57, 0x01, 0xac, 0xab, 0x00, 0xd8, 0x57, 0x00, 0xb0, 0xaa, 0x00,
           0x50, 0x55, 0x00, 0xb0, 0x0b, 0x00, 0xd0, 0x17, 0x00, 0xb0, 0x0b, 0x00,
           0x58, 0x15, 0x00, 0xa8, 0x2a, 0x00};
    }]
    .b configure -image $myquesthead
    set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr {$expectedwidth == [winfo reqwidth .b]}]
    set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr {$expectedheight == [winfo reqheight .b]}]
} -cleanup {
    destroy .b
} -result {1 1 1 1}

test button-5.25 {ConfigureButton - computing geometry} -setup {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
} -body {
Changes to jni/sdl2tk/tests/canvText.test.
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
    set ay [font metrics $font -linespace]
    set ax [font measure $font 0]
    .c create text 0 0 -tag test
    .c itemconfig test -font $font -text 0
    expr {[.c itemconfig test -anchor n; .c bbox test] \
	      eq "[expr -$ax/2-1] 0 [expr $ax/2+1] $ay"}
} -cleanup {
    .c delete test
} -result 1
test canvText-6.2 {ComputeTextBbox procedure} -constraints fonts -setup {
    .c delete test
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
    set ay [font metrics $font -linespace]
    set ax [font measure $font 0]
    .c create text 0 0 -tag test
    .c itemconfig test -font $font -text 0
    expr {[.c itemconfig test -anchor nw; .c bbox test] \
	      eq "-1 0 [expr $ax+1] $ay"}
} -cleanup {
    .c delete test
} -result 1
test canvText-6.3 {ComputeTextBbox procedure} -constraints fonts -setup {
    .c delete test
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"







|












|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
    set ay [font metrics $font -linespace]
    set ax [font measure $font 0]
    .c create text 0 0 -tag test
    .c itemconfig test -font $font -text 0
    expr {[.c itemconfig test -anchor n; .c bbox test] \
	      eq "[expr {-$ax/2-1}] 0 [expr {$ax/2+1}] $ay"}
} -cleanup {
    .c delete test
} -result 1
test canvText-6.2 {ComputeTextBbox procedure} -constraints fonts -setup {
    .c delete test
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
    set ay [font metrics $font -linespace]
    set ax [font measure $font 0]
    .c create text 0 0 -tag test
    .c itemconfig test -font $font -text 0
    expr {[.c itemconfig test -anchor nw; .c bbox test] \
	      eq "-1 0 [expr {$ax+1}] $ay"}
} -cleanup {
    .c delete test
} -result 1
test canvText-6.3 {ComputeTextBbox procedure} -constraints fonts -setup {
    .c delete test
} -body {
    set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
Changes to jni/sdl2tk/tests/canvas.test.
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    # With Tk 8.0.4 the ids are now stored in a hash table. You can use this
    # test as a performance test with older versions by changing the value of
    # size.
    set size 15
    for {set i 0} {$i < $size} {incr i} {
	set x [expr {-10 + 3*$i}]
	for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
	    .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
		    -outline black -fill blue -tags rect
	    .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
		    -anchor center -tags text
	}
    }
    # The actual bench mark - this code also exercises all the hash table
    # changes.
    set time [lindex [time {
	foreach id [.c find withtag all] {







|

|







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    # With Tk 8.0.4 the ids are now stored in a hash table. You can use this
    # test as a performance test with older versions by changing the value of
    # size.
    set size 15
    for {set i 0} {$i < $size} {incr i} {
	set x [expr {-10 + 3*$i}]
	for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
	    .c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \
		    -outline black -fill blue -tags rect
	    .c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \
		    -anchor center -tags text
	}
    }
    # The actual bench mark - this code also exercises all the hash table
    # changes.
    set time [lindex [time {
	foreach id [.c find withtag all] {
Changes to jni/sdl2tk/tests/cmap.tcl.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    set red 0
    set green 0
    set blue 0
    for {set y 0} {$y < 8} {incr y} {
	for {set x 0} {$x < 8} {incr x} {
	    frame $w.f$x,$y -width 40 -height 40 -bd 2 -relief raised \
		    -bg [format #%02x%02x%02x $red $green $blue]
	    place $w.f$x,$y -x [expr 40*$x] -y [expr 40*$y]
	    incr red $redInc
	    incr green $greenInc
	    incr blue $blueInc
	}
    }
}








|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    set red 0
    set green 0
    set blue 0
    for {set y 0} {$y < 8} {incr y} {
	for {set x 0} {$x < 8} {incr x} {
	    frame $w.f$x,$y -width 40 -height 40 -bd 2 -relief raised \
		    -bg [format #%02x%02x%02x $red $green $blue]
	    place $w.f$x,$y -x [expr {40*$x}] -y [expr {40*$y}]
	    incr red $redInc
	    incr green $greenInc
	    incr blue $blueInc
	}
    }
}

Changes to jni/sdl2tk/tests/image.test.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    testImageType
} -setup {
    imageCleanup
} -body {
    scan [image create test] image%d first
    image create test myimage
    scan [image create test -variable x] image%d second
    expr $second-$first
} -cleanup {
    imageCleanup
} -result {1}

test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints {
    testImageType
} -setup {







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    testImageType
} -setup {
    imageCleanup
} -body {
    scan [image create test] image%d first
    image create test myimage
    scan [image create test -variable x] image%d second
    expr {$second-$first}
} -cleanup {
    imageCleanup
} -result {1}

test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints {
    testImageType
} -setup {
Changes to jni/sdl2tk/tests/scrollbar.test.
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
    set scrollInfo $args
}

proc getTroughSize {w} {
    if {[testConstraint testmetrics]} {
        # Only Windows has [testmetrics]
	if [string match v* [$w cget -orient]] {
	    return [expr [winfo height $w] - 2*[testmetrics cyvscroll $w]]
	} else {
	    return [expr [winfo width $w] - 2*[testmetrics cxhscroll $w]]
	}
    } else {
        if {[tk windowingsystem] eq "x11"} {
            # Calculations here assume that the arrow area is a square.
	    if [string match v* [$w cget -orient]] {
	        return [expr [winfo height $w] \
		        - ([winfo width $w] \
			    - [$w cget -highlightthickness] \
			    - [$w cget -bd] + 1)*2]
	    } else {
	        return [expr [winfo width $w] \
		        - ([winfo height $w] \
			    - [$w cget -highlightthickness] \
			    - [$w cget -bd] + 1)*2]
	    }
        } else {
            # macOS aqua
	    if [string match v* [$w cget -orient]] {
	        return [expr [winfo height $w] \
			- ([$w cget -highlightthickness] \
			  +[$w cget -bd])*2]
	    } else {
	        return [expr [winfo width $w] \
			- ([$w cget -highlightthickness] \
			  +[$w cget -bd])*2]
	    }
        }
    }
}

# XXX Note: this test file is woefully incomplete.  Right now there are
# only bits and pieces of tests.  Please make this file more complete
# as you fix bugs and add features.

foreach {width height} [wm minsize .] {
    set height [expr ($height < 200) ? 200 : $height]
    set width [expr ($width < 1) ? 1 : $width]
}

frame .f -height $height -width $width
pack .f -side left
scrollbar .s
pack .s -side right -fill y
update







|

|





|


|

|


|




|

|

|

|










|
|







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
    set scrollInfo $args
}

proc getTroughSize {w} {
    if {[testConstraint testmetrics]} {
        # Only Windows has [testmetrics]
	if [string match v* [$w cget -orient]] {
	    return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}]
	} else {
	    return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}]
	}
    } else {
        if {[tk windowingsystem] eq "x11"} {
            # Calculations here assume that the arrow area is a square.
	    if [string match v* [$w cget -orient]] {
	        return [expr {[winfo height $w] \
		        - ([winfo width $w] \
			    - [$w cget -highlightthickness] \
			    - [$w cget -bd] + 1)*2}]
	    } else {
	        return [expr {[winfo width $w] \
		        - ([winfo height $w] \
			    - [$w cget -highlightthickness] \
			    - [$w cget -bd] + 1)*2}]
	    }
        } else {
            # macOS aqua
	    if [string match v* [$w cget -orient]] {
	        return [expr {[winfo height $w] \
			- ([$w cget -highlightthickness] \
			  +[$w cget -bd])*2}]
	    } else {
	        return [expr {[winfo width $w] \
			- ([$w cget -highlightthickness] \
			  +[$w cget -bd])*2}]
	    }
        }
    }
}

# XXX Note: this test file is woefully incomplete.  Right now there are
# only bits and pieces of tests.  Please make this file more complete
# as you fix bugs and add features.

foreach {width height} [wm minsize .] {
    set height [expr {($height < 200) ? 200 : $height}]
    set width [expr {($width < 1) ? 1 : $width}]
}

frame .f -height $height -width $width
pack .f -side left
scrollbar .s
pack .s -side right -fill y
update
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
    list [catch {.s delta 18 xxyz} msg] $msg
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 20 0]
} {0}
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 0 20]
} [format %.6g [expr 20.0/([getTroughSize .s]-1)]]
test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 0 -20]
} [format %.6g [expr -20.0/([getTroughSize .s]-1)]]
test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
    toplevel .t -width 250 -height 100
    wm geom .t +0+0
    scrollbar .t.s -orient horizontal -borderwidth 2
    place .t.s -width 201
    update
    set result [list [format {%.6g} [.t.s delta 0 20]] \
	    [format {%.6g} [.t.s delta [expr [getTroughSize .t.s] - 1] 0]]]
    destroy .t
    set result
} {0 1}
test scrollbar-3.29 {ScrollbarWidgetCmd procedure, "fraction" option} {
    list [catch {.s fraction 24} msg] $msg
} {1 {wrong # args: should be ".s fraction x y"}}
test scrollbar-3.30 {ScrollbarWidgetCmd procedure, "fraction" option} {







|


|







|







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
    list [catch {.s delta 18 xxyz} msg] $msg
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 20 0]
} {0}
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 0 20]
} [format %.6g [expr {20.0/([getTroughSize .s]-1)}]]
test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} {
    format {%.6g} [.s delta 0 -20]
} [format %.6g [expr {-20.0/([getTroughSize .s]-1)}]]
test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
    toplevel .t -width 250 -height 100
    wm geom .t +0+0
    scrollbar .t.s -orient horizontal -borderwidth 2
    place .t.s -width 201
    update
    set result [list [format {%.6g} [.t.s delta 0 20]] \
	    [format {%.6g} [.t.s delta [expr {[getTroughSize .t.s] - 1}] 0]]]
    destroy .t
    set result
} {0 1}
test scrollbar-3.29 {ScrollbarWidgetCmd procedure, "fraction" option} {
    list [catch {.s fraction 24} msg] $msg
} {1 {wrong # args: should be ".s fraction x y"}}
test scrollbar-3.30 {ScrollbarWidgetCmd procedure, "fraction" option} {
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    format {%.6g} [.s fraction 0 0]
} {0}
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.s fraction 0 1000]
} {1}
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.s fraction 4 21]
} [format %.6g [expr (21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
       /([getTroughSize .s] - 1)]]
test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
    format {%.6g} [.s fraction 4 179]
} {1}
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
    format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s]]]
} {1}
test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
    format {%.6g} [.s fraction 4 178]
} {0.993711}
test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
    expr \
    [format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]]] \
	== [format %g [expr (200.0 - [testmetrics cyvscroll .s]*2 - 2) \
			   / ($height - 1 - [testmetrics cyvscroll .s]*2)]]
} 1

toplevel .t -width 250 -height 100
wm geom .t +0+0
scrollbar .t.s -orient horizontal -borderwidth 2
place .t.s -width 201
update

test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.t.s fraction 100 0]
} {0.5}
if {[testConstraint testmetrics]} {
    # Only Windows has [testmetrics]
    place configure .t.s -width [expr 2*[testmetrics cxhscroll .t.s]+1]
} else {
    if {[tk windowingsystem] eq "x11"} {
        place configure .t.s -width [expr [winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)]
    } else {
        # macOS aqua
        place configure .t.s -width [expr 2*([.t.s cget -highlightthickness] + [.t.s cget -bd])]
    }
}
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.t.s fraction 100 0]
} {0}
destroy .t







|
|




|





|
|
|
|













|


|


|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    format {%.6g} [.s fraction 0 0]
} {0}
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.s fraction 0 1000]
} {1}
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.s fraction 4 21]
} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
       /([getTroughSize .s] - 1)}]]
test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
    format {%.6g} [.s fraction 4 179]
} {1}
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
    format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
} {1}
test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
    format {%.6g} [.s fraction 4 178]
} {0.993711}
test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
    expr {
    [format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s] - 2}]]]
	== [format %g [expr {(200.0 - [testmetrics cyvscroll .s]*2 - 2)
			   / ($height - 1 - [testmetrics cyvscroll .s]*2)}]]}
} 1

toplevel .t -width 250 -height 100
wm geom .t +0+0
scrollbar .t.s -orient horizontal -borderwidth 2
place .t.s -width 201
update

test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.t.s fraction 100 0]
} {0.5}
if {[testConstraint testmetrics]} {
    # Only Windows has [testmetrics]
    place configure .t.s -width [expr {2*[testmetrics cxhscroll .t.s]+1}]
} else {
    if {[tk windowingsystem] eq "x11"} {
        place configure .t.s -width [expr {[winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)}]
    } else {
        # macOS aqua
        place configure .t.s -width [expr {2*([.t.s cget -highlightthickness] + [.t.s cget -bd])}]
    }
}
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
    format {%.6g} [.t.s fraction 100 0]
} {0}
destroy .t
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
test scrollbar-6.4 {ScrollbarPosition procedure} unix {
    .s identify 3 100
} {}
test scrollbar-6.6 {ScrollbarPosition procedure} unix {
    .s identify 19 100
} {}
test scrollbar-6.7 {ScrollbarPosition procedure} {
    .s identify [expr [winfo width .s] / 2] -1
} {}
test scrollbar-6.8 {ScrollbarPosition procedure} {
    .s identify [expr [winfo width .s] / 2] [expr [winfo height .s]]
} {}
test scrollbar-6.9 {ScrollbarPosition procedure} {
    .s identify -1 [expr [winfo height .s] / 2]
} {}
test scrollbar-6.10 {ScrollbarPosition procedure} {
    .s identify [winfo width .s] [expr [winfo height .s] / 2]
} {}
test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 4
} {arrow1}
test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 4
} {trough1}
test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 19
} {arrow1}
test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 19
} {trough1}
test scrollbar-6.14 {ScrollbarPosition procedure} win {
    .s identify [expr [winfo width .s] / 2] 0
} {arrow1}
test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [expr [testmetrics cyvscroll .s] - 1]
} {arrow1}
test scrollbar-6.16 {ScrollbarPosition procedure} unix {
    .s identify 8 20
} {trough1}
test scrollbar-6.17 {ScrollbarPosition procedure} {unix nonPortable} {
    # Don't know why this is non-portable, but it doesn't work on
    # some platforms.
    .s identify 8 51
} {trough1}
test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [testmetrics cyvscroll .s]
} {trough1}
test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [expr int(.2 / [.s delta 0 1]) \
						+ [testmetrics cyvscroll .s] - 1]
} {trough1}
test scrollbar-6.20 {ScrollbarPosition procedure} unix {
    .s identify 8 52
} {slider}
test scrollbar-6.21 {ScrollbarPosition procedure} {unix nonPortable} {
    # Don't know why this is non-portable, but it doesn't work on
    # some platforms.
    .s identify 8 83
} {slider}
test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] \
	[expr int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]]
} {slider}
test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
						 + [testmetrics cyvscroll .s] - 1]
} {slider}
test scrollbar-6.24 {ScrollbarPosition procedure} unix {
    .s identify 8 84
} {trough2}
test scrollbar-6.25 {ScrollbarPosition procedure} unix {
    .s identify 8 179
} {trough2}
test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
						 + [testmetrics cyvscroll .s]]
} {trough2}
test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \
						 - [testmetrics cyvscroll .s] - 1]
} {trough2}
test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 180
} {arrow2}
test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 180
} {trough2}
test scrollbar-6.30.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 195
} {arrow2}
test scrollbar-6.30.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 195
} {trough2}
test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr [winfo width .s] / 2]  [expr [winfo height .s] \
						  - [testmetrics cyvscroll .s]]
} {arrow2}
test scrollbar-6.33 {ScrollbarPosition procedure} win {
    .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] - 1]
} {arrow2}
test scrollbar-6.34 {ScrollbarPosition procedure} unix {
    .s identify 4 100
} {trough2}
test scrollbar-6.35 {ScrollbarPosition procedure} unix {
    .s identify 18 100
} {trough2}
test scrollbar-6.37 {ScrollbarPosition procedure} win {
    .s identify 0 100
} {trough2}
test scrollbar-6.38 {ScrollbarPosition procedure} win {
    .s identify [expr [winfo width .s] - 1] 100
} {trough2}

catch {destroy .t}
toplevel .t -width 250 -height 150
wm geometry .t +0+0
scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2
place .t.s -width 200
.t.s set .2 .4
update

test scrollbar-6.39.1 {ScrollbarPosition procedure} x11 {
    .t.s identify 4 8
} {arrow1}
test scrollbar-6.39.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .t.s identify 4 8
} {trough1}
test scrollbar-6.40 {ScrollbarPosition procedure} win {
    .t.s identify 0 [expr [winfo height .t.s] / 2]
} {arrow1}
test scrollbar-6.41.1 {ScrollbarPosition procedure} x11 {
    .t.s identify 82 8
} {slider}
test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .t.s identify 82 8
} {trough2}
test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
    .t.s identify [expr int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] \
		       - 1] [expr [winfo height .t.s] / 2]
} {slider}
test scrollbar-6.44 {ScrollbarPosition procedure} unix {
    .t.s identify 100 18
} {trough2}
test scrollbar-6.46 {ScrollbarPosition procedure} win {
    .t.s identify 100 [expr [winfo height .t.s] - 1]
} {trough2}

test scrollbar-7.1 {EventuallyRedraw} {
    .s configure -orient horizontal
    update
    set result [.s cget -orient]
    .s configure -orient vertical







|


|


|


|
















|


|










|


|
|










|
|


|
|








|
|


|
|
















|
|


|











|


















|









|
|





|







469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
test scrollbar-6.4 {ScrollbarPosition procedure} unix {
    .s identify 3 100
} {}
test scrollbar-6.6 {ScrollbarPosition procedure} unix {
    .s identify 19 100
} {}
test scrollbar-6.7 {ScrollbarPosition procedure} {
    .s identify [expr {[winfo width .s] / 2}] -1
} {}
test scrollbar-6.8 {ScrollbarPosition procedure} {
    .s identify [expr {[winfo width .s] / 2}] [winfo height .s]
} {}
test scrollbar-6.9 {ScrollbarPosition procedure} {
    .s identify -1 [expr {[winfo height .s] / 2}]
} {}
test scrollbar-6.10 {ScrollbarPosition procedure} {
    .s identify [winfo width .s] [expr {[winfo height .s] / 2}]
} {}
test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 4
} {arrow1}
test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 4
} {trough1}
test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 19
} {arrow1}
test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 19
} {trough1}
test scrollbar-6.14 {ScrollbarPosition procedure} win {
    .s identify [expr {[winfo width .s] / 2}] 0
} {arrow1}
test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}]
} {arrow1}
test scrollbar-6.16 {ScrollbarPosition procedure} unix {
    .s identify 8 20
} {trough1}
test scrollbar-6.17 {ScrollbarPosition procedure} {unix nonPortable} {
    # Don't know why this is non-portable, but it doesn't work on
    # some platforms.
    .s identify 8 51
} {trough1}
test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [testmetrics cyvscroll .s]
} {trough1}
test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [expr {int(.2 / [.s delta 0 1])
						+ [testmetrics cyvscroll .s] - 1}]
} {trough1}
test scrollbar-6.20 {ScrollbarPosition procedure} unix {
    .s identify 8 52
} {slider}
test scrollbar-6.21 {ScrollbarPosition procedure} {unix nonPortable} {
    # Don't know why this is non-portable, but it doesn't work on
    # some platforms.
    .s identify 8 83
} {slider}
test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] \
	[expr {int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]}]
} {slider}
test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1])
						 + [testmetrics cyvscroll .s] - 1}]
} {slider}
test scrollbar-6.24 {ScrollbarPosition procedure} unix {
    .s identify 8 84
} {trough2}
test scrollbar-6.25 {ScrollbarPosition procedure} unix {
    .s identify 8 179
} {trough2}
test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1])
						 + [testmetrics cyvscroll .s]}]
} {trough2}
test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s]
						 - [testmetrics cyvscroll .s] - 1}]
} {trough2}
test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 180
} {arrow2}
test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 180
} {trough2}
test scrollbar-6.30.1 {ScrollbarPosition procedure} x11 {
    .s identify 8 195
} {arrow2}
test scrollbar-6.30.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .s identify 8 195
} {trough2}
test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} {
    .s identify [expr {[winfo width .s] / 2}]  [expr {[winfo height .s]
						  - [testmetrics cyvscroll .s]}]
} {arrow2}
test scrollbar-6.33 {ScrollbarPosition procedure} win {
    .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - 1}]
} {arrow2}
test scrollbar-6.34 {ScrollbarPosition procedure} unix {
    .s identify 4 100
} {trough2}
test scrollbar-6.35 {ScrollbarPosition procedure} unix {
    .s identify 18 100
} {trough2}
test scrollbar-6.37 {ScrollbarPosition procedure} win {
    .s identify 0 100
} {trough2}
test scrollbar-6.38 {ScrollbarPosition procedure} win {
    .s identify [expr {[winfo width .s] - 1}] 100
} {trough2}

catch {destroy .t}
toplevel .t -width 250 -height 150
wm geometry .t +0+0
scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2
place .t.s -width 200
.t.s set .2 .4
update

test scrollbar-6.39.1 {ScrollbarPosition procedure} x11 {
    .t.s identify 4 8
} {arrow1}
test scrollbar-6.39.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .t.s identify 4 8
} {trough1}
test scrollbar-6.40 {ScrollbarPosition procedure} win {
    .t.s identify 0 [expr {[winfo height .t.s] / 2}]
} {arrow1}
test scrollbar-6.41.1 {ScrollbarPosition procedure} x11 {
    .t.s identify 82 8
} {slider}
test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua {
    # macOS scrollbars have no arrows nowadays
    .t.s identify 82 8
} {trough2}
test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
    .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s]
		       - 1}] [expr {[winfo height .t.s] / 2}]
} {slider}
test scrollbar-6.44 {ScrollbarPosition procedure} unix {
    .t.s identify 100 18
} {trough2}
test scrollbar-6.46 {ScrollbarPosition procedure} win {
    .t.s identify 100 [expr {[winfo height .t.s] - 1}]
} {trough2}

test scrollbar-7.1 {EventuallyRedraw} {
    .s configure -orient horizontal
    update
    set result [.s cget -orient]
    .s configure -orient vertical
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
    scrollbar .t.f.s -command doit
    pack .t.f -fill both -expand 1
    pack .t.f.s -fill y -expand 1 -side right
    wm geometry .t 100x100
    .t.f.s set 0 .5
    update
    set result [winfo exists .t.f.s]
    event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5
    event generate .t <ButtonRelease> -button 1
    update
    lappend result [winfo exists .t.f.s] [winfo exists .t.f]
    rename bgerror {}
    set result
} {1 0 0}
test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua {
    # constrained by notAqua because this test clicks on an arrow of the
    # scrollbar - but macOS has no such arrows in modern scrollbars
    proc doit {args} { destroy .t.f.s }
    proc bgerror {args} {}
    destroy .t.f
    frame .t.f
    scrollbar .t.f.s -command doit
    pack .t.f -fill both -expand 1
    pack .t.f.s -fill y -expand 1 -side right
    wm geometry .t 100x100
    .t.f.s set 0 .5
    update
    set result [winfo exists .t.f.s]
    event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5
    event generate .t.f <ButtonRelease> -button 1
    update
    lappend result [winfo exists .t.f.s] [winfo exists .t.f]
    rename bgerror {}
    set result
} {1 0 1}








|




















|







641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
    scrollbar .t.f.s -command doit
    pack .t.f -fill both -expand 1
    pack .t.f.s -fill y -expand 1 -side right
    wm geometry .t 100x100
    .t.f.s set 0 .5
    update
    set result [winfo exists .t.f.s]
    event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
    event generate .t <ButtonRelease> -button 1
    update
    lappend result [winfo exists .t.f.s] [winfo exists .t.f]
    rename bgerror {}
    set result
} {1 0 0}
test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua {
    # constrained by notAqua because this test clicks on an arrow of the
    # scrollbar - but macOS has no such arrows in modern scrollbars
    proc doit {args} { destroy .t.f.s }
    proc bgerror {args} {}
    destroy .t.f
    frame .t.f
    scrollbar .t.f.s -command doit
    pack .t.f -fill both -expand 1
    pack .t.f.s -fill y -expand 1 -side right
    wm geometry .t 100x100
    .t.f.s set 0 .5
    update
    set result [winfo exists .t.f.s]
    event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
    event generate .t.f <ButtonRelease> -button 1
    update
    lappend result [winfo exists .t.f.s] [winfo exists .t.f]
    rename bgerror {}
    set result
} {1 0 1}

Changes to jni/sdl2tk/tests/select.test.
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
proc handler {type offset count} {
    global selValue selInfo
    lappend selInfo $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr $numBytes+$offset]
}

proc errIncrHandler {type offset count} {
    global selValue selInfo pass
    if {$offset == 4000} {
	if {$pass == 0} {
	    # Just sizing the selection;  don't do anything here.
	    set pass 1
	} else {
	    # Fetching the selection;  wait long enough to cause a timeout.
	    after 6000
	}
    }
    lappend selInfo $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr $numBytes+$offset]
}

proc errHandler args {
    error "selection handler aborted"
}

proc badHandler {path type offset count} {
    global selValue selInfo
    selection handle -type $type $path {}
    lappend selInfo $path $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr $numBytes+$offset]
}
proc reallyBadHandler {path type offset count} {
    global selValue selInfo pass
    if {$offset == 4000} {
	if {$pass == 0} {
	    set pass 1
	} else {
	    selection handle -type $type $path {}
	}
    }
    lappend selInfo $path $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr $numBytes+$offset]
}

# Eliminate any existing selection on the screen.  This is needed in case
# there is a selection in some other application, in order to prevent races
# from causing false errors in the tests below.

selection clear .







|


















|














|















|







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
proc handler {type offset count} {
    global selValue selInfo
    lappend selInfo $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr {$numBytes+$offset}]
}

proc errIncrHandler {type offset count} {
    global selValue selInfo pass
    if {$offset == 4000} {
	if {$pass == 0} {
	    # Just sizing the selection;  don't do anything here.
	    set pass 1
	} else {
	    # Fetching the selection;  wait long enough to cause a timeout.
	    after 6000
	}
    }
    lappend selInfo $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr {$numBytes+$offset}]
}

proc errHandler args {
    error "selection handler aborted"
}

proc badHandler {path type offset count} {
    global selValue selInfo
    selection handle -type $type $path {}
    lappend selInfo $path $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr {$numBytes+$offset}]
}
proc reallyBadHandler {path type offset count} {
    global selValue selInfo pass
    if {$offset == 4000} {
	if {$pass == 0} {
	    set pass 1
	} else {
	    selection handle -type $type $path {}
	}
    }
    lappend selInfo $path $type $offset $count
    set numBytes [expr {[string length $selValue] - $offset}]
    if {$numBytes <= 0} {
	return ""
    }
    string range $selValue $offset [expr {$numBytes+$offset}]
}

# Eliminate any existing selection on the screen.  This is needed in case
# there is a selection in some other application, in order to prevent races
# from causing false errors in the tests below.

selection clear .
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
	    selection handle -type $type $path {}
	}
	lappend selInfo $path $type $offset $count
	set numBytes [expr {[string length $selValue] - $offset}]
	if {$numBytes <= 0} {
	    return ""
	}
	string range $selValue $offset [expr $numBytes+$offset]
    }
    set selValue $longValue
    set selInfo ""
    selection handle .f1 {badHandler .f1 STRING}
    set result ""
    set abortCount 2
    lappend result [dobg {selection get}]







|







1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
	    selection handle -type $type $path {}
	}
	lappend selInfo $path $type $offset $count
	set numBytes [expr {[string length $selValue] - $offset}]
	if {$numBytes <= 0} {
	    return ""
	}
	string range $selValue $offset [expr {$numBytes+$offset}]
    }
    set selValue $longValue
    set selInfo ""
    selection handle .f1 {badHandler .f1 STRING}
    set result ""
    set abortCount 2
    lappend result [dobg {selection get}]
Changes to jni/sdl2tk/tests/text.test.
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
    text .t
    pack .t
    update
    set res {}
} -body {
    for {set i 1} {$i < 5} {incr i} {
      .t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
    }
    .t tag configure hidden -elide true
    .t tag add hidden 2.15 3.10
    .t configure -wrap none
    set res [.t count -displaylines 2.0 3.0]
} -cleanup {
    destroy .t







|







2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
    text .t
    pack .t
    update
    set res {}
} -body {
    for {set i 1} {$i < 5} {incr i} {
      .t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n"
    }
    .t tag configure hidden -elide true
    .t tag add hidden 2.15 3.10
    .t configure -wrap none
    set res [.t count -displaylines 2.0 3.0]
} -cleanup {
    destroy .t
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
    .mytop.t delete 1.0 end
    update
    set res {}
} -body {
    for {set i 1} {$i < 5} {incr i} {
      #                    0          1          2          3          4
      #                    012345 678901234 567890123 456789012 34567890123456789
      .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
    }
    .mytop.t tag configure hidden -elide true
    .mytop.t tag add hidden 2.30 3.10
    lappend res [.mytop.t count -displaylines 2.0 3.0]
    lappend res [.mytop.t count -displaylines 2.0 3.50]
} -cleanup {
    destroy .mytop







|







2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
    .mytop.t delete 1.0 end
    update
    set res {}
} -body {
    for {set i 1} {$i < 5} {incr i} {
      #                    0          1          2          3          4
      #                    012345 678901234 567890123 456789012 34567890123456789
      .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n"
    }
    .mytop.t tag configure hidden -elide true
    .mytop.t tag add hidden 2.30 3.10
    lappend res [.mytop.t count -displaylines 2.0 3.0]
    lappend res [.mytop.t count -displaylines 2.0 3.50]
} -cleanup {
    destroy .mytop
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
test text-23.4 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t
} -body {
    .t insert end "1\t2\t3\t4\t55.5"
    .t configure -tabs {100 right 200 left 300 center 400 numeric}
    update idletasks
    list [expr [lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]] \
	    [lindex [.t bbox 1.4] 0] \
	    [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2] \
	    [lindex [.t bbox 1.10] 0]
} -cleanup {
    destroy .t
} -result {100 200 300 400}
test text-23.5 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t
} -body {
    .t insert end "1\t2\t3\t4\t55.5"
    .t configure -tabs {105 r 205 l 305 c 405 n}
    update idletasks
    list [expr [lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]] \
	    [lindex [.t bbox 1.4] 0] \
	    [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2] \
	    [lindex [.t bbox 1.10] 0]
} -cleanup {
    destroy .t
} -result {105 205 305 405}
test text-23.6 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t







|

|











|

|







6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
test text-23.4 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t
} -body {
    .t insert end "1\t2\t3\t4\t55.5"
    .t configure -tabs {100 right 200 left 300 center 400 numeric}
    update idletasks
    list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \
	    [lindex [.t bbox 1.4] 0] \
	    [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \
	    [lindex [.t bbox 1.10] 0]
} -cleanup {
    destroy .t
} -result {100 200 300 400}
test text-23.5 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t
} -body {
    .t insert end "1\t2\t3\t4\t55.5"
    .t configure -tabs {105 r 205 l 305 c 405 n}
    update idletasks
    list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \
	    [lindex [.t bbox 1.4] 0] \
	    [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \
	    [lindex [.t bbox 1.10] 0]
} -cleanup {
    destroy .t
} -result {105 205 305 405}
test text-23.6 {TkTextGetTabs procedure} -setup {
    text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
    pack .t
Changes to jni/sdl2tk/tests/textBTree.test.
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
    for {set i 0} {$i < 200} {incr i} {
        append bigText2 "Line $i\n"
    }
} -body {
    setup
    .t insert 1.1 $bigText2
    for {set i 0} {$i < 100} {incr i} {
        set j [expr $i+2]
        set k [expr 1+2*$i]
        .t tag add x $j.1 $j.3
        .t tag add y $k.1 $k.6
    }
    .t delete 2.0 200.0
    list [.t tag ranges x] [.t tag ranges y]
} -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}}
test btree-6.6 {very large deletes, with tags} -setup {
    set bigText2 {}
    for {set i 0} {$i < 200} {incr i} {
        append bigText2 "Line $i\n"
    }
} -body {
    setup
    .t insert 1.1 $bigText2
    for {set i 0} {$i < 100} {incr i} {
        set j [expr $i+2]
        set k [expr 1+2*$i]
        .t tag add x $j.1 $j.3
        .t tag add y $k.1 $k.6
    }
    for {set i 199} {$i >= 2} {incr i -1} {
        .t delete $i.0 [expr $i+1].0
    }
    list [.t tag ranges x] [.t tag ranges y]
} -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}}


test btree-7.1 {tag addition and removal} -setup {
    .t delete 1.0 end







|
|















|
|




|







418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
    for {set i 0} {$i < 200} {incr i} {
        append bigText2 "Line $i\n"
    }
} -body {
    setup
    .t insert 1.1 $bigText2
    for {set i 0} {$i < 100} {incr i} {
        set j [expr {$i+2}]
        set k [expr {1+2*$i}]
        .t tag add x $j.1 $j.3
        .t tag add y $k.1 $k.6
    }
    .t delete 2.0 200.0
    list [.t tag ranges x] [.t tag ranges y]
} -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}}
test btree-6.6 {very large deletes, with tags} -setup {
    set bigText2 {}
    for {set i 0} {$i < 200} {incr i} {
        append bigText2 "Line $i\n"
    }
} -body {
    setup
    .t insert 1.1 $bigText2
    for {set i 0} {$i < 100} {incr i} {
        set j [expr {$i+2}]
        set k [expr {1+2*$i}]
        .t tag add x $j.1 $j.3
        .t tag add y $k.1 $k.6
    }
    for {set i 199} {$i >= 2} {incr i -1} {
        .t delete $i.0 [expr {$i+1}].0
    }
    list [.t tag ranges x] [.t tag ranges y]
} -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}}


test btree-7.1 {tag addition and removal} -setup {
    .t delete 1.0 end
Changes to jni/sdl2tk/tests/textDisp.test.
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
.t tag delete x y

test textDisp-2.1 {LayoutDLine, basics} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This is some sample text for testing."
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list [expr 5 + $fixedWidth * 19] 5 $fixedWidth $fixedHeight] [list 5 [expr 5 + $fixedHeight] $fixedWidth $fixedHeight]]
test textDisp-2.2 {LayoutDLine, basics} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This isx some sample text for testing."
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
test textDisp-2.3 {LayoutDLine, basics} {textfonts} {







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
.t tag delete x y

test textDisp-2.1 {LayoutDLine, basics} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This is some sample text for testing."
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list [expr {5 + $fixedWidth * 19}] 5 $fixedWidth $fixedHeight] [list 5 [expr {5 + $fixedHeight}] $fixedWidth $fixedHeight]]
test textDisp-2.2 {LayoutDLine, basics} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This isx some sample text for testing."
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
test textDisp-2.3 {LayoutDLine, basics} {textfonts} {
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
    list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11]
} [list [list 19 5 7 $fixedHeight] [list 40 5 7 $fixedHeight] [list 82 5 7 $fixedHeight]]
foreach m [.t mark names] {
    catch {.t mark unset $m}
}
scan [wm geom .] %dx%d width height
test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} {
    wm geom . [expr $width+1]x$height
    update
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This isxx some sample text for testing."
    .t mark set foo 1.20
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 138 5 8 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]







|







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
    list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11]
} [list [list 19 5 7 $fixedHeight] [list 40 5 7 $fixedHeight] [list 82 5 7 $fixedHeight]]
foreach m [.t mark names] {
    catch {.t mark unset $m}
}
scan [wm geom .] %dx%d width height
test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} {
    wm geom . [expr {$width+1}]x$height
    update
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "This isxx some sample text for testing."
    .t mark set foo 1.20
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 138 5 8 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
    .t configure -wrap word
    .t delete 1.0 end
    .t tag delete x y
    .t insert end "Short line\nLine 2 is long enough "
    .t insert end "to wrap around a couple of times"
    .t insert end "\nLine 3\nLine 4"
    set i [.t dlineinfo 1.0]
    set b1 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 2.0]
    set b2 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 2.end]
    set b3 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 3.0]
    set b4 [expr [lindex $i 1] + [lindex $i 4]]
    .t configure -spacing1 2 -spacing2 1 -spacing3 3
    set i [.t dlineinfo 1.0]
    set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
    set i [.t dlineinfo 2.0]
    set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
    set i [.t dlineinfo 2.end]
    set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
    set i [.t dlineinfo 3.0]
    set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
    list $b1 $b2 $b3 $b4
} [list 2 7 10 15]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} {
    .t configure -wrap word
    .t delete 1.0 end
    .t tag delete x y
    .t insert end "Short line\nLine 2 is long enough "
    .t insert end "to wrap around a couple of times"
    .t insert end "\nLine 3\nLine 4"
    set i [.t dlineinfo 1.0]
    set b1 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 2.0]
    set b2 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 2.end]
    set b3 [expr [lindex $i 1] + [lindex $i 4]]
    set i [.t dlineinfo 3.0]
    set b4 [expr [lindex $i 1] + [lindex $i 4]]
    .t configure -spacing1 4 -spacing2 4 -spacing3 4
    .t tag configure x -spacing1 1 -spacing2 2 -spacing3 3
    .t tag add x 1.0 end
    .t tag configure y -spacing1 0 -spacing2 3
    .t tag add y 2.19 end
    .t tag raise y
    set i [.t dlineinfo 1.0]
    set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
    set i [.t dlineinfo 2.0]
    set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
    set i [.t dlineinfo 2.end]
    set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
    set i [.t dlineinfo 3.0]
    set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
    list $b1 $b2 $b3 $b4
} [list 1 5 13 16]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
    .t delete 1.0 end
    .t tag delete x y
    .t tag configure x -tabs 70







|

|

|

|


|

|

|

|











|

|

|

|







|

|

|

|







410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
    .t configure -wrap word
    .t delete 1.0 end
    .t tag delete x y
    .t insert end "Short line\nLine 2 is long enough "
    .t insert end "to wrap around a couple of times"
    .t insert end "\nLine 3\nLine 4"
    set i [.t dlineinfo 1.0]
    set b1 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 2.0]
    set b2 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 2.end]
    set b3 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 3.0]
    set b4 [expr {[lindex $i 1] + [lindex $i 4]}]
    .t configure -spacing1 2 -spacing2 1 -spacing3 3
    set i [.t dlineinfo 1.0]
    set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}]
    set i [.t dlineinfo 2.0]
    set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}]
    set i [.t dlineinfo 2.end]
    set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}]
    set i [.t dlineinfo 3.0]
    set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}]
    list $b1 $b2 $b3 $b4
} [list 2 7 10 15]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} {
    .t configure -wrap word
    .t delete 1.0 end
    .t tag delete x y
    .t insert end "Short line\nLine 2 is long enough "
    .t insert end "to wrap around a couple of times"
    .t insert end "\nLine 3\nLine 4"
    set i [.t dlineinfo 1.0]
    set b1 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 2.0]
    set b2 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 2.end]
    set b3 [expr {[lindex $i 1] + [lindex $i 4]}]
    set i [.t dlineinfo 3.0]
    set b4 [expr {[lindex $i 1] + [lindex $i 4]}]
    .t configure -spacing1 4 -spacing2 4 -spacing3 4
    .t tag configure x -spacing1 1 -spacing2 2 -spacing3 3
    .t tag add x 1.0 end
    .t tag configure y -spacing1 0 -spacing2 3
    .t tag add y 2.19 end
    .t tag raise y
    set i [.t dlineinfo 1.0]
    set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}]
    set i [.t dlineinfo 2.0]
    set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}]
    set i [.t dlineinfo 2.end]
    set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}]
    set i [.t dlineinfo 3.0]
    set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}]
    list $b1 $b2 $b3 $b4
} [list 1 5 13 16]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
    .t delete 1.0 end
    .t tag delete x y
    .t tag configure x -tabs 70
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
    update
    list $tk_textRelayout $tk_textRedraw
} {2.0 {2.0 eof}}
test textDisp-9.13 {TkTextRedrawTag} {
    .t configure -wrap none
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - This is Line [format %c [expr 64+$i]]\n"
    }
    .t tag add hidden 2.8 2.17
    .t tag add hidden 6.8 7.17
    .t tag configure hidden -background red
    .t tag configure hidden -elide true
    update
    .t tag configure hidden -elide false







|







1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
    update
    list $tk_textRelayout $tk_textRedraw
} {2.0 {2.0 eof}}
test textDisp-9.13 {TkTextRedrawTag} {
    .t configure -wrap none
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - This is Line [format %c [expr {64+$i}]]\n"
    }
    .t tag add hidden 2.8 2.17
    .t tag add hidden 6.8 7.17
    .t tag configure hidden -background red
    .t tag configure hidden -elide true
    update
    .t tag configure hidden -elide false
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
    pack .top.t
    .top.t insert end "Line 1"
    for {set i 2} {$i <= 100} {incr i} {
	.top.t insert end "\nLine $i"
    }
    update
    scan [wm geometry .top] "%dx%d" w2 h2
    wm geometry .top ${w2}x[expr $h2-2]
    update
    .top.t yview 1.0
    update
    set tk_textRedraw {}
    .top.t see 5.0
    update
    # Note, with smooth scrolling, the results of this test







|







1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
    pack .top.t
    .top.t insert end "Line 1"
    for {set i 2} {$i <= 100} {incr i} {
	.top.t insert end "\nLine $i"
    }
    update
    scan [wm geometry .top] "%dx%d" w2 h2
    wm geometry .top ${w2}x[expr {$h2-2}]
    update
    .top.t yview 1.0
    update
    set tk_textRedraw {}
    .top.t see 5.0
    update
    # Note, with smooth scrolling, the results of this test
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
    lappend x [.t bbox 30.60]
    .t see 30.65
    lappend x [.t bbox 30.65]
    .t see 30.90
    lappend x [.t bbox 30.90]
} [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]]
test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} {
    wm geom . [expr $width-2]x$height
    .t xview moveto 0
    .t yview moveto 0
    .t tag add sel 30.20
    .t tag add sel 30.50
    update
    .t see 30.50
    set x [list [.t bbox 30.50]]







|







1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
    lappend x [.t bbox 30.60]
    .t see 30.65
    lappend x [.t bbox 30.65]
    .t see 30.90
    lappend x [.t bbox 30.90]
} [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]]
test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} {
    wm geom . [expr {$width-2}]x$height
    .t xview moveto 0
    .t yview moveto 0
    .t tag add sel 30.20
    .t tag add sel 30.50
    update
    .t see 30.50
    set x [list [.t bbox 30.50]]
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
    .t yview scroll 2 pages
    .t index @0,0
} {66.0}
test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {textfonts} {
    .t yview 98.0
    update
    .t yview scroll 1 page
    set res [expr int([.t index @0,0])]
    if {$fixedDiff > 1} {
	incr res -1
    }
    set res
} {102}
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
    .t configure -height 1







|







2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
    .t yview scroll 2 pages
    .t index @0,0
} {66.0}
test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {textfonts} {
    .t yview 98.0
    update
    .t yview scroll 1 page
    set res [expr {int([.t index @0,0])}]
    if {$fixedDiff > 1} {
	incr res -1
    }
    set res
} {102}
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
    .t configure -height 1
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
    .t delete 1.0 end
    foreach x [list 0 1 2 3 4 5 6 7 8 9 0] {
      .t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6"
      .t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden
    }
    .t tag configure hidden -elide true ; # 5 hidden lines
    update
    .t see [expr {5 + [winfo height .t] / $fixedHeight} + 1].0
    update
    .t index @0,0
} {2.0}

.t delete 1.0 end
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
    .t insert end "\nLine $i 11111 $i 22222 $i 33333 $i 44444 $i 55555"







|







2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
    .t delete 1.0 end
    foreach x [list 0 1 2 3 4 5 6 7 8 9 0] {
      .t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6"
      .t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden
    }
    .t tag configure hidden -elide true ; # 5 hidden lines
    update
    .t see [expr {5 + [winfo height .t] / $fixedHeight + 1}].0
    update
    .t index @0,0
} {2.0}

.t delete 1.0 end
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
    .t insert end "\nLine $i 11111 $i 22222 $i 33333 $i 44444 $i 55555"
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
    wm geometry .top +0+0
    text .top.t -width 40 -height 5 -font $fixedFont
    pack .top.t -expand yes -fill both
    .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5"
    # Need to wait for asychronous calculations to complete.
    update ; after 10
    scan [wm geom .top] %dx%d twidth theight
    wm geom .top ${twidth}x[expr $theight - 3]
    update
    .top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
test textDisp-19.13 {GetYView procedure, partially visible last line} {textfonts} {
    catch {destroy .top}
    toplevel .top
    wm geometry .top +0+0
    text .top.t -width 40 -height 5 -font $fixedFont
    pack .top.t -expand yes -fill both
    .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once"
    # Need to wait for asychronous calculations to complete.
    update ; after 10
    scan [wm geom .top] %dx%d twidth theight
    wm geom .top ${twidth}x[expr $theight - 3]
    update
    .top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
catch {destroy .top}
test textDisp-19.14 {GetYView procedure} {
    .t configure -wrap word
    .t delete 1.0 end







|













|







2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
    wm geometry .top +0+0
    text .top.t -width 40 -height 5 -font $fixedFont
    pack .top.t -expand yes -fill both
    .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5"
    # Need to wait for asychronous calculations to complete.
    update ; after 10
    scan [wm geom .top] %dx%d twidth theight
    wm geom .top ${twidth}x[expr {$theight - 3}]
    update
    .top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
test textDisp-19.13 {GetYView procedure, partially visible last line} {textfonts} {
    catch {destroy .top}
    toplevel .top
    wm geometry .top +0+0
    text .top.t -width 40 -height 5 -font $fixedFont
    pack .top.t -expand yes -fill both
    .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once"
    # Need to wait for asychronous calculations to complete.
    update ; after 10
    scan [wm geom .top] %dx%d twidth theight
    wm geom .top ${twidth}x[expr {$theight - 3}]
    update
    .top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
catch {destroy .top}
test textDisp-19.14 {GetYView procedure} {
    .t configure -wrap word
    .t delete 1.0 end
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
    .t config -wrap none
    .t yview 48.0
    list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0]
} [list [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] {} [list 3 [expr {3+9*$fixedHeight}] 7 $fixedHeight]]
test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr $height-1]
    update
    list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 3]]
test textDisp-22.4 {TkTextCharBbox, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr $height+1]
    update
    list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 5]]
test textDisp-22.5 {TkTextCharBbox, cut-off char} {textfonts} {
    .t config -wrap none
    .t yview 10.0
    wm geom . [expr $width-95]x$height
    update
    .t bbox 15.6
} [list 45 [expr {3+5*$fixedHeight}] 7 $fixedHeight]
test textDisp-22.6 {TkTextCharBbox, line visible but not char} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    .t tag add big 20.2 20.5
    wm geom . ${width}x[expr $height+3]
    update
    list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] {} [list 17 [expr {3+10*$fixedHeight}] 14 7]]
wm geom . {}
update
test textDisp-22.7 {TkTextCharBbox, different character sizes} {textfonts} {
    .t config -wrap char







|






|






|







|







2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
    .t config -wrap none
    .t yview 48.0
    list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0]
} [list [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] {} [list 3 [expr {3+9*$fixedHeight}] 7 $fixedHeight]]
test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr {$height-1}]
    update
    list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 3]]
test textDisp-22.4 {TkTextCharBbox, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr {$height+1}]
    update
    list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 5]]
test textDisp-22.5 {TkTextCharBbox, cut-off char} {textfonts} {
    .t config -wrap none
    .t yview 10.0
    wm geom . [expr {$width-95}]x$height
    update
    .t bbox 15.6
} [list 45 [expr {3+5*$fixedHeight}] 7 $fixedHeight]
test textDisp-22.6 {TkTextCharBbox, line visible but not char} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    .t tag add big 20.2 20.5
    wm geom . ${width}x[expr {$height+3}]
    update
    list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] {} [list 17 [expr {3+10*$fixedHeight}] 14 7]]
wm geom . {}
update
test textDisp-22.7 {TkTextCharBbox, different character sizes} {textfonts} {
    .t config -wrap char
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
	    [.t bbox 1.1] [.t bbox 2.9]
} [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]]
.t tag delete spacing
test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - Line [format %c [expr 64+$i]]\n"
    }
    .t tag add hidden 2.8 2.13
    .t tag add hidden 6.8 7.13
    .t tag configure hidden -elide true
    update
    list \
        [expr {[lindex [.t bbox 2.9]  0] - [lindex [.t bbox 2.8] 0]}] \







|







3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
	    [.t bbox 1.1] [.t bbox 2.9]
} [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]]
.t tag delete spacing
test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - Line [format %c [expr {64+$i}]]\n"
    }
    .t tag add hidden 2.8 2.13
    .t tag add hidden 6.8 7.13
    .t tag configure hidden -elide true
    update
    list \
        [expr {[lindex [.t bbox 2.9]  0] - [lindex [.t bbox 2.8] 0]}] \
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
        [expr {[lindex [.t bbox 7.1]  0] - [lindex [.t bbox 6.8] 0]}] \
        [expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}]
} [list 0 0 0 0 0 0 0 0 0 0 0]
test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr 64+$i]]\n"
    }
    .t tag add hidden 1.30 2.5
    .t tag configure hidden -elide true
    update
    list \
        [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.4]  0]}] \
        [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.5]  0]}]







|







3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
        [expr {[lindex [.t bbox 7.1]  0] - [lindex [.t bbox 6.8] 0]}] \
        [expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}]
} [list 0 0 0 0 0 0 0 0 0 0 0]
test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    for {set i 1} {$i < 10} {incr i} {
        .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr {64+$i}]]\n"
    }
    .t tag add hidden 1.30 2.5
    .t tag configure hidden -elide true
    update
    list \
        [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.4]  0]}] \
        [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.5]  0]}]
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
    update
    .t yview 48.0
    list [.t dlineinfo 50.40] [.t dlineinfo 57.3]
} [list [list 3 [expr {2*$fixedDiff + 29}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr $height-1]
    update
    list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 3 [expr {$fixedDiff + 10}]]]
test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr $height+1]
    update
    list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 5 [expr {$fixedDiff + 10}]]]
wm geom . {}
update
test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {textfonts} {
    .t config -wrap none







|






|







3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
    update
    .t yview 48.0
    list [.t dlineinfo 50.40] [.t dlineinfo 57.3]
} [list [list 3 [expr {2*$fixedDiff + 29}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr {$height-1}]
    update
    list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 3 [expr {$fixedDiff + 10}]]]
test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {textfonts} {
    .t config -wrap char
    .t yview 10.0
    wm geom . ${width}x[expr {$height+1}]
    update
    list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 5 [expr {$fixedDiff + 10}]]]
wm geom . {}
update
test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {textfonts} {
    .t config -wrap none
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr $width+1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.3 {TkTextCharLayoutProc} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr $width-1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 01234567890123456789\n012345678901234567890







|







|







3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr {$width+1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.3 {TkTextCharLayoutProc} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr {$width-1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 01234567890123456789\n012345678901234567890
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr $width+1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr $width-1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr $width-6]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 5 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr $width-7]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 4 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "01234567890123456789 \nabcdefg"
    wm geom . [expr $width-2]x$height
    update
    set result {}
    lappend result [.t bbox 1.21] [.t bbox 2.0]
    .t mark set insert 1.21
    lappend result [.t bbox 1.21] [.t bbox 2.0]
} [list [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {textfonts} {







|







|







|







|







|







3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr {$width+1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr {$width-1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr {$width-6}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 5 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "a b c d e f g h i j k l m n o p"
    wm geom . [expr {$width-7}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 4 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {textfonts} {
    .t configure -wrap char
    .t delete 1.0 end
    .t insert 1.0 "01234567890123456789 \nabcdefg"
    wm geom . [expr {$width-2}]x$height
    update
    set result {}
    lappend result [.t bbox 1.21] [.t bbox 2.0]
    .t mark set insert 1.21
    lappend result [.t bbox 1.21] [.t bbox 2.0]
} [list [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {textfonts} {
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] {}]
test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} {
    .t configure -wrap none
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr $width+1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 5 $fixedHeight]]
test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} {
    .t configure -wrap none
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr $width-1]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]]
test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} {
    if {$tcl_platform(platform) == "windows"} {
	wm overrideredirect . 1
    }







|







|







3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] {}]
test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} {
    .t configure -wrap none
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr {$width+1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 5 $fixedHeight]]
test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} {
    .t configure -wrap none
    .t delete 1.0 end
    .t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
    wm geom . [expr {$width-1}]x$height
    update
    list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]]
test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} {
    if {$tcl_platform(platform) == "windows"} {
	wm overrideredirect . 1
    }
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
    .t delete 1.0 end
    .t insert 1.0 a\tb\tc\td\te
    .t tag delete x
    .t tag configure x -tabs {40 70 right}
    .t tag add x 1.0 end
    list [lindex [.t bbox 1.2] 0] \
	    [expr [lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]] \
	    [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]] \
	    [expr [lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]]
} [list 40 70 100 130]
test textDisp-26.4 {AdjustForTab procedure, different alignments} {
    .t delete 1.0 end
    .t insert 1.0 a\tbc\tde\tfg\thi
    .t tag delete x
    .t tag configure x -tabs {40 center 80 left 130 right}
    .t tag add x 1.0 end







|
|
|







3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
    .t delete 1.0 end
    .t insert 1.0 a\tb\tc\td\te
    .t tag delete x
    .t tag configure x -tabs {40 70 right}
    .t tag add x 1.0 end
    list [lindex [.t bbox 1.2] 0] \
	    [expr {[lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]}] \
	    [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]}] \
	    [expr {[lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]}]
} [list 40 70 100 130]
test textDisp-26.4 {AdjustForTab procedure, different alignments} {
    .t delete 1.0 end
    .t insert 1.0 a\tbc\tde\tfg\thi
    .t tag delete x
    .t tag configure x -tabs {40 center 80 left 130 right}
    .t tag add x 1.0 end
Changes to jni/sdl2tk/tests/textTag.test.
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}



set c [.t bbox 2.1]
set x1 [expr [lindex $c 0] + [lindex $c 2]/2]
set y1 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 3.2]
set x2 [expr [lindex $c 0] + [lindex $c 2]/2]
set y2 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 4.3]
set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]

test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
    .t tag delete x y
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
} -body {
    bind .t <ButtonRelease> {lappend x up}
    .t tag bind x <ButtonRelease> {lappend x x-up}







|
|

|
|

|
|







1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}



set c [.t bbox 2.1]
set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}]
set c [.t bbox 3.2]
set x2 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y2 [expr {[lindex $c 1] + [lindex $c 3]/2}]
set c [.t bbox 4.3]
set x3 [expr {[lindex $c 0] + [lindex $c 2]/2}]
set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}]

test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
    .t tag delete x y
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
} -body {
    bind .t <ButtonRelease> {lappend x up}
    .t tag bind x <ButtonRelease> {lappend x x-up}
Changes to jni/sdl2tk/tests/ttk/treeview.test.
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
    update
} -body {
    foreach {x y w h} [.tv bbox foo #0] {}
    set res [.tv item foo -open]
    # using $h even for x computation is intentional here in order to simulate
    # a mouse click on the (invisible since we're on a leaf) indicator
    event generate .tv <ButtonPress-1> \
            -x [expr ($x + $h / 2)] \
            -y [expr ($y + $h / 2)]
    lappend res [.tv item foo -open]
    .tv insert foo end -text "sub"
    lappend res [.tv item foo -open]
} -cleanup {
    destroy .tv
} -result {0 0 0}








|
|







679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
    update
} -body {
    foreach {x y w h} [.tv bbox foo #0] {}
    set res [.tv item foo -open]
    # using $h even for x computation is intentional here in order to simulate
    # a mouse click on the (invisible since we're on a leaf) indicator
    event generate .tv <ButtonPress-1> \
            -x [expr {$x + $h / 2}] \
            -y [expr {$y + $h / 2}]
    lappend res [.tv item foo -open]
    .tv insert foo end -text "sub"
    lappend res [.tv item foo -open]
} -cleanup {
    destroy .tv
} -result {0 0 0}

Changes to jni/sdl2tk/tests/ttk/ttk.test.
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# (@@@ "-font" is a compatibility option now, so tests 4.1-4.3
# don't really test anything useful at the moment.)
#

test ttk-4.0 "Setup" -body {
    catch { destroy .t }
    pack [ttk::label .t -text "Button 1"]
    testConstraint fontOption [expr ![catch { set prevFont [.t cget -font] }]]
    ok
}

test ttk-4.1 "Change font" -constraints fontOption -body {
    .t configure -font "Helvetica 18 bold"
}
test ttk-4.2 "Check font" -constraints fontOption -body {







|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# (@@@ "-font" is a compatibility option now, so tests 4.1-4.3
# don't really test anything useful at the moment.)
#

test ttk-4.0 "Setup" -body {
    catch { destroy .t }
    pack [ttk::label .t -text "Button 1"]
    testConstraint fontOption [expr {![catch { set prevFont [.t cget -font] }]}]
    ok
}

test ttk-4.1 "Change font" -constraints fontOption -body {
    .t configure -font "Helvetica 18 bold"
}
test ttk-4.2 "Check font" -constraints fontOption -body {
Changes to jni/sdl2tk/tests/visual.test.
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
    catch {destroy $w}
    toplevel $w
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
        for {set x 0} {$x < 40} {incr x} {
            set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
            $w.c create rectangle [expr 10*$x] [expr 20*$y] \
                [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
                -fill $color
        }
    }
    update
}

# colorsFree --
#
# Returns 1 if there appear to be free colormap entries in a window,
# 0 otherwise.
#
# Arguments:
# w -            Name of window in which to check.
# red, green, blue -    Intensities to use in a trial color allocation
#            to see if there are colormap entries free.

proc colorsFree {w {red 31} {green 245} {blue 192}} {
    set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
    expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \
        && ([lindex $vals 2]/256 == $blue)
}

# If more than one visual type is available for the screen, pick one
# that is *not* the default.

set default "[winfo visual .] [winfo depth .]"
set avail [winfo visualsavailable .]







|
|
|


















|
|







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
    catch {destroy $w}
    toplevel $w
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
        for {set x 0} {$x < 40} {incr x} {
            set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
            $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
                [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
                -fill $color
        }
    }
    update
}

# colorsFree --
#
# Returns 1 if there appear to be free colormap entries in a window,
# 0 otherwise.
#
# Arguments:
# w -            Name of window in which to check.
# red, green, blue -    Intensities to use in a trial color allocation
#            to see if there are colormap entries free.

proc colorsFree {w {red 31} {green 245} {blue 192}} {
    set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
    expr {([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green)
        && ([lindex $vals 2]/256 == $blue)}
}

# If more than one visual type is available for the screen, pick one
# that is *not* the default.

set default "[winfo visual .] [winfo depth .]"
set avail [winfo visualsavailable .]
Changes to jni/sdl2tk/tests/winFont.test.
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*10] -text "00000000"
    list [expr {[winfo reqwidth .t.l] eq 8*$ax}] \
        [expr {[winfo reqheight .t.l] eq $ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*6] -text "00000000"
    list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constraints {
    win
} -setup {
    destroy .t.c
}  -body {
    canvas .t.c -closeenough 0
    set t [.t.c create text 0 0 -anchor nw -just left -font $courier]
    pack .t.c
    update

    .t.c dchars $t 0 end
    .t.c insert $t 0 "0000"
    .t.c index $t @[expr int($cx*2.5)],1
} -cleanup {
    destroy .t.c
} -result {2}

test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} -constraints {
    win
} -setup {







|


















|


















|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*10}] -text "00000000"
    list [expr {[winfo reqwidth .t.l] eq 8*$ax}] \
        [expr {[winfo reqheight .t.l] eq $ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*6}] -text "00000000"
    list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constraints {
    win
} -setup {
    destroy .t.c
}  -body {
    canvas .t.c -closeenough 0
    set t [.t.c create text 0 0 -anchor nw -just left -font $courier]
    pack .t.c
    update

    .t.c dchars $t 0 end
    .t.c insert $t 0 "0000"
    .t.c index $t @[expr {int($cx*2.5)}],1
} -cleanup {
    destroy .t.c
} -result {2}

test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} -constraints {
    win
} -setup {
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*8] -text "000000 0000"
    list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*12] -text "000000    0000000"
    list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*12] -text "000  00   00000"
    list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr $ax*12] -text "0000000000000000"
    list [expr {[winfo reqwidth .t.l] eq 12*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints {







|


















|


















|


















|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*8}] -text "000000 0000"
    list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*12}] -text "000000    0000000"
    list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*12}] -text "000  00   00000"
    list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} -constraints {
    win
} -setup {
    destroy .t.l
}  -body {
    label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
        -text "0" -font systemfixed
    pack .t.l
    update
    set ax [winfo reqwidth .t.l]
    set ay [winfo reqheight .t.l]

    .t.l config -wrap [expr {$ax*12}] -text "0000000000000000"
    list [expr {[winfo reqwidth .t.l] eq 12*$ax}] \
        [expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
    destroy .t.l
} -result {1 1}

test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints {
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

    set font [.t.l cget -font]
    .t.l config -font {{MS Sans Serif} 8} -text "W"
    set width [winfo reqwidth .t.l]
    .t.l config -text "XaYoYaKaWx"
    set x [lindex [getsize] 0]
    .t.l config -font $font
    expr $x < ($width*10)
} -cleanup {
    destroy .t.l
} -result {1}


test winfont-6.1 {Tk_DrawChars procedure: loop test} -constraints win -setup {
    destroy .t.l







|







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

    set font [.t.l cget -font]
    .t.l config -font {{MS Sans Serif} 8} -text "W"
    set width [winfo reqwidth .t.l]
    .t.l config -text "XaYoYaKaWx"
    set x [lindex [getsize] 0]
    .t.l config -font $font
    expr {$x < ($width*10)}
} -cleanup {
    destroy .t.l
} -result {1}


test winfont-6.1 {Tk_DrawChars procedure: loop test} -constraints win -setup {
    destroy .t.l
Changes to jni/sdl2tk/tests/winSend.test.
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
} {a}
test winSend-2.3 {Tk_SendObjCmd - sending to ourselves in a different interpreter} winSend {
    newApp testApp
    list [catch {send testApp {set foo b}} msg] $msg [interp delete testApp]
} {0 b {}}
test winSend-2.4 {Tk_SendObjCmd - sending to ourselves in a different interp with errors} winSend {
    newApp testApp
    list [catch {send testApp {expr 2 / 0}} msg] $msg $errorCode $errorInfo [interp delete testApp]
} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n    while executing\n\"expr 2 / 0\"\n    invoked from within\n\"send testApp {expr 2 / 0}\"} {}"
test winSend-2.5 {Tk_SendObjCmd - sending to another app async} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }







|
|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
} {a}
test winSend-2.3 {Tk_SendObjCmd - sending to ourselves in a different interpreter} winSend {
    newApp testApp
    list [catch {send testApp {set foo b}} msg] $msg [interp delete testApp]
} {0 b {}}
test winSend-2.4 {Tk_SendObjCmd - sending to ourselves in a different interp with errors} winSend {
    newApp testApp
    list [catch {send testApp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo [interp delete testApp]
} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n    while executing\n\"expr {2 / 0}\"\n    invoked from within\n\"send testApp {expr {2 / 0}}\"} {}"
test winSend-2.5 {Tk_SendObjCmd - sending to another app async} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
test winSend-2.7 {Tk_SendObjCmd - sending to another app - error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [catch {send $interp {expr 2 / 0}} msg] $msg $errorCode $errorInfo
} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n    while executing\n\"expr 2 / 0\"\n    invoked from within\n\"send \$interp {expr 2 / 0}\"}"

test winSend-3.1 {TkGetInterpNames} winSend {
    set origLength [llength $currentInterps]
    set newLength [llength [winfo interps]]
    expr {($newLength - 2) == $origLength}
} {1}








|
|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
test winSend-2.7 {Tk_SendObjCmd - sending to another app - error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [catch {send $interp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo
} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n    while executing\n\"expr {2 / 0}\"\n    invoked from within\n\"send \$interp {expr {2 / 0}}\"}"

test winSend-3.1 {TkGetInterpNames} winSend {
    set origLength [llength $currentInterps]
    set newLength [llength [winfo interps]]
    expr {($newLength - 2) == $origLength}
} {1}

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [send $interp {send [tk appname] {expr 2 / 1}}]
} {2}
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [catch {send $interp {send [tk appname] {expr 2 / 0}}} msg] $msg
} {1 {divide by zero}}

test winSend-6.1 {SendDDEServer - XTYP_CONNECT} winSend {
    set foo "Hello, World"
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {







|








|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [send $interp {send [tk appname] {expr {2 / 1}}}]
} {2}
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    list [catch {send $interp {send [tk appname] {expr {2 / 0}}}} msg] $msg
} {1 {divide by zero}}

test winSend-6.1 {SendDDEServer - XTYP_CONNECT} winSend {
    set foo "Hello, World"
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
    set foo 3
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    set command "send [tk appname] {expr $foo + 1}"
    list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 4}
test winSend-6.7 {SendDDEServer - XTYP_EXECUTE} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    set command "send [tk appname] {expr 4 / 2}"
    list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 2}
test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break







|









|







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
    set foo 3
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    set command "send [tk appname] {expr {$foo + 1}}"
    list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 4}
test winSend-6.7 {SendDDEServer - XTYP_EXECUTE} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
	}
    }
    set command "send [tk appname] {expr {4 / 2}}"
    list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 2}
test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
    set newInterps [winfo interps]
    foreach interp $newInterps {
	if {[lsearch $currentInterps $interp] < 0} {
	    break
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
	}
    }
    send $interp {set foo winSend-10.17}
    list [catch {dde request Tk $interp foo} msg] $msg
} {0 winSend-10.17}
test winSend-10.18 {Tk_DDEObjCmd - services} winSend {
    set currentService [list Tk [tk appname]]
    list [catch {dde services Tk {}} msg] [expr [lsearch $msg $currentService] >= 0]
} {0 1}

# Get rid of the other app and all of its interps

set newInterps [winfo interps]
while {[llength $newInterps] != [llength $currentInterps]} {
    foreach interp $newInterps {







|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
	}
    }
    send $interp {set foo winSend-10.17}
    list [catch {dde request Tk $interp foo} msg] $msg
} {0 winSend-10.17}
test winSend-10.18 {Tk_DDEObjCmd - services} winSend {
    set currentService [list Tk [tk appname]]
    list [catch {dde services Tk {}} msg] [expr {[lsearch $msg $currentService] >= 0}]
} {0 1}

# Get rid of the other app and all of its interps

set newInterps [winfo interps]
while {[llength $newInterps] != [llength $currentInterps]} {
    foreach interp $newInterps {
Changes to jni/sdl2tk/tests/winfo.test.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
    destroy $w
    eval toplevel $w $options
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
        for {set x 0} {$x < 40} {incr x} {
            set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
            $w.c create rectangle [expr 10*$x] [expr 20*$y] \
                [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
                -fill $color
        }
    }
    update
}

# XXX - This test file is woefully incomplete.  At present, only a







|
|
|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
    destroy $w
    eval toplevel $w $options
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
        for {set x 0} {$x < 40} {incr x} {
            set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
            $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
                [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
                -fill $color
        }
    }
    update
}

# XXX - This test file is woefully incomplete.  At present, only a
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
} -body {
    toplevel .t -width 550 -height 400
    frame .t.f -width 80 -height 60 -bd 2 -relief raised
    place .t.f -x 50 -y 50
    wm geom .t +0+0
    update

    winfo containing [expr [winfo rootx .t.f]-1] [expr [winfo rooty .t.f]-1]
} -cleanup {
    destroy .t
} -result .t
test winfo-4.7 {"winfo containing" command} -setup {
    destroy .t
} -body {
    toplevel .t -width 550 -height 400
    frame .t.f -width 80 -height 60 -bd 2 -relief raised
    place .t.f -x 50 -y 50
    wm geom .t +0+0
    update

    set x [winfo containing -display .t.f [expr [winfo rootx .t]+600] \
        [expr [winfo rooty .t.f]+450]]
    expr {($x == ".") || ($x == "")}
} -cleanup {
    destroy .t
} -result {1}


test winfo-5.1 {"winfo interps" command} -body {







|












|
|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
} -body {
    toplevel .t -width 550 -height 400
    frame .t.f -width 80 -height 60 -bd 2 -relief raised
    place .t.f -x 50 -y 50
    wm geom .t +0+0
    update

    winfo containing [expr {[winfo rootx .t.f]-1}] [expr {[winfo rooty .t.f]-1}]
} -cleanup {
    destroy .t
} -result .t
test winfo-4.7 {"winfo containing" command} -setup {
    destroy .t
} -body {
    toplevel .t -width 550 -height 400
    frame .t.f -width 80 -height 60 -bd 2 -relief raised
    place .t.f -x 50 -y 50
    wm geom .t +0+0
    update

    set x [winfo containing -display .t.f [expr {[winfo rootx .t]+600}] \
        [expr {[winfo rooty .t.f]+450}]]
    expr {($x == ".") || ($x == "")}
} -cleanup {
    destroy .t
} -result {1}


test winfo-5.1 {"winfo interps" command} -body {
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
    llength [lindex [winfo visualsa .] 0]
} -result {2}
test winfo-11.5 {"winfo visualid" command} -body {
    llength [lindex [winfo visualsa . includeids] 0]
} -result {3}
test winfo-11.6 {"winfo visualid" command} -body {
    set x [lindex [lindex [winfo visualsa . includeids] 0] 2]
    expr $x + 2 - $x
} -result {2}


test winfo-12.1 {GetDisplayOf procedure} -body {
    winfo atom - foo x
} -returnCodes error -result {wrong # args: should be "winfo atom ?-displayof window? name"}
test winfo-12.2 {GetDisplayOf procedure} -body {







|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
    llength [lindex [winfo visualsa .] 0]
} -result {2}
test winfo-11.5 {"winfo visualid" command} -body {
    llength [lindex [winfo visualsa . includeids] 0]
} -result {3}
test winfo-11.6 {"winfo visualid" command} -body {
    set x [lindex [lindex [winfo visualsa . includeids] 0] 2]
    expr {$x + 2 - $x}
} -result {2}


test winfo-12.1 {GetDisplayOf procedure} -body {
    winfo atom - foo x
} -returnCodes error -result {wrong # args: should be "winfo atom ?-displayof window? name"}
test winfo-12.2 {GetDisplayOf procedure} -body {