diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-11-11 22:41:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-11-11 22:41:07 (GMT) |
commit | aed0a5673625deb91a005cb16e913a748c446ba5 (patch) | |
tree | 29d114ae2fc044e81024582c935fa2195a0cb56d | |
parent | 85cb48baf157d799ec37a2b228a15ef3a7873ece (diff) | |
parent | d7db1d9176f253f5e66885fd9be7b57ab55b81bc (diff) | |
download | tk-aed0a5673625deb91a005cb16e913a748c446ba5.zip tk-aed0a5673625deb91a005cb16e913a748c446ba5.tar.gz tk-aed0a5673625deb91a005cb16e913a748c446ba5.tar.bz2 |
fix bug 3585396: winDialog.test requires user interaction. Tested on Windows XP SP2 (32-bit) and Windows 7 (64-bit)
-rw-r--r-- | tests/winDialog.test | 44 | ||||
-rw-r--r-- | win/tkWinTest.c | 8 |
2 files changed, 38 insertions, 14 deletions
diff --git a/tests/winDialog.test b/tests/winDialog.test index abf9af3..8aa9ac3 100644 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -229,28 +229,40 @@ test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints { tk_getOpenFile -initialdir bar -title } -returnCodes error -result {value for "-title" missing} test winDialog-5.7 {GetFileName: extension begins with .} -constraints { - nt testwinevent knownBug + nt testwinevent } -body { # if (string[0] == '.') { # string++; # } start {set x [tk_getSaveFile -defaultextension .foo -title Save]} + set msg {} then { - SetText 0x480 bar - Click ok + if {[catch {SetText 0x47C bar} msg]} { + Click cancel + } else { + Click ok + } } - string totitle $x + string totitle $x$msg +} -cleanup { + unset msg } -result [string totitle [file join [pwd] bar.foo]] test winDialog-5.8 {GetFileName: extension doesn't begin with .} -constraints { - nt testwinevent knownBug + nt testwinevent } -body { start {set x [tk_getSaveFile -defaultextension foo -title Save]} + set msg {} then { - SetText 0x480 bar - Click ok + if {[catch {SetText 0x47C bar} msg]} { + Click cancel + } else { + Click ok + } } - string totitle $x + string totitle $x$msg +} -cleanup { + unset msg } -result [string totitle [file join [pwd] bar.foo]] test winDialog-5.9 {GetFileName: file types} -constraints { nt testwinevent @@ -409,15 +421,21 @@ test winDialog-5.22 {GetFileName: call GetSaveFileName} -constraints { } -result {&Save} if {[info exists ::env(TEMP)]} { test winDialog-5.23 {GetFileName: convert \ to /} -constraints { - nt testwinevent knownBug + nt testwinevent } -body { + set msg {} start {set x [tk_getSaveFile -title Back]} then { - SetText 0x480 [file nativename \ - [file join [file normalize $::env(TEMP)] "12x 457"]] - Click ok + if {[catch {SetText 0x47C [file nativename \ + [file join [file normalize $::env(TEMP)] "12x 457"]]} msg]} { + Click cancel + } else { + Click ok + } } - return $x + return $x$msg +} -cleanup { + unset msg } -result [file join [file normalize $::env(TEMP)] "12x 457"] } test winDialog-5.24 {GetFileName: file types: MakeFilter() succeeds} -constraints { diff --git a/win/tkWinTest.c b/win/tkWinTest.c index d7d4d0f..3dd7d7a 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -335,10 +335,16 @@ TestwineventCmd( } case WM_SETTEXT: { Tcl_DString ds; + BOOL result; Tcl_UtfToExternalDString(NULL, argv[4], -1, &ds); - SetDlgItemTextA(hwnd, id, Tcl_DStringValue(&ds)); + result = SetDlgItemTextA(hwnd, id, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); + if (result == 0) { + Tcl_SetResult(interp, "failed to send text to dialog: ", TCL_STATIC); + AppendSystemError(interp, GetLastError()); + return TCL_ERROR; + } break; } case WM_COMMAND: { |