summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-07 09:10:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-07 09:10:53 (GMT)
commit3147ddd47a51d3ff290bc0be54646e541624c7fa (patch)
treeae68a62323790530a12208e6e37b9a705fe55e90 /tests
parent2687e5c2fd2ae1b37cc53909951c6629bf87a74c (diff)
parent07515d78a3338310802f115886c4cfa80acc1795 (diff)
downloadtk-3147ddd47a51d3ff290bc0be54646e541624c7fa.zip
tk-3147ddd47a51d3ff290bc0be54646e541624c7fa.tar.gz
tk-3147ddd47a51d3ff290bc0be54646e541624c7fa.tar.bz2
Merge trunk
Diffstat (limited to 'tests')
-rw-r--r--tests/bind.test49
-rw-r--r--tests/entry.test22
-rw-r--r--tests/spinbox.test22
3 files changed, 77 insertions, 16 deletions
diff --git a/tests/bind.test b/tests/bind.test
index 4439634..718c609 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -6229,6 +6229,8 @@ test bind-31.7 {virtual event user_data field - unshared, asynch} -setup {
} -result {{} {} {TestUserData >b<}}
test bind-32.1 {-warp, window was destroyed before the idle callback DoWarp} -setup {
+ # note: this test is now essentially useless
+ # since DoWarp no longer exist, not even as an idle callback
frame .t.f
pack .t.f
focus -force .t.f
@@ -6815,15 +6817,11 @@ test bind-34.1 {-warp works relatively to a window} -setup {
wm geometry .top +200+200
update
event generate .top <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
- set pointerPos1 [winfo pointerxy .t]
+ set pointerPos1 [winfo pointerxy .top]
wm geometry .top +600+600
update
event generate .top <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
- set pointerPos2 [winfo pointerxy .t]
+ set pointerPos2 [winfo pointerxy .top]
# from the first warped position to the second one, the mouse
# pointer should have moved the same amount as the window moved
set res 1
@@ -6840,12 +6838,8 @@ test bind-34.2 {-warp works relatively to the screen} -setup {
} -body {
# Contrary to bind-34.1, we're directly checking screen coordinates
event generate {} <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
set res [winfo pointerxy .]
event generate {} <Motion> -x 200 -y 200 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
lappend res {*}[winfo pointerxy .]
} -cleanup {
} -result {20 20 200 200}
@@ -6863,8 +6857,6 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup {
set res {}
} -body {
event generate {} <Motion> -x 0 -y 0 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
foreach dim [winfo pointerxy .] {
if {$dim <= $halo} {
lappend res ok
@@ -6873,9 +6865,7 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup {
}
}
event generate {} <Motion> -x 100 -y 100 -warp 1
- update idletasks ; after 50
event generate {} <Motion> -x -1 -y -1 -warp 1
- update idletasks ; after 50
foreach dim [winfo pointerxy .] {
if {$dim <= $halo} {
lappend res ok
@@ -7018,6 +7008,37 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -cleanup {
} -result pass
+test bind-36.1 {pointer warp with grab on master, bug [e3888d5820]} -setup {
+ event generate {} <Motion> -warp 1 -x 50 -y 50
+ toplevel .top
+ grab release .top
+ wm geometry .top 200x200+300+300
+ label .top.l -height 5 -width 20 -highlightthickness 2 \
+ -highlightbackground black -bg yellow -text "My label"
+ pack .top.l -side bottom
+ update
+ # On KDE/Plasma _with_the_Aurorae_theme_ (at least), setting up the toplevel
+ # and the label will not be finished after the above 'update'. The WM still
+ # needs some time before the window is fully ready. For me 50 ms is enough,
+ # but let's wait more (it depends on computer performance).
+ after 100 ; update
+} -body {
+ grab .top
+ event generate .top.l <Motion> -warp 1 -x 10 -y 10
+ foreach {x1 y1} [winfo pointerxy .top.l] {}
+ event generate {} <Motion> -warp 1 -x 50 -y 50
+ grab release .top
+ event generate .top.l <Motion> -warp 1 -x 10 -y 10
+ foreach {x2 y2} [winfo pointerxy .top.l] {}
+ # success if the coords are the same with or without the grab, and if they
+ # are at (10,10) inside the label widget as requested by the warping
+ expr {$x1==$x2 && $y1==$y2 && $x1==[winfo rootx .top.l]+10 \
+ && $y1==[winfo rooty .top.l]+10}
+} -cleanup {
+ destroy .top
+ unset x1 y1 x2 y2
+} -result {1}
+
# cleanup
cleanupTests
return
diff --git a/tests/entry.test b/tests/entry.test
index e139ae3..b70a92e 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -3385,7 +3385,7 @@ test entry-19.19 {entry widget validation} -setup {
list [.e cget -validate] [.e get] $::vVals
} -cleanup {
destroy .e
-} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
@@ -3411,6 +3411,26 @@ test entry-19.20 {entry widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+test entry-19.21 {entry widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ entry .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##
diff --git a/tests/spinbox.test b/tests/spinbox.test
index f5c6540..371d0a6 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -3624,7 +3624,7 @@ test spinbox-19.19 {spinbox widget validation} -setup {
list [.e cget -validate] [.e get] $::vVals
} -cleanup {
destroy .e
-} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
@@ -3650,6 +3650,26 @@ test spinbox-19.20 {spinbox widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+test spinbox-19.21 {spinbox widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ spinbox .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##