Tk Source Code

Check-in [f0aa744f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix bug 3585396: winDialog.test requires user interaction. Tested on Windows XP SP2 (32-bit) and Windows 7 (64-bit)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f0aa744f4f4a585f5e704883a8c2da8d3827c741
User & Date: jan.nijtmans 2012-11-11 22:41:07
Context
2012-11-12
23:33
merge mark check-in: 5117631a user: dgp tags: trunk
2012-11-11
22:41
fix bug 3585396: winDialog.test requires user interaction. Tested on Windows XP SP2 (32-bit) and Windows 7 (64-bit) check-in: f0aa744f user: jan.nijtmans tags: trunk
20:25
merge-mark Closed-Leaf check-in: 5219dd28 user: jan.nijtmans tags: bug-3585396
20:20
winDialog-5.7 should be knownBug, not winDialog-5.9 check-in: 495b4850 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/winDialog.test.

225
226
227
228
229
230
231
232
233
234
235
236
237
238

239
240


241
242

243


244
245
246
247
248

249
250


251
252

253


254
255
256
257
258
259
260
} -result {0}
test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints {
    nt
} -body {
    tk_getOpenFile -initialdir bar -title
} -returnCodes error -result {value for "-title" missing}
test winDialog-5.7 {GetFileName: extension begins with .} -constraints {
    nt testwinevent knownBug
} -body {
#    if (string[0] == '.') {
#    string++;
#    }

    start {set x [tk_getSaveFile -defaultextension .foo -title Save]}

    then {
        SetText 0x480 bar


        Click ok
    }

    string totitle $x


} -result [string totitle [file join [pwd] bar.foo]]
test winDialog-5.8 {GetFileName: extension doesn't begin with .} -constraints {
    nt testwinevent knownBug
} -body {
    start {set x [tk_getSaveFile -defaultextension foo -title Save]}

    then {
        SetText 0x480 bar


        Click ok
    }

    string totitle $x


} -result [string totitle [file join [pwd] bar.foo]]
test winDialog-5.9 {GetFileName: file types} -constraints {
    nt testwinevent
} -body {
#        case FILE_TYPES:

    start {tk_getSaveFile -filetypes {{"foo files" .foo FOOF}} -title Foo}







|






>

|
>
>
|
|
>
|
>
>


|


>

|
>
>
|
|
>
|
>
>







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
} -result {0}
test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints {
    nt
} -body {
    tk_getOpenFile -initialdir bar -title
} -returnCodes error -result {value for "-title" missing}
test winDialog-5.7 {GetFileName: extension begins with .} -constraints {
    nt testwinevent
} -body {
#    if (string[0] == '.') {
#    string++;
#    }

    start {set x [tk_getSaveFile -defaultextension .foo -title Save]}
    set msg {}
    then {
	if {[catch {SetText 0x47C bar} msg]} {
	    Click cancel
	} else {
	    Click ok
	}
    }
    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 {
	if {[catch {SetText 0x47C bar} msg]} {
	    Click cancel
	} else {
	    Click ok
	}
    }
    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
} -body {
#        case FILE_TYPES:

    start {tk_getSaveFile -filetypes {{"foo files" .foo FOOF}} -title Foo}
405
406
407
408
409
410
411
412
413

414
415
416
417


418
419

420


421
422
423
424
425
426
427
        set x [GetText ok]
        Click cancel
    }
    return $x
} -result {&Save}
if {[info exists ::env(TEMP)]} {
test winDialog-5.23 {GetFileName: convert \ to /} -constraints {
    nt testwinevent knownBug
} -body {

    start {set x [tk_getSaveFile -title Back]}
    then {
        SetText 0x480 [file nativename \
                           [file join [file normalize $::env(TEMP)] "12x 457"]]


        Click ok
    }

    return $x


} -result [file join [file normalize $::env(TEMP)] "12x 457"]
}
test winDialog-5.24 {GetFileName: file types: MakeFilter() succeeds} -constraints {
    nt
} -body {
    # MacOS type that is correct, but has embedded nulls.








|

>


|
|
>
>
|
|
>
|
>
>







417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
        set x [GetText ok]
        Click cancel
    }
    return $x
} -result {&Save}
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 {
	if {[catch {SetText 0x47C [file nativename \
		[file join [file normalize $::env(TEMP)] "12x 457"]]} msg]} {
	    Click cancel
	} else {
	    Click ok
	}
    }
    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 {
    nt
} -body {
    # MacOS type that is correct, but has embedded nulls.

Changes to win/tkWinTest.c.

331
332
333
334
335
336
337

338
339
340
341





342
343
344
345
346
347
348
	Tcl_ExternalToUtfDString(NULL, buf, -1, &ds);
	Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
	Tcl_DStringFree(&ds);
	break;
    }
    case WM_SETTEXT: {
	Tcl_DString ds;


	Tcl_UtfToExternalDString(NULL, argv[4], -1, &ds);
	SetDlgItemTextA(hwnd, id, Tcl_DStringValue(&ds));
	Tcl_DStringFree(&ds);





	break;
    }
    case WM_COMMAND: {
	char buf[TCL_INTEGER_SPACE];
	if (argc < 5) {
	    wParam = MAKEWPARAM(id, 0);
	    lParam = (LPARAM)child;







>


|

>
>
>
>
>







331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
	Tcl_ExternalToUtfDString(NULL, buf, -1, &ds);
	Tcl_AppendResult(interp, Tcl_DStringValue(&ds), NULL);
	Tcl_DStringFree(&ds);
	break;
    }
    case WM_SETTEXT: {
	Tcl_DString ds;
	BOOL result;

	Tcl_UtfToExternalDString(NULL, argv[4], -1, &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: {
	char buf[TCL_INTEGER_SPACE];
	if (argc < 5) {
	    wParam = MAKEWPARAM(id, 0);
	    lParam = (LPARAM)child;