diff options
-rw-r--r-- | .travis.yml | 30 | ||||
-rw-r--r-- | doc/canvas.n | 2 | ||||
-rw-r--r-- | doc/colors.n | 87 | ||||
-rw-r--r-- | doc/frame.n | 4 | ||||
-rw-r--r-- | doc/labelframe.n | 2 | ||||
-rw-r--r-- | doc/text.n | 6 | ||||
-rw-r--r-- | doc/ttk_entry.n | 6 | ||||
-rw-r--r-- | doc/ttk_widget.n | 5 | ||||
-rw-r--r-- | generic/tkInt.decls | 6 | ||||
-rw-r--r-- | generic/tkIntXlibDecls.h | 17 | ||||
-rw-r--r-- | generic/tkScale.c | 10 | ||||
-rw-r--r-- | generic/tkStubInit.c | 4 | ||||
-rw-r--r-- | macosx/README | 36 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.c | 84 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.h | 21 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 36 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 79 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 40 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 5 | ||||
-rw-r--r-- | macosx/tkMacOSXRegion.c | 13 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 101 | ||||
-rw-r--r-- | tests/entry.test | 188 | ||||
-rw-r--r-- | tests/listbox.test | 126 | ||||
-rw-r--r-- | tests/spinbox.test | 454 | ||||
-rw-r--r-- | tests/ttk/entry.test | 10 | ||||
-rw-r--r-- | tests/ttk/spinbox.test | 6 | ||||
-rw-r--r-- | win/tkWinPort.h | 4 |
28 files changed, 747 insertions, 639 deletions
diff --git a/.travis.yml b/.travis.yml index 29a66d8..fc0773d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: required language: c addons: apt: @@ -17,8 +16,7 @@ addons: - tcl-tk casks: - xquartz - update: true -matrix: +jobs: include: # Testing on Linux with various compilers - name: "Linux/GCC/Shared" @@ -114,9 +112,9 @@ matrix: - BUILD_DIR=unix - CFGOPT="--enable-symbols" # Testing on Mac, various styles - - name: "macOS/Clang/Xcode 11.5/Shared" + - name: "macOS/Clang/Xcode 11.6/Shared" os: osx - osx_image: xcode11.5 + osx_image: xcode11.6 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -124,27 +122,27 @@ matrix: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: &mactest - make binaries libraries tktest - - name: "macOS/Clang/Xcode 11.5/Static" + - name: "macOS/Clang/Xcode 11.6/Static" os: osx - osx_image: xcode11.5 + osx_image: xcode11.6 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.5/Debug" + - name: "macOS/Clang/Xcode 11.6/Debug" os: osx - osx_image: xcode11.5 + osx_image: xcode11.6 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.5/Shared/XQuartz" + - name: "macOS/Clang/Xcode 11.6/Shared/XQuartz" os: osx - osx_image: xcode11.5 + osx_image: xcode11.6 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -164,6 +162,11 @@ matrix: - name: "macOS/Clang/Xcode 10/Shared" os: osx osx_image: xcode10.3 + addons: + homebrew: + packages: + - tcl-tk + update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" @@ -173,6 +176,11 @@ matrix: - name: "macOS/Clang/Xcode 9/Shared" os: osx osx_image: xcode9.4 + addons: + homebrew: + packages: + - tcl-tk + update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13" diff --git a/doc/canvas.n b/doc/canvas.n index cd9f56c..4641c1c 100644 --- a/doc/canvas.n +++ b/doc/canvas.n @@ -1123,7 +1123,7 @@ becomes visible; if it is positive then information farther to the right becomes visible. .RE .TP -\fIpathName \fByview \fI?args\fR? +\fIpathName \fByview ?\fIargs\fR? . This command is used to query and change the vertical position of the information displayed in the canvas's window. diff --git a/doc/colors.n b/doc/colors.n index 847dbaa..3747ee8 100644 --- a/doc/colors.n +++ b/doc/colors.n @@ -792,23 +792,15 @@ suggested by the color name. .RS .DS systemActiveAreaFill -systemAlertActiveText systemAlertBackgroundActive systemAlertBackgroundInactive -systemAlertInactiveText systemAlternatePrimaryHighlightColor systemAppleGuideCoachmark systemBevelActiveDark systemBevelActiveLight -systemBevelButtonActiveText -systemBevelButtonInactiveText -systemBevelButtonPressedText -systemBevelButtonStickyActiveText -systemBevelButtonStickyInactiveText systemBevelInactiveDark systemBevelInactiveLight systemBlack -systemBlackText systemButtonActiveDarkHighlight systemButtonActiveDarkShadow systemButtonActiveLightHighlight @@ -828,15 +820,10 @@ systemButtonPressedDarkHighlight systemButtonPressedDarkShadow systemButtonPressedLightHighlight systemButtonPressedLightShadow -systemButtonText systemChasingArrows -systemDialogActiveText systemDialogBackgroundActive systemDialogBackgroundInactive -systemDialogInactiveText systemDocumentWindowBackground -systemDocumentWindowTitleActiveText -systemDocumentWindowTitleInactiveText systemDragHilite systemDrawerBackground systemFinderWindowBackground @@ -844,97 +831,53 @@ systemFocusHighlight systemHighlight systemHighlightAlternate systemHighlightSecondary -systemHighlightText systemIconLabelBackground systemIconLabelBackgroundSelected -systemIconLabelSelectedText -systemIconLabelText systemListViewBackground systemListViewColumnDivider systemListViewEvenRowBackground systemListViewOddRowBackground systemListViewSeparator systemListViewSortColumnBackground -systemListViewText -systemListViewWindowHeaderBackground systemMenu systemMenuActive -systemMenuActiveText systemMenuBackground systemMenuBackgroundSelected -systemMenuDisabled -systemMenuItemActiveText -systemMenuItemDisabledText -systemMenuItemSelectedText -systemMenuText -systemMetalBackground -systemModelessDialogActiveText systemModelessDialogBackgroundActive systemModelessDialogBackgroundInactive -systemModelessDialogInactiveText systemMovableModalBackground -systemMovableModalWindowTitleActiveText -systemMovableModalWindowTitleInactiveText -systemNotificationText systemNotificationWindowBackground -systemPlacardActiveText -systemPlacardBackground -systemPlacardInactiveText -systemPlacardPressedText systemPopupArrowActive systemPopupArrowInactive systemPopupArrowPressed -systemPopupButtonActiveText -systemPopupButtonInactiveText -systemPopupButtonPressedText -systemPopupLabelActiveText -systemPopupLabelInactiveText -systemPopupWindowTitleActiveText -systemPopupWindowTitleInactiveText systemPrimaryHighlightColor -systemPushButtonActiveText -systemPushButtonInactiveText -systemPushButtonPressedText -systemRootMenuActiveText -systemRootMenuDisabledText -systemRootMenuSelectedText systemScrollBarDelimiterActive systemScrollBarDelimiterInactive -systemSecondaryGroupBoxBackground systemSecondaryHighlightColor systemSelectedTabTextColor systemSheetBackground systemSheetBackgroundOpaque systemSheetBackgroundTransparent systemStaticAreaFill -systemSystemDetailText -systemTabFrontActiveText -systemTabFrontInactiveText -systemTabNonFrontActiveText -systemTabNonFrontInactiveText -systemTabNonFrontPressedText -systemTabPaneBackground systemToolbarBackground systemTransparent systemUtilityWindowBackgroundActive systemUtilityWindowBackgroundInactive -systemUtilityWindowTitleActiveText -systemUtilityWindowTitleInactiveText systemWhite -systemWhiteText systemWindowBody -systemWindowHeaderActiveText -systemWindowHeaderBackground -systemWindowHeaderInactiveText .DE .RE . -The group of MacOS colors below are based on Apple's "semantic" -NSColors. On OSX 10.14 (Mojave) and later these colors change value -when Dark Mode is enabled. The numbered systemWindowBackgroundColors -are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets -to provide a contrasting background. Each numbered color constrasts -with its predecessor. +Tk supports all of the NSColors in the macOS System ColorList. The +convention for naming these colors is that the Tk name is generated by +capitalizing the macOS name and adding the prefix "system". On OSX +10.14 (Mojave) and later many of these "semantic" colors will appear +differently depending on whether the NSWindow in which they are used has +the Aqua or DarkAqua appearance. The System ColorList differs between +releases of macOS and some colors, such as systemLinkColor and +systemControlAccentColor, are simulated on older systems which did not +provide them. All of the colors below are available on all supported +macOS releases, but newer systems will support additional colors. .RS .DS systemControlAccentColor @@ -948,6 +891,15 @@ systemSelectedTextColor systemSeparatorColor systemTextBackgroundColor systemTextColor +.DE +.RE +. +The numbered systemWindowBackgroundColors below +are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets +to provide a contrasting background. Each numbered color constrasts +with its predecessor. +.RS +.DS systemWindowBackgroundColor systemWindowBackgroundColor1 systemWindowBackgroundColor2 @@ -960,7 +912,6 @@ systemWindowBackgroundColor7 .RE .TP - \fBWindows\fR . On Windows, the following additional system colors are available diff --git a/doc/frame.n b/doc/frame.n index f2fbd96..4800461 100644 --- a/doc/frame.n +++ b/doc/frame.n @@ -4,7 +4,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH frame n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS @@ -116,7 +116,7 @@ by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBframe\fR command. .TP -\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR? +\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of diff --git a/doc/labelframe.n b/doc/labelframe.n index 857208e..5ca5ad7 100644 --- a/doc/labelframe.n +++ b/doc/labelframe.n @@ -108,7 +108,7 @@ by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBlabelframe\fR command. .TP -\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR? +\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for @@ -4,7 +4,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH text n 8.5 Tk "Tk Built-In Commands" .so man.macros .BS @@ -1082,7 +1082,7 @@ satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==, the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers to an earlier character in the text than \fIindex2\fR, and so on. .TP -\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR? +\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for @@ -1095,7 +1095,7 @@ command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. \fIOption\fR may have any of the values accepted by the \fBtext\fR command. .TP -\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR +\fIpathName \fBcount\fR ?\fIoptions\fR? \fIindex1 index2\fR . Counts the number of relevant things between the two indices. If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number (and this holds diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n index 0da60d1..4eb67cc 100644 --- a/doc/ttk_entry.n +++ b/doc/ttk_entry.n @@ -23,7 +23,9 @@ with the \fB\-textvariable\fR option. Entry widgets support horizontal scrolling with the standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command. .SO ttk_widget -\-class \-cursor \-style +\-class \-cursor +\-font \-foreground +\-style \-takefocus \-xscrollcommand .SE .SH "WIDGET-SPECIFIC OPTIONS" @@ -34,8 +36,6 @@ If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. -.\" MAYBE: .OP \-font font Font -.\" MAYBE: .OP \-foreground foreground Foreground .\" MAYBE: .OP \-insertbackground insertBackground Foreground .\" MAYBE: .OP \-insertwidth insertWidth InsertWidth .OP \-invalidcommand invalidCommand InvalidCommand diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n index 51c0dbd..82a1520 100644 --- a/doc/ttk_widget.n +++ b/doc/ttk_widget.n @@ -93,6 +93,11 @@ Display image above, below, left of, or right of the text, respectively. .IP none Display the image if present, otherwise the text. .RE +.OP \-font font Font +Font to use for the text displayed by the widget. +.OP \-foreground textColor TextColor +The widget's foreground color. +If unspecified, the theme default is used. .OP \-image image Image Specifies an image to display. This is a list of 1 or more elements. diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 14ab250..c39cd16 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1844,6 +1844,9 @@ declare 112 aqua { declare 114 aqua { VisualID XVisualIDFromVisual(Visual *visual) } +declare 120 macosx { + int XOffsetRegion(void *rgn, int dx, int dy) +} declare 129 aqua { int XLowerWindow(Display *d, Window w) } @@ -1864,6 +1867,9 @@ declare 146 aqua { unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2) } +declare 157 macosx { + KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i) +} declare 158 aqua { void TkUnusedStubEntry(void) } diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 7c5d815..5d8f00e 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -734,7 +734,8 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual); /* Slot 117 is reserved */ /* Slot 118 is reserved */ /* Slot 119 is reserved */ -/* Slot 120 is reserved */ +/* 120 */ +EXTERN int XOffsetRegion(void *rgn, int dx, int dy); /* Slot 121 is reserved */ /* Slot 122 is reserved */ /* Slot 123 is reserved */ @@ -782,7 +783,9 @@ EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, /* Slot 154 is reserved */ /* Slot 155 is reserved */ /* Slot 156 is reserved */ -/* Slot 157 is reserved */ +/* 157 */ +EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, + int i); /* 158 */ EXTERN void TkUnusedStubEntry(void); #endif /* AQUA */ @@ -1073,7 +1076,7 @@ typedef struct TkIntXlibStubs { void (*reserved117)(void); void (*reserved118)(void); void (*reserved119)(void); - void (*reserved120)(void); + int (*xOffsetRegion) (void *rgn, int dx, int dy); /* 120 */ void (*reserved121)(void); void (*reserved122)(void); void (*reserved123)(void); @@ -1110,7 +1113,7 @@ typedef struct TkIntXlibStubs { void (*reserved154)(void); void (*reserved155)(void); void (*reserved156)(void); - void (*reserved157)(void); + KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */ void (*tkUnusedStubEntry) (void); /* 158 */ #endif /* AQUA */ } TkIntXlibStubs; @@ -1635,7 +1638,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; /* Slot 117 is reserved */ /* Slot 118 is reserved */ /* Slot 119 is reserved */ -/* Slot 120 is reserved */ +#define XOffsetRegion \ + (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */ /* Slot 121 is reserved */ /* Slot 122 is reserved */ /* Slot 123 is reserved */ @@ -1677,7 +1681,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; /* Slot 154 is reserved */ /* Slot 155 is reserved */ /* Slot 156 is reserved */ -/* Slot 157 is reserved */ +#define XkbKeycodeToKeysym \ + (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */ #define TkUnusedStubEntry \ (tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */ #endif /* AQUA */ diff --git a/generic/tkScale.c b/generic/tkScale.c index 5957b00..825f661 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -658,13 +658,11 @@ ConfigureScale( } } - /* - * Several options need special processing, such as parsing the - * orientation and creating GCs. - */ + /* + * The fromValue shall not be rounded to the resolution, but the + * toValue and tickInterval do. + */ - scalePtr->fromValue = TkRoundValueToResolution(scalePtr, - scalePtr->fromValue); scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue); scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr, scalePtr->tickInterval); diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ab8b675..9a6a0e8 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -953,7 +953,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 117 */ 0, /* 118 */ 0, /* 119 */ - 0, /* 120 */ + XOffsetRegion, /* 120 */ 0, /* 121 */ 0, /* 122 */ 0, /* 123 */ @@ -990,7 +990,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 154 */ 0, /* 155 */ 0, /* 156 */ - 0, /* 157 */ + XkbKeycodeToKeysym, /* 157 */ TkUnusedStubEntry, /* 158 */ #endif /* AQUA */ }; diff --git a/macosx/README b/macosx/README index 79025f1..0a02999 100644 --- a/macosx/README +++ b/macosx/README @@ -662,15 +662,35 @@ source and destination rectangles for the scrolling. The embedded windows are redrawn within the DisplayText function by some conditional code which is only used for macOS. -6.0 Virtual events on 10.14 -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +6.0 Virtual events on macOS 10.14 and later +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The 10.14 release added support for system appearance changes, +including a "Dark Mode" that renders all window frames and menus in +dark colors. Tk 8.6.11 provides three virtual events <<LightAqua>>, +<<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk +app's appearance when the system appearance changes. These events are +generated in [NSView effectiveAppearanceChanged], which is called by +the Apple window manager when the General Preferences is changed +either by switching between Light Mode and Dark Mode or by changing +the Accent Color or Highlight Color. + +The <<AppearanceChanged>> virtual event has a data string which can be +accessed with the %d substitution. The format of the data string is +that it consists of 6 words: + "Appearance XXXX Accent YYYY Highlight ZZZZ" +For example, the following code will print the current appearance +name, accent color and highlight color when the <<AppearanceChanged>> +virtual event fires: + +bind . <<AppearanceChanged>> { + array set data [split %d] + puts " Appearance: $data(Appearance)" + puts " Accent: $data(Accent)" + puts " Highlight: $data(Highlight)\n" +} + -10.14 supports system appearance changes, and has added a "Dark Mode" -that casts all window frames and menus as black. Tk 8.6.9 has added two -virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update -your Tk app's appearance when the system appearance changes. Just bind -your appearance-updating code to these virtual events and you will see -it triggered when the system appearance toggles between dark and light. 7.0 Mac Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 89bddb9..e9dbfec 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -23,6 +23,7 @@ static Tcl_HashTable systemColors; static int numSystemColors; static int rgbColorIndex; static int controlAccentIndex; +static int selectedTabTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 @@ -35,11 +36,14 @@ static CGFloat windowBackground[4] = void initColorTable() { + NSAutoreleasePool *pool = [NSAutoreleasePool new]; Tcl_InitHashTable(&systemColors, TCL_STRING_KEYS); SystemColorDatum *entry, *oldEntry; Tcl_HashSearch search; Tcl_HashEntry *hPtr; int newPtr, index = 0; + NSColorList *systemColorList = [NSColorList colorListNamed:@"System"]; + NSString *key; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { @@ -50,6 +54,7 @@ void initColorTable() /* * Build a hash table for looking up a color by its name. + * First add all of the static entries from tkMacOSXColor.h */ for (entry = systemColorData; entry->name != NULL; entry++) { @@ -62,7 +67,7 @@ void initColorTable() if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; - } else { + } else if (![colorName isEqualToString:@"selectedTabTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; @@ -81,6 +86,40 @@ void initColorTable() } /* + * Add all of the colors in the System ColorList. + */ + + for (key in [systemColorList allKeys]) { + int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + char *name; + entry = ckalloc(sizeof(SystemColorDatum)); + bzero(entry, sizeof(SystemColorDatum)); + name = ckalloc(length + 1); + strcpy(name, key.UTF8String); + name[0] = toupper(name[0]); + if (!strcmp(name, "WindowBackgroundColor")) { + + /* + * Avoid black windows on old systems. + */ + + continue; + } + entry->type=semantic; + entry->name = name; + entry->selector = [key retain]; + hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr); + if (newPtr == 0) { + oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + entry->index = oldEntry->index; + [oldEntry->selector release]; + } else { + entry->index = index++; + } + Tcl_SetHashValue(hPtr, entry); + } + + /* * Build an array for looking up a color by its index. */ @@ -105,6 +144,10 @@ void initColorTable() hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; + hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); + entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + selectedTabTextIndex = entry->index; + [pool drain]; } /* @@ -211,7 +254,7 @@ GetEntryFromPixel( /* *---------------------------------------------------------------------- * - * GetRGB -- + * GetRGBA -- * * Given a SystemColorDatum and a pointer to an array of 4 CGFloats, store * the associated RGBA color values in the array. In the case of the @@ -273,11 +316,21 @@ GetRGBA( case semantic: if (entry->index == controlAccentIndex && useFakeAccentColor) { #if MAC_OS_X_VERSION_MAX_ALLOWED < 101500 - color = [NSColor colorForControlTint: [NSColor currentControlTint]]; + color = [[NSColor colorForControlTint: [NSColor currentControlTint]] + colorUsingColorSpace:sRGB]; + [color getComponents: rgba]; #endif - } else { - color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; + break; } + if (entry->index == selectedTabTextIndex) { + int OSVersion = [NSApp macOSVersion]; + if (OSVersion > 100600 && OSVersion < 110000) { + color = [NSColor whiteColor]; + [color getComponents: rgba]; + break; + } + } + color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; [color getComponents: rgba]; break; case clearColor: @@ -378,23 +431,24 @@ SetCGColorComponents( MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin) { - int result = false; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { TkWindow *winPtr = (TkWindow*) tkwin; + NSAppearanceName name; NSView *view = nil; if (winPtr && winPtr->privatePtr) { view = TkMacOSXDrawableView(winPtr->privatePtr); } if (view) { - result = (view.effectiveAppearance == darkAqua); + name = [[view effectiveAppearance] name]; } else { - result = ([NSAppearance currentAppearance] == darkAqua); + name = [[NSAppearance currentAppearance] name]; } + return (name == NSAppearanceNameDarkAqua); } #endif - return result; + return false; } /* @@ -682,6 +736,7 @@ TkpGetColor( TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; + NSView *view = nil; static Bool initialized = NO; static NSColorSpace* sRGB = NULL; @@ -692,6 +747,8 @@ TkpGetColor( } if (tkwin) { display = Tk_Display(tkwin); + MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin); + view = TkMacOSXDrawableView(macWin); } /* @@ -713,12 +770,13 @@ TkpGetColor( CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 NSAppearance *savedAppearance = [NSAppearance currentAppearance]; - NSAppearance *windowAppearance; - if (TkMacOSXInDarkMode(tkwin)) { - windowAppearance = darkAqua; + NSAppearance *windowAppearance = savedAppearance; + if (view) { + windowAppearance = [view effectiveAppearance]; + } + if ([windowAppearance name] == NSAppearanceNameDarkAqua) { colormap = darkColormap; } else { - windowAppearance = lightAqua; colormap = lightColormap; } [NSAppearance setCurrentAppearance:windowAppearance]; diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 535d15d..e27500d 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -241,27 +241,14 @@ static SystemColorDatum systemColorData[] = { {"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ {"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, - -{"TextColor", semantic, 0, "textColor", 0, NULL }, -{"SelectedTextColor", semantic, 0, "selectedTextColor", 0, NULL }, -{"LabelColor", semantic, 0, "textColor", 0, NULL }, -{"LabelColor", semantic, 0, "labelColor", 0, NULL }, -{"ControlTextColor", semantic, 0, "controlTextColor", 0, NULL }, -{"DisabledControlTextColor", semantic, 0, "disabledControlTextColor", 0, NULL }, -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060 -{"SelectedTabTextColor", semantic, 0, "whiteColor", 0, NULL }, -#else -{"SelectedTabTextColor", semantic, 0, "blackColor", 0, NULL }, -#endif -{"TextBackgroundColor", semantic, 0, "textBackgroundColor", 0, NULL }, -{"SelectedTextBackgroundColor", semantic, 0, "selectedTextBackgroundColor", 0, NULL }, +/* Color to use for notebook tab labels -- depends on OS version. */ +{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL }, +/* Semantic colors that we simulate on older systems which don't supoort them. */ {"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL }, +{"LabelColor", semantic, 0, "blackColor", 0, NULL }, {"LinkColor", semantic, 0, "blueColor", 0, NULL }, -{"LinkColor", semantic, 0, "linkColor", 0, NULL }, {"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL }, -{"PlaceholderTextColor", semantic, 0, "placeholderTextColor", 0, NULL }, {"SeparatorColor", semantic, 0, "grayColor", 0, NULL }, -{"SeparatorColor", semantic, 0, "separatorColor", 0, NULL }, {NULL, 0, 0, NULL, 0, NULL } }; diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 645b72b..a31819a 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -70,7 +70,7 @@ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr); MODULE_SCOPE int TkMacOSXInitCGDrawing( Tcl_Interp *interp, - int enable, + TCL_UNUSED(int), int limit) { static Boolean initialized = FALSE; @@ -604,7 +604,7 @@ TkMacOSXGetCGContextForDrawable( bytesPerRow = ((size_t) macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15; len = macDraw->size.height * bytesPerRow; - data = ckalloc(len); + data = (char *)ckalloc(len); bzero(data, len); macDraw->context = CGBitmapContextCreate(data, macDraw->size.width, macDraw->size.height, bitsPerComponent, bytesPerRow, @@ -865,7 +865,7 @@ XFillPolygon( GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ - int shape, /* Shape to draw. */ + TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { MacDrawable *macWin = (MacDrawable *) d; @@ -976,7 +976,7 @@ XDrawRectangle( *---------------------------------------------------------------------- */ -void +int XDrawRectangles( Display *display, Drawable drawable, @@ -990,8 +990,8 @@ XDrawRectangles( int i, lw = gc->line_width; display->request++; - if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) { + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1009,6 +1009,7 @@ XDrawRectangles( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #endif @@ -1360,7 +1361,7 @@ XFillArc( *---------------------------------------------------------------------- */ -void +int XFillArcs( Display *display, Drawable d, @@ -1375,7 +1376,7 @@ XFillArcs( display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1423,6 +1424,7 @@ XFillArcs( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #endif @@ -1464,7 +1466,7 @@ XMaxRequestSize( int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ - GC gc, /* GC for window to be scrolled. */ + TCL_UNUSED(GC), /* GC for window to be scrolled. */ int x, int y, /* Position rectangle to be scrolled. */ int width, int height, int dx, int dy, /* Distance rectangle should be moved. */ @@ -1560,8 +1562,8 @@ TkScrollWindow( void TkMacOSXSetUpGraphicsPort( - GC gc, /* GC to apply to current port. */ - void *destPort) + TCL_UNUSED(GC), /* GC to apply to current port. */ + TCL_UNUSED(void *)) { Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!"); } @@ -1589,7 +1591,7 @@ Bool TkMacOSXSetupDrawingContext( Drawable d, GC gc, - int useCG, /* advisory only ! */ + TCL_UNUSED(int), TkMacOSXDrawingContext *dcPtr) { MacDrawable *macDraw = (MacDrawable *) d; @@ -1928,7 +1930,7 @@ TkMacOSXSetUpClippingRgn( void TkpClipDrawableToRect( - Display *display, + TCL_UNUSED(Display *), Drawable d, int x, int y, int width, int height) @@ -1986,7 +1988,7 @@ ClipToGC( int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin; HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn; - TkMacOSXOffsetRegion(gcClip, xOffset, yOffset); + XOffsetRegion(gcClip, xOffset, yOffset); gcClipRgn = TkMacOSXGetNativeRegion(gcClip); if (clipRgn) { *clipRgnPtr = HIShapeCreateIntersection(gcClipRgn, clipRgn); @@ -1995,7 +1997,7 @@ ClipToGC( *clipRgnPtr = HIShapeCreateCopy(gcClipRgn); } CFRelease(gcClipRgn); - TkMacOSXOffsetRegion(gcClip, -xOffset, -yOffset); + XOffsetRegion(gcClip, -xOffset, -yOffset); } } @@ -2019,8 +2021,8 @@ ClipToGC( void * TkMacOSXMakeStippleMap( - Drawable drawable, /* Window to apply stipple. */ - Drawable stipple) /* The stipple pattern. */ + TCL_UNUSED(Drawable), /* Window to apply stipple. */ + TCL_UNUSED(Drawable)) /* The stipple pattern. */ { return NULL; } diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index d3c4a0c..ab2400c 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -28,6 +28,13 @@ static char tkLibPath[PATH_MAX + 1] = ""; static char scriptPath[PATH_MAX + 1] = ""; +/* + * Forward declarations... + */ + +static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, + int objc, Tcl_Obj *const objv[]); + #pragma mark TKApplication(TKInit) @implementation TKApplication @@ -86,6 +93,7 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { + (void)aNotification; /* * Initialize notifications. @@ -117,6 +125,8 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationDidFinishLaunching:(NSNotification *)notification { + (void)notification; + /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. @@ -421,7 +431,8 @@ TkpInit( TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", + TkMacOSXGetAppPathCmd, NULL, NULL); return TCL_OK; } @@ -461,11 +472,11 @@ TkpGetAppName( } Tcl_DStringAppend(namePtr, name, -1); } - + /* *---------------------------------------------------------------------- * - * TkMacOSXGetAppPath -- + * TkMacOSXGetAppPathCmd -- * * Returns the path of the Wish application bundle. * @@ -477,42 +488,39 @@ TkpGetAppName( * *---------------------------------------------------------------------- */ -int TkMacOSXGetAppPath( - ClientData cd, - Tcl_Interp *ip, - int objc, - Tcl_Obj *const objv[]) -{ - - CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - - - /* - * Convert the URL reference into a string reference. - */ - - CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); - /* - * Get the system encoding method. - */ - - CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); +static int +TkMacOSXGetAppPathCmd( + TCL_UNUSED(ClientData), + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } - /* - * Convert the string reference into a C string. - */ + /* + * Get the application path URL and convert it to a string path reference. + */ - char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod); + CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFStringRef appPath = + CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); - Tcl_SetResult(ip, path, NULL); + /* + * Convert (and copy) the string reference into a Tcl result. + */ - CFRelease(mainBundleURL); - CFRelease(appPath); - return TCL_OK; + Tcl_SetObjResult(interp, Tcl_NewStringObj( + CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1)); + CFRelease(mainBundleURL); + CFRelease(appPath); + return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -579,7 +587,7 @@ TkMacOSXDefaultStartupScript(void) CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; - if (CFURLGetFileSystemRepresentation (appMainURL, true, + if (CFURLGetFileSystemRepresentation(appMainURL, true, (unsigned char *) startupScript, PATH_MAX)) { Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL); scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL, @@ -616,10 +624,11 @@ TkMacOSXDefaultStartupScript(void) MODULE_SCOPE void* TkMacOSXGetNamedSymbol( - const char* module, - const char* symbol) + TCL_UNUSED(const char *), + const char *symbol) { void *addr = dlsym(RTLD_NEXT, symbol); + if (!addr) { (void) dlerror(); /* Clear dlfcn error state */ } diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 8381aa7..378c30e 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -153,6 +153,8 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars, { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); +#else + (void)notification; #endif keyboardChanged = YES; UpdateKeymaps(); @@ -401,14 +403,14 @@ KeyDataToUnicode( */ KeySym -XKeycodeToKeysym( - Display* display, - KeyCode keycode, +XkbKeycodeToKeysym( + TCL_UNUSED(Display *), + unsigned int keycode, + TCL_UNUSED(int), int index) { Tcl_HashEntry *hPtr; MacKeycode macKC; - (void) display; /*unused*/ int modifiers, result; UniChar keychar = 0; @@ -459,6 +461,15 @@ XKeycodeToKeysym( } return NoSymbol; } + +KeySym +XKeycodeToKeysym( + TCL_UNUSED(Display *), + KeyCode keycode, + int index) +{ + return XkbKeycodeToKeysym(NULL, keycode, 0, index); +} /* *---------------------------------------------------------------------- @@ -479,13 +490,12 @@ XKeycodeToKeysym( const char * TkpGetString( - TkWindow *winPtr, /* Window where event occurred: Needed to get + TCL_UNUSED(TkWindow *), /* Window where event occurred: Needed to get * input context. */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold * result. */ { - (void) winPtr; /*unused*/ MacKeycode macKC; char utfChars[8]; int length = 0; @@ -519,11 +529,11 @@ TkpGetString( XModifierKeymap * XGetModifierMapping( - Display *display) + TCL_UNUSED(Display *)) { XModifierKeymap *modmap; - modmap = ckalloc(sizeof(XModifierKeymap)); + modmap = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); modmap->max_keypermod = 0; modmap->modifiermap = NULL; return modmap; @@ -578,14 +588,14 @@ XFreeModifiermap( char * XKeysymToString( - KeySym keysym) + TCL_UNUSED(KeySym)) { return NULL; } KeySym XStringToKeysym( - const char* string) + TCL_UNUSED(const char *)) { return NoSymbol; } @@ -613,7 +623,7 @@ XStringToKeysym( KeyCode XKeysymToKeycode( - Display *display, + TCL_UNUSED(Display *), KeySym keysym) { Tcl_HashEntry *hPtr; @@ -681,7 +691,7 @@ XKeysymToKeycode( */ void TkpSetKeycodeAndState( - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), KeySym keysym, XEvent *eventPtr) { @@ -813,7 +823,7 @@ TkpGetKeySym( * First do the straightforward lookup. */ - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, index); + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index); /* * Special handling: If the key was shifted because of Lock, which is only @@ -823,7 +833,7 @@ TkpGetKeySym( if ((index & INDEX_SHIFT) && !(eventPtr->xkey.state & ShiftMask)) { if ((sym == NoSymbol) || !Tcl_UniCharIsUpper(sym)) { - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index & ~INDEX_SHIFT); } } @@ -834,7 +844,7 @@ TkpGetKeySym( */ if ((index & INDEX_SHIFT) && (sym == NoSymbol)) { - sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, + sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index & ~INDEX_SHIFT); } return sym; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 379e25c..a77ea59 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -139,6 +139,7 @@ static int ModifierCharWidth(Tk_Font tkfont); @implementation TKBackgroundLoop - (void) main { + NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSArray *modeArray = [NSArray arrayWithObjects: NSEventTrackingRunLoopMode, nil]; while(1) { @@ -151,7 +152,7 @@ static int ModifierCharWidth(Tk_Font tkfont); withObject:nil waitUntilDone:true modes:modeArray]; - if (self.cancelled) { + if ([self isCancelled]) { [NSThread exit]; } @@ -161,6 +162,7 @@ static int ModifierCharWidth(Tk_Font tkfont); [NSThread sleepForTimeInterval:0.001]; } + [pool drain]; } @end diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 6109024..a6b988e 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -218,7 +218,6 @@ MODULE_SCOPE long tkMacOSXMacOSXVersion; MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r); MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r, HIShapeRef rgn); -MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy); MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void); MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect( const CGRect *inRect); @@ -557,9 +556,7 @@ VISIBILITY_HIDDEN @end #endif /* _TKMACPRIV */ - -int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); - + /* * Local Variables: * mode: objc diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index db19c94..4baa3e8 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -436,7 +436,7 @@ TkMacOSXSetWithNativeRegion( /* *---------------------------------------------------------------------- * - * TkMacOSXOffsetRegion -- + * XOffsetRegion -- * * Offsets region by given distances. * @@ -449,13 +449,14 @@ TkMacOSXSetWithNativeRegion( *---------------------------------------------------------------------- */ -void -TkMacOSXOffsetRegion( - TkRegion r, - short dx, - short dy) +int +XOffsetRegion( + void *r, + int dx, + int dy) { ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy); + return Success; } /* diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index a23a6d7..acea6f0 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -207,6 +207,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(window); if (winPtr) { TKContentView *view = [window contentView]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + [view viewDidChangeEffectiveAppearance]; +#endif [view addTkDirtyRect:[view bounds]]; Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL); Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL); @@ -1066,43 +1069,85 @@ ConfigureRestrictProc( } /* - * This method is called when a user changes between light and dark mode. The - * implementation here generates a Tk virtual event which can be bound to a - * function that redraws the window in an appropriate style. + * In macOS 10.14 and later his method is called when a user changes between + * light and dark mode or changes the accent color. The implementation + * generates two virtual events. The first is either <<LightAqua>> or + * <<DarkAqua>>, depending on the view's current effective appearance. The + * second is <<AppearnceChanged>> and has a data string describing the + * effective appearance of the view and the current accent and highlight + * colors. */ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + +static const char *const accentNames[] = { + "Graphite", + "Red", + "Orange", + "Yellow", + "Green", + "Blue", + "Purple", + "Pink" +}; + - (void) viewDidChangeEffectiveAppearance { - XVirtualEvent event; - int x, y; - NSWindow *w = [self window]; - TkWindow *winPtr = TkMacOSXGetTkWindow(w); - Tk_Window tkwin = (Tk_Window) winPtr; - - if (!winPtr) { + Tk_Window tkwin = (Tk_Window) TkMacOSXGetTkWindow([self window]); + if (!tkwin) { return; } - bzero(&event, sizeof(XVirtualEvent)); - event.type = VirtualEvent; - event.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); - event.send_event = false; - event.display = Tk_Display(tkwin); - event.event = Tk_WindowId(tkwin); - event.root = XRootWindow(Tk_Display(tkwin), 0); - event.subwindow = None; - event.time = TkpGetMS(); - XQueryPointer(NULL, winPtr->window, NULL, NULL, - &event.x_root, &event.y_root, &x, &y, &event.state); - Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); - event.same_screen = true; - if (TkMacOSXInDarkMode(tkwin)) { - event.name = Tk_GetUid("DarkAqua"); - } else { - event.name = Tk_GetUid("LightAqua"); + NSAppearanceName effectiveAppearanceName = [[self effectiveAppearance] name]; + const char *accentName, *highlightName; + NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; + NSString *accent = [preferences stringForKey:@"AppleAccentColor"]; + NSString *highlight = [[[preferences stringForKey:@"AppleHighlightColor"] + componentsSeparatedByString: @" "] + objectAtIndex:3]; + static const char *defaultColor = NULL; + + if (!defaultColor) { + defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; + + /* + * AppKit calls this method when the user changes the Accent Color + * but not when the user changes the Highlight Color. So we register + * to receive KVO notifications for Highlight Color as well. + */ + + [preferences addObserver:self + forKeyPath:@"AppleHighlightColor" + options:NSKeyValueObservingOptionNew + context:NULL]; + } + accentName = accent ? accentNames[1 + accent.intValue] : defaultColor; + highlightName = highlight ? highlight.UTF8String: defaultColor; + + char data[256]; + snprintf(data, 256, "Appearance %s Accent %s Highlight %s", + effectiveAppearanceName.UTF8String, accentName, + highlightName); + TkSendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1)); + if (effectiveAppearanceName == NSAppearanceNameAqua) { + TkSendVirtualEvent(tkwin, "LightAqua", NULL); + } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { + TkSendVirtualEvent(tkwin, "DarkAqua", NULL); + } +} + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context +{ + NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; + if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) { + [self viewDidChangeEffectiveAppearance]; } - Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } +#endif + /* * This is no-op on 10.7 and up because Apple has removed this widget, but we * are leaving it here for backwards compatibility. diff --git a/tests/entry.test b/tests/entry.test index 8512b3f..2f09f92 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -17,7 +17,7 @@ proc scroll args { global scrollInfo set scrollInfo $args } -# For trace variable +# For trace variable proc override args { global x set x 12345 @@ -70,7 +70,7 @@ test entry-1.3 {configuration option: "bd" for entry} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-1.4 {configuration option: "bd" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -107,10 +107,10 @@ test entry-1.7 {configuration option: "borderwidth" for entry} -setup { update } -body { .e configure -borderwidth 1.3 - .e cget -borderwidth + .e cget -borderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.8 {configuration option: "borderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -190,7 +190,7 @@ test entry-1.15 {configuration option: "exportselection" for entry} -setup { .e cget -exportselection } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.16 {configuration option: "exportselection" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -310,7 +310,7 @@ test entry-1.27 {configuration option: "highlightthickness" for entry} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-1.28 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -font {Helvetica -12 bold} pack .e @@ -320,7 +320,7 @@ test entry-1.28 {configuration option: "highlightthickness" for entry} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-1.29 {configuration option: "highlightthickness" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -360,7 +360,7 @@ test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup { .e cget -insertborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.33 {configuration option: "insertborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -380,7 +380,7 @@ test entry-1.34 {configuration option: "insertofftime" for entry} -setup { .e cget -insertofftime } -cleanup { destroy .e -} -result {100} +} -result 100 test entry-1.35 {configuration option: "insertofftime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -400,7 +400,7 @@ test entry-1.36 {configuration option: "insertontime" for entry} -setup { .e cget -insertontime } -cleanup { destroy .e -} -result {100} +} -result 100 test entry-1.37 {configuration option: "insertontime" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -513,7 +513,7 @@ test entry-1.47 {configuration option: "selectborderwidth" for entry} -setup { .e cget -selectborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-1.48 {configuration option: "selectborderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -606,7 +606,7 @@ test entry-1.56 {configuration option: "width" for entry} -setup { .e cget -width } -cleanup { destroy .e -} -result {402} +} -result 402 test entry-1.57 {configuration option: "width" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e @@ -800,7 +800,7 @@ test entry-3.14 {EntryWidgetCmd procedure, "cget" widget command} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e pack .e @@ -809,7 +809,7 @@ test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { llength [.e configure] } -cleanup { destroy .e -} -result {36} +} -result 36 test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e } -body { @@ -825,7 +825,7 @@ test entry-3.17 {EntryWidgetCmd procedure, "configure" widget command} -setup { lindex [.e configure -bd] 4 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.18 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { @@ -864,7 +864,7 @@ test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {014567890} +} -result 014567890 test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { @@ -873,7 +873,7 @@ test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {0123457890} +} -result 0123457890 test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -905,7 +905,7 @@ test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -918,7 +918,7 @@ test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e @@ -931,7 +931,7 @@ test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.27 {EntryWidgetCmd procedure, "get" widget command} -setup { entry .e } -body { @@ -961,7 +961,7 @@ test entry-3.30 {EntryWidgetCmd procedure, "icursor" widget command} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-3.31 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e } -body { @@ -1047,7 +1047,7 @@ test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e @@ -1060,7 +1060,7 @@ test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { @@ -1120,7 +1120,7 @@ test entry-3.46 {EntryWidgetCmd procedure, "scan" widget command} -constraints { .e index @0 } -cleanup { destroy .e -} -result {2} +} -result 2 test entry-3.47 {EntryWidgetCmd procedure, "select" widget command} -setup { entry .e } -body { @@ -1189,7 +1189,7 @@ test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e @@ -1202,7 +1202,7 @@ test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e @@ -1215,7 +1215,7 @@ test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} - .e selection present } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-3.55 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e } -body { @@ -1243,7 +1243,7 @@ test entry-3.57 {EntryWidgetCmd procedure, "selection adjust" widget command} -s selection get } -cleanup { destroy .e -} -result {123} +} -result 123 test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup { entry .e pack .e @@ -1257,7 +1257,7 @@ test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -s selection get } -cleanup { destroy .e -} -result {234} +} -result 234 test entry-3.59 {EntryWidgetCmd procedure, "selection from" widget command} -setup { entry .e } -body { @@ -1471,7 +1471,7 @@ test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {32} +} -result 32 test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1485,7 +1485,7 @@ test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {29} +} -result 29 test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1517,11 +1517,11 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -4 + .e xview -1 .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1533,7 +1533,7 @@ test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {73} +} -result 73 test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1584,7 +1584,7 @@ test entry-5.1 {ConfigureEntry procedure, -textvariable} -body { .e get } -cleanup { destroy .e -} -result {12345} +} -result 12345 test entry-5.2 {ConfigureEntry procedure, -textvariable} -body { set x 12345 entry .e -textvariable x @@ -1601,7 +1601,7 @@ test entry-5.3 {ConfigureEntry procedure, -textvariable} -setup { } -body { .e insert 0 "Some text" .e configure -textvariable x - return $x + set x } -cleanup { destroy .e } -result {Some text} @@ -1636,7 +1636,7 @@ test entry-5.5 {ConfigureEntry procedure} -setup { lappend x [selection get] .e1 configure -exportselection 1 lappend x [selection get] - return $x + set x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} @@ -1791,7 +1791,7 @@ test entry-6.4 {EntryComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-6.5 {EntryComputeGeometry procedure} -setup { entry .e -highlightthickness 2 pack .e @@ -1803,7 +1803,7 @@ test entry-6.5 {EntryComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test entry-6.6 {EntryComputeGeometry procedure} -constraints { fonts } -setup { @@ -2011,7 +2011,7 @@ test entry-7.7 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {7} +} -result 7 test entry-7.8 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2022,7 +2022,7 @@ test entry-7.8 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-7.9 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2034,7 +2034,7 @@ test entry-7.9 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {7} +} -result 7 test entry-7.10 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2046,7 +2046,7 @@ test entry-7.10 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-7.11 {InsertChars procedure} -constraints { fonts @@ -2060,7 +2060,7 @@ test entry-7.11 {InsertChars procedure} -constraints { winfo reqwidth .e } -cleanup { destroy .e -} -result {59} +} -result 59 test entry-8.1 {DeleteChars procedure} -setup { unset -nocomplain contents @@ -2087,7 +2087,7 @@ test entry-8.2 {DeleteChars procedure} -setup { .e configure -textvariable contents -xscrollcommand scroll set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] .e insert 0 abcde - .e delete -2 2 + .e delete -1 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -2245,7 +2245,7 @@ test entry-8.12 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.13 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2258,7 +2258,7 @@ test entry-8.13 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.14 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2271,7 +2271,7 @@ test entry-8.14 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-8.15 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2284,7 +2284,7 @@ test entry-8.15 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.16 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2297,7 +2297,7 @@ test entry-8.16 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-8.17 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2310,7 +2310,7 @@ test entry-8.17 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-8.18 {DeleteChars procedure} -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2322,7 +2322,7 @@ test entry-8.18 {DeleteChars procedure} -setup { winfo reqwidth .e } -cleanup { destroy .e -} -result {31} +} -result 31 test entry-9.1 {EntryValueChanged procedure} -setup { unset -nocomplain x @@ -2403,7 +2403,7 @@ test entry-10.5 {EntrySetValue procedure, updating display position} -setup { .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-10.6 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2419,7 +2419,7 @@ test entry-10.6 {EntrySetValue procedure, updating display position} -setup { .e index @0 } -cleanup { destroy .e -} -result {10} +} -result 10 test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2434,7 +2434,7 @@ test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { .e index insert } -cleanup { destroy .e -} -result {3} +} -result 3 test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 @@ -2448,7 +2448,7 @@ test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { .e index insert } -cleanup { destroy .e -} -result {5} +} -result 5 test entry-11.1 {EntryEventProc procedure} -setup { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} @@ -2492,7 +2492,7 @@ test entry-13.1 {GetEntryIndex procedure} -setup { .e index end } -cleanup { destroy .e -} -result {21} +} -result 21 test entry-13.2 {GetEntryIndex procedure} -body { entry .e .e index abogus @@ -2511,7 +2511,7 @@ test entry-13.3 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-13.4 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2524,7 +2524,7 @@ test entry-13.4 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.5 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2538,7 +2538,7 @@ test entry-13.5 {GetEntryIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {15} +} -result 15 test entry-13.6 {GetEntryIndex procedure} -setup { entry .e } -body { @@ -2557,7 +2557,7 @@ test entry-13.7 {GetEntryIndex procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {2} +} -result 2 test entry-13.8 {GetEntryIndex procedure} -setup { entry .e } -body { @@ -2622,7 +2622,7 @@ test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body { .e index sel.first } -cleanup { destroy .e -} -result {1} +} -result 1 test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body { # Previous settings: @@ -2736,7 +2736,7 @@ test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body { .e index @4 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2747,7 +2747,7 @@ test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body { .e index @11 } -cleanup { destroy .e -} -result {4} +} -result 4 test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2758,7 +2758,7 @@ test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body { .e index @12 } -cleanup { destroy .e -} -result {5} +} -result 5 test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2769,7 +2769,7 @@ test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 6}] } -cleanup { destroy .e -} -result {8} +} -result 8 test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2780,7 +2780,7 @@ test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e -} -result {9} +} -result 9 test entry-13.21 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2791,7 +2791,7 @@ test entry-13.21 {GetEntryIndex procedure} -body { .e index @1000 } -cleanup { destroy .e -} -result {9} +} -result 9 test entry-13.22 {GetEntryIndex procedure} -setup { entry .e pack .e @@ -2808,10 +2808,10 @@ test entry-13.23 {GetEntryIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -10 + .e index -1 } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-13.24 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2822,7 +2822,7 @@ test entry-13.24 {GetEntryIndex procedure} -body { .e index 12 } -cleanup { destroy .e -} -result {12} +} -result 12 test entry-13.25 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} @@ -2833,7 +2833,7 @@ test entry-13.25 {GetEntryIndex procedure} -body { .e index 49 } -cleanup { destroy .e -} -result {21} +} -result 21 test entry-13.26 {GetEntryIndex procedure} -constraints fonts -body { entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12} selection clear .e @@ -2880,7 +2880,7 @@ test entry-14.3 {EntryFetchSelection procedure} -setup { string compare [selection get] $x } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-15.1 {EntryLostSelection} -body { entry .e @@ -3003,7 +3003,7 @@ test entry-18.1 {Entry widget vs hiding} -setup { set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} -} -result {1} +} -result 1 ## ## Entry widget VALIDATION tests @@ -3025,7 +3025,7 @@ test entry-19.1 {entry widget validation} -setup { -background red -foreground white pack .e .e insert 0 a - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 1 0 a {} a all key} @@ -3057,7 +3057,7 @@ test entry-19.3 {entry widget validation} -setup { pack .e .e insert 0 ab ;# previous settings .e insert end c - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 1 2 abc ab c all key} @@ -3089,7 +3089,7 @@ test entry-19.5 {entry widget validation} -setup { pack .e .e insert 0 a123bc ;# previous settings .e delete 2 - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 0 2 a13bc a123bc 2 all key} @@ -3106,7 +3106,7 @@ test entry-19.6 {entry widget validation} -setup { .e insert 0 a13bc ;# previous settings .e configure -validate key .e delete 1 3 - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e 0 1 abc a13bc 13 key key} @@ -3123,7 +3123,7 @@ test entry-19.7 {entry widget validation} -setup { .e insert end abc ;# previous settings set ::vVals {} .e insert end d - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3142,7 +3142,7 @@ test entry-19.8 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusin} @@ -3163,7 +3163,7 @@ test entry-19.9 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focus focusout} @@ -3181,7 +3181,7 @@ test entry-19.10 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusin} @@ -3202,7 +3202,7 @@ test entry-19.11 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} all focusout} @@ -3220,7 +3220,7 @@ test entry-19.12 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focusin focusin} @@ -3239,7 +3239,7 @@ test entry-19.13 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3258,7 +3258,7 @@ test entry-19.14 {entry widget validation} -setup { focus -force .e # update necessary to process FocusIn event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {} @@ -3280,7 +3280,7 @@ test entry-19.15 {entry widget validation} -setup { focus -force . # update necessary to process FocusOut event update - return $::vVals + set ::vVals } -cleanup { destroy .e } -result {.e -1 -1 abcd abcd {} focusout focusout} @@ -3422,7 +3422,7 @@ test entry-20.1 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.2 {widget deletion while active} -body { entry .e -validate all \ @@ -3432,7 +3432,7 @@ test entry-20.2 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.3 {widget deletion while active} -body { entry .e -validate all \ @@ -3441,7 +3441,7 @@ test entry-20.3 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.4 {widget deletion while active} -body { entry .e -validate all \ @@ -3451,7 +3451,7 @@ test entry-20.4 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.5 {widget deletion while active} -body { entry .e -validatecommand { destroy .e ; return 0 } @@ -3459,7 +3459,7 @@ test entry-20.5 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.6 {widget deletion while active} -body { pack [entry .e] @@ -3469,7 +3469,7 @@ test entry-20.6 {widget deletion while active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-20.7 {widget deletion with textvariable active} -body { # SF bugs 607390 and 617446 @@ -3481,7 +3481,7 @@ test entry-20.7 {widget deletion with textvariable active} -body { winfo exists .e } -cleanup { destroy .e -} -result {0} +} -result 0 test entry-21.1 {selection present while disabled, bug 637828} -body { diff --git a/tests/listbox.test b/tests/listbox.test index 3a6c860..42dc327 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -376,15 +376,15 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body { test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate -1 .l index active -} -result {0} +} -result 0 test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate 30 .l index active -} -result {17} +} -result 17 test listbox-3.8 {ListboxWidgetCmd procedure, "activate" option} -body { .l activate end .l index active -} -result {17} +} -result 17 test listbox-3.9 {ListboxWidgetCmd procedure, "bbox" option} -body { .l bbox } -returnCodes error -result {wrong # args: should be ".l bbox index"} @@ -508,7 +508,7 @@ test listbox-3.18b {ListboxWidgetCmd procedure, "bbox" option, justified, non-de } -cleanup { destroy .top.l .top unset -nocomplain lres res -} -result {1} +} -result 1 test listbox-3.19 {ListboxWidgetCmd procedure, "cget" option} -body { .l cget } -returnCodes error -result {wrong # args: should be ".l cget option"} @@ -520,10 +520,10 @@ test listbox-3.21 {ListboxWidgetCmd procedure, "cget" option} -body { } -returnCodes error -result {unknown option "-gorp"} test listbox-3.22 {ListboxWidgetCmd procedure, "cget" option} -body { .l cget -setgrid -} -result {0} +} -result 0 test listbox-3.23 {ListboxWidgetCmd procedure, "configure" option} -body { llength [.l configure] -} -result {28} +} -result 28 test listbox-3.24 {ListboxWidgetCmd procedure, "configure" option} -body { .l configure -gorp } -returnCodes error -result {unknown option "-gorp"} @@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -3 2 + .l2 delete -1 2 .l2 get 0 end } -cleanup { destroy .l2 @@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -3 -1 + .l2 delete -1 -1 .l2 get 0 end } -cleanup { destroy .l2 @@ -684,10 +684,10 @@ test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { .l get -1 } -result {} test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -2 -1 + .l get -1 -1 } -result {} test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -2 3 + .l get -1 3 } -result {el0 el1 el2 el3} test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 end @@ -783,7 +783,7 @@ test listbox-3.72 {ListboxWidgetCmd procedure, "nearest" option} -body { test listbox-3.73 {ListboxWidgetCmd procedure, "nearest" option} -body { .l yview 3 .l nearest 1000 -} -result {7} +} -result 7 test listbox-3.74 {ListboxWidgetCmd procedure, "scan" option} -body { .l scan a b } -returnCodes error -result {wrong # args: should be ".l scan mark|dragto x y"} @@ -830,52 +830,52 @@ test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 7 .l index @0,0 -} -result {7} +} -result 7 test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 11 .l index @0,0 -} -result {7} +} -result 7 test listbox-3.85 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 6 .l index @0,0 -} -result {6} +} -result 6 test listbox-3.86 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 5 .l index @0,0 -} -result {3} +} -result 3 test listbox-3.87 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 12 .l index @0,0 -} -result {8} +} -result 8 test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 13 .l index @0,0 -} -result {11} +} -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see -1 .l index @0,0 -} -result {0} +} -result 0 test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see end .l index @0,0 -} -result {13} +} -result 13 test listbox-3.91 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 .l see 322 .l index @0,0 -} -result {13} +} -result 13 test listbox-3.92 {ListboxWidgetCmd procedure, "see" option, partial last line} -body { mkPartial .partial.l see 4 .partial.l index @0,0 -} -result {1} +} -result 1 test listbox-3.93 {ListboxWidgetCmd procedure, "selection" option} -body { .l select a } -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"} @@ -898,15 +898,15 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body { test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor -1 .l index anchor -} -result {0} +} -result 0 test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor end .l index anchor -} -result {17} +} -result 17 test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection anchor 44 .l index anchor -} -result {17} +} -result 17 test listbox-3.102 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set 2 8 @@ -926,16 +926,16 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body { test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end .l selection includes -1 -} -result {0} +} -result 0 test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set end .l selection includes end -} -result {1} +} -result 1 test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end .l selection includes 44 -} -result {0} +} -result 0 test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup { destroy .l2 } -body { @@ -943,7 +943,7 @@ test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup { .l2 selection includes 0 } -cleanup { destroy .l2 -} -result {0} +} -result 0 test listbox-3.109 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end .l selection set 2 @@ -965,7 +965,7 @@ test listbox-3.112 {ListboxWidgetCmd procedure, "size" option} -body { } -returnCodes error -result {wrong # args: should be ".l size"} test listbox-3.113 {ListboxWidgetCmd procedure, "size" option} -body { .l size -} -result {18} +} -result 18 test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} -setup { destroy .l2 } -body { @@ -1242,7 +1242,7 @@ test listbox-4.2 {ConfigureListbox procedure} -setup { .l cget -highlightthickness } -cleanup { deleteWindows -} -result {0} +} -result 0 test listbox-4.3 {ConfigureListbox procedure} -setup { deleteWindows destroy .l @@ -1573,14 +1573,14 @@ test listbox-6.2 {InsertEls procedure} -body { .l selection anchor 2 .l insert 2 A B .l index anchor -} -result {4} +} -result 4 test listbox-6.3 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 2 .l insert 3 A B .l index anchor -} -result {2} +} -result 2 test listbox-6.4 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1588,7 +1588,7 @@ test listbox-6.4 {InsertEls procedure} -body { update .l insert 2 A B .l index @0,0 -} -result {5} +} -result 5 test listbox-6.5 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1596,31 +1596,31 @@ test listbox-6.5 {InsertEls procedure} -body { update .l insert 3 A B .l index @0,0 -} -result {3} +} -result 3 test listbox-6.6 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 5 .l insert 5 A B .l index active -} -result {7} +} -result 7 test listbox-6.7 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 5 .l insert 6 A B .l index active -} -result {5} +} -result 5 test listbox-6.8 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b c .l index active -} -result {2} +} -result 2 test listbox-6.9 {InsertEls procedure} -body { .l delete 0 end .l insert 0 .l index active -} -result {0} +} -result 0 test listbox-6.10 {InsertEls procedure} -body { .l delete 0 end .l insert 0 a b "two words" c d e f g h i j @@ -1728,28 +1728,28 @@ test listbox-7.5 {DeleteEls procedure} -body { .l selection anchor 2 .l delete 0 1 .l index anchor -} -result {0} +} -result 0 test listbox-7.6 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 2 .l delete 2 .l index anchor -} -result {2} +} -result 2 test listbox-7.7 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 4 .l delete 2 5 .l index anchor -} -result {2} +} -result 2 test listbox-7.8 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l selection anchor 3 .l delete 4 5 .l index anchor -} -result {3} +} -result 3 test listbox-7.9 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1757,7 +1757,7 @@ test listbox-7.9 {DeleteEls procedure} -body { update .l delete 1 2 .l index @0,0 -} -result {1} +} -result 1 test listbox-7.10 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1765,7 +1765,7 @@ test listbox-7.10 {DeleteEls procedure} -body { update .l delete 3 4 .l index @0,0 -} -result {3} +} -result 3 test listbox-7.11 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1773,7 +1773,7 @@ test listbox-7.11 {DeleteEls procedure} -body { update .l delete 4 6 .l index @0,0 -} -result {3} +} -result 3 test listbox-7.12 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j @@ -1781,42 +1781,42 @@ test listbox-7.12 {DeleteEls procedure} -body { update .l delete 3 end .l index @0,0 -} -result {1} +} -result 1 test listbox-7.13 {DeleteEls procedure, updating view with partial last line} -body { mkPartial .partial.l yview 8 update .partial.l delete 10 13 .partial.l index @0,0 -} -result {7} +} -result 7 test listbox-7.14 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 3 4 .l index active -} -result {4} +} -result 4 test listbox-7.15 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 5 7 .l index active -} -result {5} +} -result 5 test listbox-7.16 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 5 end .l index active -} -result {4} +} -result 4 test listbox-7.17 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c d e f g h i j .l activate 6 .l delete 0 end .l index active -} -result {0} +} -result 0 test listbox-7.18 {DeleteEls procedure} -body { .l delete 0 end .l insert 0 a b c "two words" d e f g h i j @@ -1987,7 +1987,7 @@ test listbox-10.5 {GetListboxIndex procedure} -setup { .l index end } -cleanup { destroy .l -} -result {12} +} -result 12 test listbox-10.6 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2102,7 +2102,7 @@ test listbox-10.16 {GetListboxIndex procedure} -setup { .l index 3 } -cleanup { destroy .l -} -result {3} +} -result 3 test listbox-10.17 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup { .l index 20 } -cleanup { destroy .l -} -result {20} +} -result 20 test listbox-10.18 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2129,10 +2129,10 @@ test listbox-10.19 {GetListboxIndex procedure} -setup { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update - .l index -2 + .l index -1 } -cleanup { destroy .l -} -result -2 +} -result -1 test listbox-10.20 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2226,7 +2226,7 @@ test listbox-11.6 {ChangeListboxView procedure, partial last line} -body { .partial.l index @0,0 } -cleanup { destroy .l -} -result {11} +} -result 11 # Listbox used in 12.* tests @@ -2314,7 +2314,7 @@ test listbox-13.3 {ListboxScanTo procedure} -constraints { test listbox-14.1 {NearestListboxElement procedure, partial last line} -body { mkPartial .partial.l nearest [winfo height .partial.l] -} -result {4} +} -result 4 # Listbox used in 14.* tests destroy .l listbox .l -font $fixed -width 20 -height 10 @@ -2326,7 +2326,7 @@ test listbox-14.2 {NearestListboxElement procedure} -constraints { fonts } -body { .l index @50,0 -} -result {4} +} -result 4 test listbox-14.3 {NearestListboxElement procedure} -constraints { fonts } -body { @@ -2336,7 +2336,7 @@ test listbox-14.4 {NearestListboxElement procedure} -constraints { fonts } -body { .l index @50,200 -} -result {13} +} -result 13 # Listbox used in 15.* 16.* and 17.* tests @@ -2378,7 +2378,7 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -2 -1 + .l select set -1 -1 .l curselection } -result {} test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body { @@ -2415,7 +2415,7 @@ test listbox-15.9 {ListboxSelect procedure, boundary conditions for indices} -bo .l select clear 0 end .l select set end 30 .l curselection -} -result {5} +} -result 5 test listbox-15.10 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f @@ -2451,7 +2451,7 @@ test listbox-16.3 {ListboxFetchSelection procedure, retrieve in several parts} - string compare 1$long\n2$long\n3$long\n4$long\n5$long $sel } -cleanup { catch {unset long sel} -} -result {0} +} -result 0 test listbox-17.1 {ListboxLostSelection procedure} -setup { diff --git a/tests/spinbox.test b/tests/spinbox.test index 3f55d7f..8d19a7e 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -17,7 +17,7 @@ proc scroll args { global scrollInfo set scrollInfo $args } -# For trace variable +# For trace variable proc override args { global x set x 12345 @@ -94,7 +94,7 @@ test spinbox-1.5 {configuration option: "bd"} -setup { .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-1.6 {configuration option: "bd" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -138,7 +138,7 @@ test spinbox-1.9 {configuration option: "borderwidth"} -setup { .e cget -borderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.10 {configuration option: "borderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -282,7 +282,7 @@ test spinbox-1.22 {configuration option: "exportselection"} -setup { .e cget -exportselection } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.23 {configuration option: "exportselection" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -458,7 +458,7 @@ test spinbox-1.38 {configuration option: "highlightthickness"} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-1.39 {configuration option: "highlightthickness" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -480,7 +480,7 @@ test spinbox-1.40 {configuration option: "highlightthickness"} -setup { .e cget -highlightthickness } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-1.41 {configuration option: "increment"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ @@ -536,7 +536,7 @@ test spinbox-1.45 {configuration option: "insertborderwidth"} -setup { .e cget -insertborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.46 {configuration option: "insertborderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -558,7 +558,7 @@ test spinbox-1.47 {configuration option: "insertofftime"} -setup { .e cget -insertofftime } -cleanup { destroy .e -} -result {100} +} -result 100 test spinbox-1.48 {configuration option: "insertofftime" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -580,7 +580,7 @@ test spinbox-1.49 {configuration option: "insertontime"} -setup { .e cget -insertontime } -cleanup { destroy .e -} -result {100} +} -result 100 test spinbox-1.50 {configuration option: "insertontime" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -692,7 +692,7 @@ test spinbox-1.59 {configuration option: "repeatdelay"} -setup { .e cget -repeatdelay } -cleanup { destroy .e -} -result {500} +} -result 500 test spinbox-1.60 {configuration option: "repeatdelay" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -758,7 +758,7 @@ test spinbox-1.65 {configuration option: "selectborderwidth"} -setup { .e cget -selectborderwidth } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.66 {configuration option: "selectborderwidth" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -938,7 +938,7 @@ test spinbox-1.81 {configuration option: "width"} -setup { .e cget -width } -cleanup { destroy .e -} -result {402} +} -result 402 test spinbox-1.82 {configuration option: "width" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -960,7 +960,7 @@ test spinbox-1.83 {configuration option: "wrap"} -setup { .e cget -wrap } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-1.84 {configuration option: "wrap" for spinbox} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken @@ -1018,7 +1018,7 @@ test spinbox-2.5 {Tk_SpinboxCmd procedure} -body { test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1027,7 +1027,7 @@ test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e option ?arg ...?"} test spinbox-3.2 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1036,7 +1036,7 @@ test spinbox-3.2 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.3 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1045,7 +1045,7 @@ test spinbox-3.3 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.4 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1054,7 +1054,7 @@ test spinbox-3.4 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -returnCodes error -result {bad spinbox index "bogus"} test spinbox-3.5 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1063,7 +1063,7 @@ test spinbox-3.5 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { destroy .e } -result [list 5 5 0 $cy] -# Oryginaly the result was count using measurements +# Oryginaly the result was count using measurements # and metrics. It was changed to less verbose solution - the result is the one # that passes fonts constraint (this concerns tests 3.6, 3.7, 3.8, 3.10) test spinbox-3.6 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { @@ -1082,7 +1082,7 @@ test spinbox-3.6 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1095,7 +1095,7 @@ test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1106,7 +1106,7 @@ test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint destroy .e } -result {31 5 7 13} test spinbox-3.9 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1118,7 +1118,7 @@ test spinbox-3.9 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1128,82 +1128,82 @@ test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constrain destroy .e } -result {{5 5 7 13} {12 5 7 13} {75 5 12 13} {122 5 7 13}} test spinbox-3.11 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.12 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.13 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e cget -gorp } -cleanup { destroy .e } -returnCodes error -result {unknown option "-gorp"} test spinbox-3.14 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -bd 4 .e cget -bd } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { llength [.e configure] } -cleanup { destroy .e -} -result {49} +} -result 49 test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -foo } -cleanup { destroy .e } -returnCodes error -result {unknown option "-foo"} test spinbox-3.17 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { - spinbox .e + spinbox .e } -body { .e configure -bd 4 .e configure -bg #ffffff lindex [.e configure -bd] 4 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.18 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.19 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.20 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.21 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e delete 0 bar } -cleanup { @@ -1212,27 +1212,27 @@ test spinbox-3.21 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { test spinbox-3.22 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e delete 2 4 .e get } -cleanup { destroy .e -} -result {014567890} +} -result 014567890 test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "01234567890" .e delete 6 .e get } -cleanup { destroy .e -} -result {0123457890} +} -result 0123457890 test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update set x {} } -body { # UTF @@ -1253,18 +1253,18 @@ test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e delete 6 5 .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state disabled @@ -1273,11 +1273,11 @@ test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state readonly @@ -1286,53 +1286,53 @@ test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.27 {SpinboxWidgetCmd procedure, "get" widget command} -setup { - spinbox .e + spinbox .e } -body { .e get foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e get"} test spinbox-3.28 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e icursor } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e icursor pos"} test spinbox-3.29 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e icursor foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.30 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "01234567890" .e icursor 4 .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-3.31 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e in } -cleanup { destroy .e } -returnCodes error -result {ambiguous option "in": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview} test spinbox-3.32 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e index } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e index string"} test spinbox-3.33 {SpinboxWidgetCmd procedure, "index" widget command} -setup { - spinbox .e + spinbox .e } -body { .e index foo } -cleanup { @@ -1341,7 +1341,7 @@ test spinbox-3.33 {SpinboxWidgetCmd procedure, "index" widget command} -setup { test spinbox-3.34 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e - update + update } -body { .e index 0 } -cleanup { @@ -1350,7 +1350,7 @@ test spinbox-3.34 {SpinboxWidgetCmd procedure, "index" widget command} -setup { test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e - update + update } -body { # UTF .e insert 0 abc\u4e4e\u0153def @@ -1359,21 +1359,21 @@ test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { destroy .e } -result {3 4 8} test spinbox-3.36 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.37 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.38 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert foo Text } -cleanup { @@ -1382,7 +1382,7 @@ test spinbox-3.38 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { test spinbox-3.39 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e insert 3 xxx @@ -1393,7 +1393,7 @@ test spinbox-3.39 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state disabled @@ -1402,11 +1402,11 @@ test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "01234567890" .e configure -state readonly @@ -1415,16 +1415,16 @@ test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup .e get } -cleanup { destroy .e -} -result {01234567890} +} -result 01234567890 test spinbox-3.41 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.42 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -1435,7 +1435,7 @@ test spinbox-3.42 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.43 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan a b c } -cleanup { @@ -1444,7 +1444,7 @@ test spinbox-3.43 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan foobar 20 } -cleanup { @@ -1453,7 +1453,7 @@ test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e - update + update } -body { .e scan mark 20.1 } -cleanup { @@ -1464,7 +1464,7 @@ test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constraints { fonts } -setup { - spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1475,16 +1475,16 @@ test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constrain .e index @0 } -cleanup { destroy .e -} -result {2} +} -result 2 test spinbox-3.47 {SpinboxWidgetCmd procedure, "select" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection option ?index?"} test spinbox-3.48 {SpinboxWidgetCmd procedure, "select" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select foo } -cleanup { @@ -1492,28 +1492,28 @@ test spinbox-3.48 {SpinboxWidgetCmd procedure, "select" widget command} -setup { } -returnCodes error -result {bad selection option "foo": must be adjust, clear, element, from, present, range, or to} test spinbox-3.49 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { - spinbox .e + spinbox .e } -body { .e select clear gorp } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection clear"} test spinbox-3.50 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { - spinbox .e + spinbox .e } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear - selection get + selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test spinbox-3.50.1 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end "0123456789" .e select from 1 @@ -1527,7 +1527,7 @@ test spinbox-3.50.1 {SpinboxWidgetCmd procedure, "select clear" widget command} } -result {.e} test spinbox-3.51 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { - spinbox .e + spinbox .e } -body { .e selection present foo } -cleanup { @@ -1536,7 +1536,7 @@ test spinbox-3.51 {SpinboxWidgetCmd procedure, "selection present" widget comman test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1544,11 +1544,11 @@ test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1557,11 +1557,11 @@ test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e - update + update } -body { .e insert end 0123456789 .e select from 3 @@ -1570,7 +1570,7 @@ test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget comman .e selection present } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-3.55 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup { spinbox .e } -body { @@ -1598,7 +1598,7 @@ test spinbox-3.57 {SpinboxWidgetCmd procedure, "selection adjust" widget command selection get } -cleanup { destroy .e -} -result {123} +} -result 123 test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup { spinbox .e pack .e @@ -1612,7 +1612,7 @@ test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command selection get } -cleanup { destroy .e -} -result {234} +} -result 234 test spinbox-3.59 {SpinboxWidgetCmd procedure, "selection from" widget command} -setup { spinbox .e } -body { @@ -1700,7 +1700,7 @@ test spinbox-3.64.2 {SpinboxWidgetCmd procedure, "selection" widget command} -se } -result {2 4} test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1712,7 +1712,7 @@ test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.053763 0.268817} test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1721,7 +1721,7 @@ test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {bad spinbox index "gorp"} test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1735,7 +1735,7 @@ test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.107527 0.322581} test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1744,7 +1744,7 @@ test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview moveto fraction"} test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1753,7 +1753,7 @@ test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {expected floating-point number but got "foo"} test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1765,7 +1765,7 @@ test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.505376 0.720430} test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1776,7 +1776,7 @@ test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview scroll number units|pages"} test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1787,7 +1787,7 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {expected integer but got "gorp"} test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1800,7 +1800,7 @@ test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.193548 0.408602} test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1814,7 +1814,7 @@ test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -result {0.397849 0.612903} test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1822,13 +1822,13 @@ test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { update .e xview 30 update - .e xview scroll 2 units + .e xview scroll 2 units .e index @0 } -cleanup { destroy .e -} -result {32} +} -result 32 test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1836,13 +1836,13 @@ test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { update .e xview 30 update - .e xview scroll -1 units + .e xview scroll -1 units .e index @0 } -cleanup { destroy .e -} -result {29} +} -result 29 test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1853,7 +1853,7 @@ test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {bad argument "foobars": must be units or pages} test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1864,7 +1864,7 @@ test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { destroy .e } -returnCodes error -result {unknown option "eat": must be moveto or scroll} test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1872,13 +1872,13 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -4 + .e xview -1 .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1888,9 +1888,9 @@ test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e index @0 } -cleanup { destroy .e -} -result {73} +} -result 73 test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " @@ -1912,7 +1912,7 @@ test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { } -result {0.095745 0.106383 0.117021} test spinbox-3.82 {SpinboxWidgetCmd procedure} -setup { - spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { @@ -1927,7 +1927,7 @@ test spinbox-5.1 {ConfigureSpinbox procedure, -textvariable} -body { .e get } -cleanup { destroy .e -} -result {12345} +} -result 12345 test spinbox-5.2 {ConfigureSpinbox procedure, -textvariable} -body { set x 12345 spinbox .e -textvariable x @@ -1983,14 +1983,14 @@ test spinbox-5.5 {ConfigureSpinbox procedure} -setup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test spinbox-5.6 {ConfigureSpinbox procedure} -setup { - spinbox .e + spinbox .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 - selection get + selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} @@ -2002,14 +2002,14 @@ test spinbox-5.6.1 {ConfigureSpinbox procedure} -setup { .e select from 1 .e select to 5 .e configure -exportselection 0 - catch {selection get} + catch {selection get} list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5} test spinbox-5.7 {ConfigureSpinbox procedure} -setup { - spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 + spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll @@ -2027,7 +2027,7 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup { test spinbox-5.8 {ConfigureSpinbox procedure} -constraints { fonts } -setup { - spinbox .e -borderwidth 2 -highlightthickness 2 + spinbox .e -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -width 0 -font {Helvetica -12} @@ -2082,7 +2082,7 @@ test spinbox-5.11 {ConfigureSpinbox procedure} -setup { test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -highlightthickness 3 @@ -2095,7 +2095,7 @@ test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { test spinbox-6.2 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify center \ @@ -2109,7 +2109,7 @@ test spinbox-6.2 {SpinboxComputeGeometry procedure} -constraints { test spinbox-6.3 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify right \ @@ -2121,7 +2121,7 @@ test spinbox-6.3 {SpinboxComputeGeometry procedure} -constraints { destroy .e } -result {3 4} test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup { - spinbox .e + spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 @@ -2131,26 +2131,26 @@ test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Courier -12} -bd 2 -relief raised -width 5 + .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 7 .e index @0 } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-6.6 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Courier -12} -bd 2 -relief raised -width 10 + .e configure -font {Courier -12} -bd 2 -relief raised -width 10 .e insert end "01234\t67890" update .e xview 3 @@ -2190,7 +2190,7 @@ test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { spinbox .e -highlightthickness 2 pack .e } -body { - .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 + .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { @@ -2199,7 +2199,7 @@ test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { test spinbox-7.1 {InsertChars procedure} -setup { - unset -nocomplain contents + unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e @@ -2217,8 +2217,8 @@ test spinbox-7.1 {InsertChars procedure} -setup { } -result {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-7.2 {InsertChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2290,7 +2290,7 @@ test spinbox-7.6 {InsertChars procedure} -setup { destroy .e } -result {2 6 2 5} test spinbox-7.7 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -xscrollcommand scroll @@ -2300,9 +2300,9 @@ test spinbox-7.7 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {7} +} -result 7 test spinbox-7.8 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789 @@ -2311,9 +2311,9 @@ test spinbox-7.8 {InsertChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-7.9 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" @@ -2323,9 +2323,9 @@ test spinbox-7.9 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {7} +} -result 7 test spinbox-7.10 {InsertChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" @@ -2335,12 +2335,12 @@ test spinbox-7.10 {InsertChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-7.11 {InsertChars procedure} -constraints { fonts } -setup { - spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "xyzzy" @@ -2349,11 +2349,11 @@ test spinbox-7.11 {InsertChars procedure} -constraints { winfo reqwidth .e } -cleanup { destroy .e -} -result {70} +} -result 70 test spinbox-8.1 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2369,8 +2369,8 @@ test spinbox-8.1 {DeleteChars procedure} -setup { after cancel $timeout } -result {abe abe {0.000000 1.000000}} test spinbox-8.2 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2378,7 +2378,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup { .e insert 0 abcde update idletasks set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] - .e delete -2 2 + .e delete -1 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -2386,8 +2386,8 @@ test spinbox-8.2 {DeleteChars procedure} -setup { after cancel $timeout } -result {cde cde {0.000000 1.000000}} test spinbox-8.3 {DeleteChars procedure} -setup { - unset -nocomplain contents - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + unset -nocomplain contents + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2403,7 +2403,7 @@ test spinbox-8.3 {DeleteChars procedure} -setup { after cancel $timeout } -result {abc abc {0.000000 1.000000}} test spinbox-8.4 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2419,7 +2419,7 @@ test spinbox-8.4 {DeleteChars procedure} -setup { destroy .e } -result {1 6 1 5} test spinbox-8.5 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2435,7 +2435,7 @@ test spinbox-8.5 {DeleteChars procedure} -setup { destroy .e } -result {1 5 1 4} test spinbox-8.6 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2451,7 +2451,7 @@ test spinbox-8.6 {DeleteChars procedure} -setup { destroy .e } -result {1 2 1 5} test spinbox-8.7 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2465,7 +2465,7 @@ test spinbox-8.7 {DeleteChars procedure} -setup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.8 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2481,7 +2481,7 @@ test spinbox-8.8 {DeleteChars procedure} -setup { destroy .e } -result {3 4 3 8} test spinbox-8.9 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789abcde @@ -2494,7 +2494,7 @@ test spinbox-8.9 {DeleteChars procedure} -setup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.10 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2510,7 +2510,7 @@ test spinbox-8.10 {DeleteChars procedure} -setup { destroy .e } -result {3 5 5 8} test spinbox-8.11 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2526,7 +2526,7 @@ test spinbox-8.11 {DeleteChars procedure} -setup { destroy .e } -result {3 8 4 8} test spinbox-8.12 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2537,9 +2537,9 @@ test spinbox-8.12 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.13 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2550,9 +2550,9 @@ test spinbox-8.13 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.14 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2563,9 +2563,9 @@ test spinbox-8.14 {DeleteChars procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-8.15 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2576,9 +2576,9 @@ test spinbox-8.15 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.16 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2589,9 +2589,9 @@ test spinbox-8.16 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-8.17 {DeleteChars procedure} -setup { - spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2602,9 +2602,9 @@ test spinbox-8.17 {DeleteChars procedure} -setup { .e index @0 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-8.18 {DeleteChars procedure} -setup { - spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 + spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { @@ -2614,7 +2614,7 @@ test spinbox-8.18 {DeleteChars procedure} -setup { winfo reqwidth .e } -cleanup { destroy .e -} -result {42} +} -result 42 test spinbox-9.1 {SpinboxValueChanged procedure} -setup { unset -nocomplain x @@ -2634,7 +2634,7 @@ test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { set y ab spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 pack .e - .e configure -textvariable x + .e configure -textvariable x .e configure -textvariable y update list [.e get] [winfo reqwidth .e] @@ -2643,7 +2643,7 @@ test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { } -result {ab 35} test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2656,7 +2656,7 @@ test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup { } -returnCodes error -result {selection isn't in widget .e} test spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2669,7 +2669,7 @@ test spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup { } -result {4 7} test spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x - spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 + spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x @@ -2682,7 +2682,7 @@ test spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup { } -result {4 10} test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2694,10 +2694,10 @@ test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup .e index @0 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2710,10 +2710,10 @@ test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup .e index @0 } -cleanup { destroy .e -} -result {10} +} -result 10 test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e update } -body { @@ -2725,10 +2725,10 @@ test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup .e index insert } -cleanup { destroy .e -} -result {3} +} -result 3 test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x - spinbox .e -highlightthickness 2 -bd 2 + spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x @@ -2739,7 +2739,7 @@ test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup .e index insert } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-11.1 {SpinboxEventProc procedure} -setup { spinbox .e -highlightthickness 2 -bd 2 -font {Helvetica -12} @@ -2783,9 +2783,9 @@ test spinbox-13.1 {GetSpinboxIndex procedure} -setup { .e index end } -cleanup { destroy .e -} -result {21} +} -result 21 test spinbox-13.2 {GetSpinboxIndex procedure} -body { - spinbox .e + spinbox .e .e index abogus } -cleanup { destroy .e @@ -2802,7 +2802,7 @@ test spinbox-13.3 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-13.4 {GetSpinboxIndex procedure} -setup { spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2815,7 +2815,7 @@ test spinbox-13.4 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.5 {GetSpinboxIndex procedure} -setup { spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e @@ -2829,7 +2829,7 @@ test spinbox-13.5 {GetSpinboxIndex procedure} -setup { .e index anchor } -cleanup { destroy .e -} -result {15} +} -result 15 test spinbox-13.6 {GetSpinboxIndex procedure} -setup { spinbox .e } -body { @@ -2848,7 +2848,7 @@ test spinbox-13.7 {GetSpinboxIndex procedure} -setup { .e index insert } -cleanup { destroy .e -} -result {2} +} -result 2 test spinbox-13.8 {GetSpinboxIndex procedure} -setup { spinbox .e } -body { @@ -2871,7 +2871,7 @@ test spinbox-13.9 {GetSpinboxIndex procedure} -setup { } -result {1 6} test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { -# On unix, when selection is cleared, spinbox widget's internal +# On unix, when selection is cleared, spinbox widget's internal # selection range is reset. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2891,7 +2891,7 @@ test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2908,7 +2908,7 @@ test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { .e index sel.first } -cleanup { destroy .e -} -result {1} +} -result 1 test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body { # Previous settings: @@ -2963,7 +2963,7 @@ test spinbox-13.13 {GetSpinboxIndex procedure} -constraints win -body { test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2976,14 +2976,14 @@ test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e - selection get + selection get } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test spinbox-13.14.1 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers -# last selected range. When selection ownership is restored to +# last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken @@ -2995,9 +2995,9 @@ test spinbox-13.14.1 {GetSpinboxIndex procedure} -constraints win -body { .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: - selection clear .e - catch {selection get} - .e index sbogus + selection clear .e + catch {selection get} + .e index sbogus } -cleanup { destroy .e } -returnCodes error -match glob -result {*} @@ -3012,7 +3012,7 @@ test spinbox-13.15 {GetSpinboxIndex procedure} -body { test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3020,10 +3020,10 @@ test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @4 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3031,10 +3031,10 @@ test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @11 } -cleanup { destroy .e -} -result {4} +} -result 4 test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3042,10 +3042,10 @@ test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @12 } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3053,10 +3053,10 @@ test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 6-11}] } -cleanup { destroy .e -} -result {8} +} -result 8 test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3064,10 +3064,10 @@ test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body { .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e -} -result {9} +} -result 9 test spinbox-13.21 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3075,9 +3075,9 @@ test spinbox-13.21 {GetSpinboxIndex procedure} -body { .e index @1000 } -cleanup { destroy .e -} -result {9} +} -result 9 test spinbox-13.22 {GetSpinboxIndex procedure} -setup { - spinbox .e + spinbox .e pack .e update } -body { @@ -3087,18 +3087,18 @@ test spinbox-13.22 {GetSpinboxIndex procedure} -setup { } -returnCodes error -result {bad spinbox index "1xyz"} test spinbox-13.23 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update - .e index -10 + .e index -1 } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-13.24 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3106,10 +3106,10 @@ test spinbox-13.24 {GetSpinboxIndex procedure} -body { .e index 12 } -cleanup { destroy .e -} -result {12} +} -result 12 test spinbox-13.25 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ - -font {Courier -12} + -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 @@ -3117,7 +3117,7 @@ test spinbox-13.25 {GetSpinboxIndex procedure} -body { .e index 49 } -cleanup { destroy .e -} -result {21} +} -result 21 # XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo. @@ -3137,13 +3137,13 @@ test spinbox-14.3 {SpinboxFetchSelection procedure} -setup { } } -body { spinbox .e - .e insert end $x + .e insert end $x .e select from 0 .e select to end string compare [selection get] $x } -cleanup { destroy .e -} -result {0} +} -result 0 test spinbox-15.1 {SpinboxLostSelection} -body { spinbox .e @@ -3164,7 +3164,7 @@ test spinbox-16.1 {SpinboxVisibleRange procedure} -constraints fonts -body { spinbox .e -width 10 -font {Helvetica -12} pack .e update - .e insert 0 "............................." + .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e @@ -3209,7 +3209,7 @@ test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body { update idletasks set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] .e insert 0 abcdefghijklmnopqrs - .e xview + .e xview vwait scrollInfo format {%.6f %.6f} {*}$scrollInfo } -cleanup { @@ -3246,7 +3246,7 @@ test spinbox-18.1 {Spinbox widget vs hiding} -setup { set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} -} -result {1} +} -result 1 ## ## Spinbox widget VALIDATION tests @@ -3600,7 +3600,7 @@ test spinbox-19.19 {spinbox widget validation} -setup { -background red -foreground white pack .e set ::e nextdata ;# previous settings - + .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] .e validate list [.e cget -validate] [.e get] $::vVals @@ -3625,7 +3625,7 @@ test spinbox-19.20 {spinbox widget validation} -setup { set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings - + .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals @@ -3807,7 +3807,7 @@ test spinbox-22.1 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body { set val 5 spinbox .e -from 1 -to 10 -textvariable val @@ -3815,7 +3815,7 @@ test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {5} +} -result 5 test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body { set val 5 spinbox .e -from 3 -to 10 -textvariable val @@ -3823,7 +3823,7 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body { set val } -cleanup { destroy .e -} -result {6} +} -result 6 test spinbox-23.1 {selection present while disabled, bug 637828} -body { spinbox .e diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 2e5f43c..d5bcf45 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -84,7 +84,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body { -expand false -fill x update ; # no error lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update -} -result {1} -cleanup {destroy .te .tsb} +} -result 1 -cleanup {destroy .te .tsb} test entry-2.2 "Initial scroll position" -body { ttk::entry .e -font fixed -width 5 -xscrollcommand scroll @@ -128,28 +128,28 @@ test entry-3.3 "xview" -body { .e insert end abcdefghijklmnopqrstuvwxyz .e xview end set result [.e index @0] -} -result {7} +} -result 7 test entry-3.4 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview moveto 1.0 set result [.e index @0] -} -result {7} +} -result 7 test entry-3.5 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview scroll 5 units set result [.e index @0] -} -result {5} +} -result 5 test entry-3.6 "xview" -body { .e delete 0 end; .e insert end [string repeat abcdefghijklmnopqrstuvwxyz 5] .e xview scroll 2 pages set result [.e index @0] -} -result {40} +} -result 40 test entry-3.last "Series 3 cleanup" -body { destroy .e diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index b86f053..4bdabee 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -148,7 +148,7 @@ test spinbox-1.8.4 "-validate option: " -setup { set ::spinbox_test } -cleanup { destroy .sb -} -result {50} +} -result 50 test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup { @@ -316,7 +316,7 @@ test spinbox-nostomp-3 "don't stomp on -variable (configure; -from/to)" -body { test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body { set SBV Apr - ttk::spinbox .sb + ttk::spinbox .sb .sb configure -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug} list $SBV [.sb get] } -cleanup { @@ -341,7 +341,7 @@ test spinbox-dieoctaldie-1 "Cope with leading zeros" -body { event generate .sb <<Decrement>>; lappend result $secs set result -} -result [list 07 08 09 10 11 10 09 08 07] -cleanup { +} -result [list 07 08 09 10 11 10 09 08 07] -cleanup { destroy .sb unset secs } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 9829af5..1ef90ff 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -91,11 +91,15 @@ * See ticket [916c1095438eae56]: GetVersionExW triggers warnings */ #if defined(_MSC_VER) +# pragma warning(disable:4146) # pragma warning(disable:4267) # pragma warning(disable:4244) # pragma warning(disable:4311) # pragma warning(disable:4312) # pragma warning(disable:4996) +#if !defined(_WIN64) +# pragma warning(disable:4305) +#endif #endif /* |