diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-29 12:05:59 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-29 12:05:59 (GMT) |
commit | 71eb85666db1bf1262bf301935e7d1674cd06661 (patch) | |
tree | 4732c41edd69381776f475cbc0b0f70cf05c9fc7 | |
parent | f229cc87ab8e94200976b0233cfe07e5887cea49 (diff) | |
parent | e156e1d87e6eff493352961a0479c5f3630ef481 (diff) | |
download | tk-71eb85666db1bf1262bf301935e7d1674cd06661.zip tk-71eb85666db1bf1262bf301935e7d1674cd06661.tar.gz tk-71eb85666db1bf1262bf301935e7d1674cd06661.tar.bz2 |
Merge trunk.
Tweak bindings in cscroll demo.
Remove comment in text.tcl which is no longer necessary
-rw-r--r-- | .travis.yml | 10 | ||||
-rw-r--r-- | generic/tkBind.c | 11 | ||||
-rw-r--r-- | generic/tkConfig.c | 26 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 38 | ||||
-rw-r--r-- | generic/tkTextImage.c | 2 | ||||
-rw-r--r-- | library/demos/cscroll.tcl | 41 | ||||
-rw-r--r-- | library/text.tcl | 11 | ||||
-rw-r--r-- | tests/scrollbar.test | 14 | ||||
-rw-r--r-- | tests/textDisp.test | 12 | ||||
-rw-r--r-- | tests/textWind.test | 4 | ||||
-rw-r--r-- | tests/unixEmbed.test | 24 | ||||
-rw-r--r-- | tests/unixFont.test | 30 | ||||
-rw-r--r-- | tests/unixWm.test | 20 | ||||
-rw-r--r-- | tests/winfo.test | 6 | ||||
-rw-r--r-- | tests/wm.test | 6 |
15 files changed, 129 insertions, 126 deletions
diff --git a/.travis.yml b/.travis.yml index b8ba8d4..6711414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -230,6 +230,11 @@ jobs: - name: "macOS/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" @@ -239,6 +244,11 @@ jobs: - name: "macOS/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/generic/tkBind.c b/generic/tkBind.c index dab42fc..3776c95 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -2166,7 +2166,7 @@ Tk_BindEvent( TkDisplay *dispPtr; TkDisplay *oldDispPtr; Event *curEvent; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; BindInfo *bindInfoPtr; Tcl_InterpState interpState; LookupTables *physTables; @@ -2456,7 +2456,6 @@ Tk_BindEvent( LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables; PatSeq *matchPtr = matchPtrArr[k]; PatSeq *mPtr; - PSList *psl[2]; /* * Note that virtual events cannot promote. @@ -2759,11 +2758,11 @@ CompareModMasks( assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr)); for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) { - unsigned fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); - unsigned sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); + unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i); + unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i); - if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } - if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } + if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; } + if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; } } } diff --git a/generic/tkConfig.c b/generic/tkConfig.c index dd0980f..925cb72 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1877,20 +1877,20 @@ GetObjectForOption( switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: case TK_OPTION_INT: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_DOUBLE: objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); break; case TK_OPTION_STRING: - objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1); + objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); break; case TK_OPTION_STRING_TABLE: objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ *((int *) internalPtr)], -1); break; case TK_OPTION_COLOR: { - XColor *colorPtr = *((XColor **) internalPtr); + XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); @@ -1898,7 +1898,7 @@ GetObjectForOption( break; } case TK_OPTION_FONT: { - Tk_Font tkfont = *((Tk_Font *) internalPtr); + Tk_Font tkfont = *((Tk_Font *)internalPtr); if (tkfont != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); @@ -1906,7 +1906,7 @@ GetObjectForOption( break; } case TK_OPTION_STYLE: { - Tk_Style style = *((Tk_Style *) internalPtr); + Tk_Style style = *((Tk_Style *)internalPtr); if (style != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); @@ -1914,7 +1914,7 @@ GetObjectForOption( break; } case TK_OPTION_BITMAP: { - Pixmap pixmap = *((Pixmap *) internalPtr); + Pixmap pixmap = *((Pixmap *)internalPtr); if (pixmap != None) { objPtr = Tcl_NewStringObj( @@ -1923,7 +1923,7 @@ GetObjectForOption( break; } case TK_OPTION_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) internalPtr); + Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); if (border != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); @@ -1931,10 +1931,10 @@ GetObjectForOption( break; } case TK_OPTION_RELIEF: - objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); break; case TK_OPTION_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); + Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); if (cursor != NULL) { objPtr = Tcl_NewStringObj( @@ -1944,17 +1944,17 @@ GetObjectForOption( } case TK_OPTION_JUSTIFY: objPtr = Tcl_NewStringObj(Tk_NameOfJustify( - *((Tk_Justify *) internalPtr)), -1); + *((Tk_Justify *)internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( - *((Tk_Anchor *) internalPtr)), -1); + *((Tk_Anchor *)internalPtr)), -1); break; case TK_OPTION_PIXELS: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_WINDOW: { - Tk_Window tkwin = *((Tk_Window *) internalPtr); + tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 6e9a49e..49c576a 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -775,28 +775,28 @@ FormatConfigValue( result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: - if (*((int *) ptr) == 0) { + if (*((int *)ptr) == 0) { result = "0"; } else { result = "1"; } break; case TK_CONFIG_INT: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_DOUBLE: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_STRING: - result = (*(char **) ptr); + result = (*(char **)ptr); if (result == NULL) { result = ""; } break; case TK_CONFIG_UID: { - Tk_Uid uid = *((Tk_Uid *) ptr); + Tk_Uid uid = *((Tk_Uid *)ptr); if (uid != NULL) { result = uid; @@ -804,7 +804,7 @@ FormatConfigValue( break; } case TK_CONFIG_COLOR: { - XColor *colorPtr = *((XColor **) ptr); + XColor *colorPtr = *((XColor **)ptr); if (colorPtr != NULL) { result = Tk_NameOfColor(colorPtr); @@ -812,7 +812,7 @@ FormatConfigValue( break; } case TK_CONFIG_FONT: { - Tk_Font tkfont = *((Tk_Font *) ptr); + Tk_Font tkfont = *((Tk_Font *)ptr); if (tkfont != NULL) { result = Tk_NameOfFont(tkfont); @@ -820,7 +820,7 @@ FormatConfigValue( break; } case TK_CONFIG_BITMAP: { - Pixmap pixmap = *((Pixmap *) ptr); + Pixmap pixmap = *((Pixmap *)ptr); if (pixmap != None) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); @@ -828,7 +828,7 @@ FormatConfigValue( break; } case TK_CONFIG_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) ptr); + Tk_3DBorder border = *((Tk_3DBorder *)ptr); if (border != NULL) { result = Tk_NameOf3DBorder(border); @@ -836,11 +836,11 @@ FormatConfigValue( break; } case TK_CONFIG_RELIEF: - result = Tk_NameOfRelief(*((int *) ptr)); + result = Tk_NameOfRelief(*((int *)ptr)); break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) ptr); + Tk_Cursor cursor = *((Tk_Cursor *)ptr); if (cursor != NULL) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); @@ -848,29 +848,27 @@ FormatConfigValue( break; } case TK_CONFIG_JUSTIFY: - result = Tk_NameOfJustify(*((Tk_Justify *) ptr)); + result = Tk_NameOfJustify(*((Tk_Justify *)ptr)); break; case TK_CONFIG_ANCHOR: - result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr)); + result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr)); break; case TK_CONFIG_CAP_STYLE: - result = Tk_NameOfCapStyle(*((int *) ptr)); + result = Tk_NameOfCapStyle(*((int *)ptr)); break; case TK_CONFIG_JOIN_STYLE: - result = Tk_NameOfJoinStyle(*((int *) ptr)); + result = Tk_NameOfJoinStyle(*((int *)ptr)); break; case TK_CONFIG_PIXELS: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_MM: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_WINDOW: { - Tk_Window tkwin; - - tkwin = *((Tk_Window *) ptr); + tkwin = *((Tk_Window *)ptr); if (tkwin != NULL) { result = Tk_PathName(tkwin); } diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 964f60f..3657fa6 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -296,11 +296,11 @@ TkTextImageCmd( Tcl_SetObjResult(interp, resultObj); return TCL_OK; } - break; } default: Tcl_Panic("unexpected switch fallthrough"); } + return TCL_ERROR; } /* diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index 90b1afc..d210c7d 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -56,44 +56,29 @@ for {set i 0} {$i < 20} {incr i} { $c bind all <Enter> "scrollEnter $c" $c bind all <Leave> "scrollLeave $c" $c bind all <Button-1> "scrollButton $c" -if {[package vsatisfies [package provide Tk] 8.7-]} { - bind $c <Button-2> "$c scan mark %x %y" - bind $c <B2-Motion> "$c scan dragto %x %y" - bind $c <MouseWheel> { - tk::MouseWheel %W y %D -30.0 - } - bind $c <Option-MouseWheel> { - tk::MouseWheel %W y %D -3.0 - } - bind $c <Shift-MouseWheel> { - tk::MouseWheel %W x %D -30.0 - } - bind $c <Shift-Option-MouseWheel> { - tk::MouseWheel %W x %D -3.0 - } -} elseif {[tk windowingsystem] eq "aqua"} { +if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} { bind $c <Button-3> "$c scan mark %x %y" bind $c <B3-Motion> "$c scan dragto %x %y" bind $c <MouseWheel> { - %W yview scroll [expr {-(%D)}] units + %W yview scroll [expr {-%D}] units } bind $c <Option-MouseWheel> { - %W yview scroll [expr {-10 * (%D)}] units + %W yview scroll [expr {-10*%D}] units } bind $c <Shift-MouseWheel> { - %W xview scroll [expr {-(%D)}] units + %W xview scroll [expr {-%D}] units } bind $c <Shift-Option-MouseWheel> { - %W xview scroll [expr {-10 * (%D)}] units + %W xview scroll [expr {-10*%D}] units } } else { bind $c <Button-2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" # We must make sure that positive and negative movements are rounded # equally to integers, avoiding the problem that - # (int)1/30 = 0, + # (int)1/-30 = -1, # but - # (int)-1/30 = -1 + # (int)-1/-30 = 0 # The following code ensure equal +/- behaviour. bind $c <MouseWheel> { if {%D >= 0} { @@ -103,7 +88,11 @@ if {[package vsatisfies [package provide Tk] 8.7-]} { } } bind $c <Option-MouseWheel> { - %W yview scroll [expr {%D/-3}] units + if {%D >= 0} { + %W yview scroll [expr {%D/-3}] units + } else { + %W yview scroll [expr {(%D-2)/-3}] units + } } bind $c <Shift-MouseWheel> { if {%D >= 0} { @@ -113,7 +102,11 @@ if {[package vsatisfies [package provide Tk] 8.7-]} { } } bind $c <Shift-Option-MouseWheel> { - %W xview scroll [expr {%D/-3}] units + if {%D >= 0} { + %W xview scroll [expr {%D/-3}] units + } else { + %W xview scroll [expr {(%D-2)/-3}] units + } } } diff --git a/library/text.tcl b/library/text.tcl index f25f639..00806f7 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -441,17 +441,6 @@ bind Text <B2-Motion> { } set ::tk::Priv(prevPos) {} -# The MouseWheel will typically only fire on Windows and MacOS X. -# However, someone could use the "event generate" command to produce one -# on other platforms. We must be careful not to round -ve values of %D -# down to zero. - -# We must make sure that positive and negative movements are rounded -# equally to integers, avoiding the problem that -# (int)1/3 = 0, -# but -# (int)-1/3 = -1 -# The following code ensure equal +/- behaviour. bind Text <MouseWheel> { tk::MouseWheel y %D -3.0 pixels } diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 2143637..48bc891 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -11,6 +11,8 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc scroll args { global scrollInfo set scrollInfo $args @@ -270,13 +272,13 @@ test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] -test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { +test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { format {%.6g} [.s fraction 4 179] } 1 test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]] } 1 -test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { +test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { @@ -491,7 +493,7 @@ test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 4 } {trough1} -test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 { +test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 19 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { @@ -549,7 +551,7 @@ test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} -test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 { +test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 180 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { @@ -573,7 +575,7 @@ test scrollbar-6.33 {ScrollbarPosition procedure} win { test scrollbar-6.34 {ScrollbarPosition procedure} unix { .s identify 4 100 } {trough2} -test scrollbar-6.35 {ScrollbarPosition procedure} unix { +test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .s identify 18 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { @@ -612,7 +614,7 @@ test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - 1}] [expr {[winfo height .t.s] / 2}] } {slider} -test scrollbar-6.44 {ScrollbarPosition procedure} unix { +test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .t.s identify 100 18 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { diff --git a/tests/textDisp.test b/tests/textDisp.test index 4b85646..4de1697 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # Platform specific procedure for updating the text widget. if {[tk windowingsystem] == "aqua"} { @@ -2934,28 +2936,28 @@ for {set i 2} {$i <= 200} {incr i} { .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" -test textDisp-20.1 {FindDLine} { +test textDisp-20.1 {FindDLine} failsOnUbuntu { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.2 {FindDLine} { +test textDisp-20.2 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] } [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] -test textDisp-20.3 {FindDLine} { +test textDisp-20.3 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 49.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0] } [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.4 {FindDLine} { +test textDisp-20.4 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 42.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40] } [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] .t config -wrap none -test textDisp-20.5 {FindDLine} { +test textDisp-20.5 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 48.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40] diff --git a/tests/textWind.test b/tests/textWind.test index 286964e..03793a4 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + deleteWindows set fixedFont {"Courier" -12} @@ -792,7 +794,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup {{can't embed .t relative to .t}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] -test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup { +test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup { .t delete 1.0 end destroy .t2 proc bgerror args { diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 4372253..5d00ccf 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ @@ -1086,7 +1088,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { - unix notAqua + unix notAqua failsOnUbuntu } -setup { deleteWindows } -body { @@ -1188,9 +1190,9 @@ test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { - unix testembed notAqua + unix testembed notAqua } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1233,9 +1235,9 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1249,9 +1251,9 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con deleteWindows } -result {150x80+0+0} test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1266,9 +1268,9 @@ test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con } -result {70x300+0+0} test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { - unix + unix } -setup { - deleteWindows + deleteWindows } -body { toplevel .t pack [frame .t.f -container 1 -width 200 -height 200] -fill both @@ -1282,9 +1284,9 @@ test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { deleteWindows } -result .embed test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints { - unix pressbutton + unix pressbutton } -setup { - deleteWindows + deleteWindows } -body { toplevel .main set result {} diff --git a/tests/unixFont.test b/tests/unixFont.test index 44e8f56..524191d 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -16,6 +16,8 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] } @@ -69,7 +71,7 @@ proc getsize {} { test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" doesn't exist}} -test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 { +test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} { font measure fixed 0 } 6 @@ -78,21 +80,21 @@ test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 { set x {} } {} test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \ - {x11 noExceed hasTimesNew} { + {x11 noExceed hasTimesNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Times New Roman"}] 1] lappend x [lindex [font actual {-family "New York"}] 1] lappend x [lindex [font actual {-family "Times"}] 1] } {times times times} test unixfont-2.3 {TkpGetFontFromAttributes procedure: Courier relatives} \ - {x11 noExceed hasCourierNew} { + {x11 noExceed hasCourierNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Courier New"}] 1] lappend x [lindex [font actual {-family "Monaco"}] 1] lappend x [lindex [font actual {-family "Courier"}] 1] } {courier courier courier} test unixfont-2.4 {TkpGetFontFromAttributes procedure: Helvetica relatives} \ - {x11 noExceed hasArial} { + {x11 noExceed hasArial failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Arial"}] 1] lappend x [lindex [font actual {-family "Geneva"}] 1] @@ -102,16 +104,16 @@ test unixfont-2.5 {TkpGetFontFromAttributes procedure: fallback} x11 { font actual {-xyz-xyz-*-*-*-*-*-*-*-*-*-*-*-*} set x {} } {} -test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} x11 { +test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 10}] 1 } {fixed} test unixfont-2.7 {TkpGetFontFromAttributes: fixed family not available!} x11 { # no test available } {} -test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} x11 { +test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} -test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed} { +test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 { @@ -166,11 +168,11 @@ test unixfont-5.7 {Tk_MeasureChars procedure: already saw space in line} x11 { .b.l config -text "000000 00000" getsize } "[expr $ax*6] [expr $ay*2]" -test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} x11 { +test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} {x11 failsOnUbuntu} { .b.l config -text "00 000 00000" getsize } "[expr $ax*7] [expr $ay*2]" -test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 { +test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 @@ -186,7 +188,7 @@ test unixfont-5.11 {Tk_MeasureChars: TK_AT_LEAST_ONE + not even one char fit!} x .b.l config -wrap $a set x } "$ax [expr $ay*6]" -test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} x11 { +test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} {x11 failsOnUbuntu} { .b.l config -text "000 \n000" getsize } "[expr $ax*6] [expr $ay*2]" @@ -253,7 +255,7 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 { catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} -test unixfont-8.4 {AllocFont procedure: classify characters} x11 { +test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\u4000"] ;# 6 incr x [font measure $courier "\002"] ;# 4 @@ -264,7 +266,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} x11 { test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 { font metrics $courier -fixed } 1 -test unixfont-8.6 {AllocFont procedure: setup widths of special chars} x11 { +test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 @@ -292,7 +294,7 @@ test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 { set x {} } {} -test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { +test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} @@ -301,7 +303,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { lappend x [.b.c index $t @[expr $ax*2],0] lappend x [.b.c index $t @[expr $ax*3],0] } {0 1 1 2} -test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} x11 { +test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\0010" set x {} diff --git a/tests/unixWm.test b/tests/unixWm.test index dbb0ea4..b2b91b7 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,6 +13,8 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc sleep ms { global x after $ms {set x 1} @@ -287,7 +289,7 @@ test unixWm-8.3 {icon windows} unix { toplevel .t -width 100 -height 30 list [catch {wm iconwindow .t b c} msg] $msg } {1 {wrong # args: should be "wm iconwindow window ?pathName?"}} -test unixWm-8.4 {icon windows} unix { +test unixWm-8.4 {icon windows} {unix failsOnUbuntu} { destroy .t destroy .icon toplevel .t -width 100 -height 30 @@ -632,7 +634,7 @@ test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix { destroy .icon set result } {1 {can't deiconify .icon: it is an icon for .t}} -test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} unix { +test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu} { wm iconify .t set result {} lappend result [winfo ismapped .t] [wm state .t] @@ -851,7 +853,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } {1 {can't iconify ".t2": it is an icon for ".t"}} -test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 +0+0 @@ -862,7 +864,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } 0 -test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 -0+0 @@ -1433,7 +1435,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix { # No tests for ReparentEvent or ComputeReparentGeometry; I can't figure # out how to exercise these procedures reliably. -test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix { +test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu} { destroy .t toplevel .t -width 400 -height 150 wm geometry .t +0+0 @@ -1610,7 +1612,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {40 30 320 210 10 5} -test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} { +test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 wm minsize .t 30 40 @@ -1638,7 +1640,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {60 40 53 320 233 10 5} -test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper} { +test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 frame .t.menu -height 23 -width 50 @@ -1792,7 +1794,7 @@ if {[tk windowingsystem] == "aqua"} { # Windows are assumed to have a border (invisible in Gnome 3). set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t} } -test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} unix { +test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu} { update toplevel .t -width 300 -height 400 -bg green wm geom .t +100+100 @@ -1957,7 +1959,7 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix { [winfo containing [expr $x + 350] $y] \ [winfo containing [expr $x + 450] $y] } {.t .t.f .t.f.f .t {}} -test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix { +test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu} { destroy .t destroy .t2 toplevel .t -width 200 -height 200 -bg green diff --git a/tests/winfo.test b/tests/winfo.test index d39359b..13193ef 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. @@ -291,7 +293,7 @@ test winfo-9.2 {"winfo viewable" command} -body { test winfo-9.3 {"winfo viewable" command} -body { winfo viewable . } -result 1 -test winfo-9.4 {"winfo viewable" command} -body { +test winfo-9.4 {"winfo viewable" command} -constraints failsOnUbuntu -body { wm iconify . winfo viewable . } -cleanup { @@ -320,7 +322,7 @@ test winfo-9.6 {"winfo viewable" command} -setup { } -cleanup { deleteWindows } -result {0 0} -test winfo-9.7 {"winfo viewable" command} -setup { +test winfo-9.7 {"winfo viewable" command} -constraints failsOnUbuntu -setup { deleteWindows } -body { frame .f1 -width 100 -height 100 -relief raised -bd 2 diff --git a/tests/wm.test b/tests/wm.test index 4c0da3e..d5bc733 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1527,7 +1527,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel on unix} -constraints x11 -body { + overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu} -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 @@ -1726,7 +1726,7 @@ test wm-transient-3.3 {withdraw/deiconify on the toplevel } -result {withdrawn 0 normal 1} test wm-transient-4.1 {transient toplevel is withdrawn - when mapped if toplevel is iconic} -body { + when mapped if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top wm iconify .top update @@ -1738,7 +1738,7 @@ test wm-transient-4.1 {transient toplevel is withdrawn deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel - is withdrawn if toplevel is iconic} -body { + is withdrawn if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top raiseDelay wm iconify .top |