From f6993ae7c097bb4472425a0c2ecd24dbe1863ae3 Mon Sep 17 00:00:00 2001 From: "nijtmans@users.sourceforge.net" Date: Fri, 9 Nov 2012 10:59:45 +0000 Subject: demo fix for bug 3585396. On which platforms this fails? --- tests/winDialog.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/winDialog.test b/tests/winDialog.test index c092e76..77317b1 100644 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -237,7 +237,7 @@ test winDialog-5.7 {GetFileName: extension begins with .} -constraints { start {set x [tk_getSaveFile -defaultextension .foo -title Save]} then { - SetText 0x480 bar + SetText 0x47C bar Click ok } string totitle $x @@ -247,7 +247,7 @@ test winDialog-5.8 {GetFileName: extension doesn't begin with .} -constraints { } -body { start {set x [tk_getSaveFile -defaultextension foo -title Save]} then { - SetText 0x480 bar + SetText 0x47C bar Click ok } string totitle $x @@ -413,7 +413,7 @@ test winDialog-5.23 {GetFileName: convert \ to /} -constraints { } -body { start {set x [tk_getSaveFile -title Back]} then { - SetText 0x480 [file nativename \ + SetText 0x47C [file nativename \ [file join [file normalize $::env(TEMP)] "12x 457"]] Click ok } -- cgit v0.12 From 37e0723d15e17b6d7199619a2bbee3e95450951a Mon Sep 17 00:00:00 2001 From: "nijtmans@users.sourceforge.net" Date: Sun, 11 Nov 2012 08:50:50 +0000 Subject: Fixed, but only tested yet on Windows 7. On other platforms, at least the 'user input problem' is gone, but the test might still fail. --- tests/winDialog.test | 38 ++++++++++++++++++++++++++++---------- win/tkWinTest.c | 8 +++++++- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/tests/winDialog.test b/tests/winDialog.test index 77317b1..8aa9ac3 100644 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -236,21 +236,33 @@ test winDialog-5.7 {GetFileName: extension begins with .} -constraints { # } start {set x [tk_getSaveFile -defaultextension .foo -title Save]} + set msg {} then { - SetText 0x47C 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 } -body { start {set x [tk_getSaveFile -defaultextension foo -title Save]} + set msg {} then { - SetText 0x47C 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 @@ -411,13 +423,19 @@ if {[info exists ::env(TEMP)]} { test winDialog-5.23 {GetFileName: convert \ to /} -constraints { nt testwinevent } -body { + set msg {} start {set x [tk_getSaveFile -title Back]} then { - SetText 0x47C [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: { -- cgit v0.12