From 7e4369ff75f512f5454577833873027630964fb2 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Wed, 12 Nov 2008 22:35:14 +0000 Subject: backported fixes for running on vista and to avoid a hangup in the color dialog test sometimes. --- ChangeLog | 1 + tests/winDialog.test | 45 +++++++++++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e07d422..91a1292 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2008-11-12 Pat Thoyts + * tests/winDialog.test: backported some fixes from head * library/text.tcl: Backported fix for bug #1777362 to have events * test/text.test: work with window paths that include hyphens. diff --git a/tests/winDialog.test b/tests/winDialog.test index 4c172cb..b147210 100644 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -1,3 +1,4 @@ +# -*- tcl -*- # This file is a Tcl script to test the Windows specific behavior of # the common dialog boxes. It is organized in the standard # fashion for Tcl tests. @@ -6,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 1998-1999 ActiveState Corporation. # -# RCS: @(#) $Id: winDialog.test,v 1.15.2.1 2008/04/14 20:59:51 patthoyts Exp $ +# RCS: @(#) $Id: winDialog.test,v 1.15.2.2 2008/11/12 22:35:14 patthoyts Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -85,41 +86,47 @@ test winDialog-1.1.2 {Tk_ChooseColorObjCmd} -constraints { } -result [list 0 "#ff9933"] test winDialog-1.1.3 {Tk_ChooseColorObjCmd: -title} -constraints { testwinevent -} -body { +} -setup {unset -nocomplain a x} -body { set x {} start {set clr [tk_chooseColor -initialcolor "#ff9933" -title "Hello"]} then { - array set a [testgetwindowinfo $::tk_dialog] - if {[info exists a(text)]} {lappend x $a(text)} + if {[catch { + array set a [testgetwindowinfo $::tk_dialog] + if {[info exists a(text)]} {lappend x $a(text)} + } err]} { lappend x $err } lappend x [Click 1] } lappend x $clr } -result [list Hello 0 "#ff9933"] test winDialog-1.1.4 {Tk_ChooseColorObjCmd: -title} -constraints { testwinevent -} -body { +} -setup {unset -nocomplain a x} -body { set x {} start { set clr [tk_chooseColor -initialcolor "#ff9933" \ -title "\u041f\u0440\u0438\u0432\u0435\u0442"] } then { - array set a [testgetwindowinfo $::tk_dialog] - if {[info exists a(text)]} {lappend x $a(text)} + if {[catch { + array set a [testgetwindowinfo $::tk_dialog] + if {[info exists a(text)]} {lappend x $a(text)} + } err]} { lappend x $err } lappend x [Click 1] } lappend x $clr } -result [list "\u041f\u0440\u0438\u0432\u0435\u0442" 0 "#ff9933"] test winDialog-1.1.5 {Tk_ChooseColorObjCmd: -parent} -constraints { testwinevent -} -body { +} -setup {unset -nocomplain a x} -body { start {set clr [tk_chooseColor -initialcolor "#ff9933" -parent .]} set x {} then { - array set a [testgetwindowinfo $::tk_dialog] - if {[info exists a(parent)]} { - append x [expr {$a(parent) == [wm frame .]}] - } + if {[catch { + array set a [testgetwindowinfo $::tk_dialog] + if {[info exists a(parent)]} { + append x [expr {$a(parent) == [wm frame .]}] + } + } err]} {lappend x $err} Click 1 } list $x $clr @@ -213,15 +220,19 @@ test winDialog-5.11 {GetFileName: file types: MakeFilter() fails} {nt} { list [catch {tk_getSaveFile -filetypes {{"foo" .foo FOO}}} msg] $msg } {1 {bad Macintosh file type "FOO"}} +if {[info exists ::env(TEMP)]} { test winDialog-5.12 {GetFileName: initial directory} {nt testwinevent} { # case FILE_INITDIR: - start {set x [tk_getSaveFile -initialdir c:/ -initialfile "12x 455" -title Foo]} + start {set x [tk_getSaveFile \ + -initialdir [file normalize $::env(TEMP)] \ + -initialfile "12x 455" -title Foo]} then { Click 1 } set x -} {C:/12x 455} +} [file join [file normalize $::env(TEMP)] "12x 455"] +} test winDialog-5.13 {GetFileName: initial directory: Tcl_TranslateFilename()} \ {nt} { # if (Tcl_TranslateFileName(interp, string, &ds) == NULL) @@ -318,14 +329,16 @@ test winDialog-5.23 {GetFileName: call GetSaveFileName} {nt testwinevent} { } set x } {&Save} +if {[info exists ::env(TEMP)]} { test winDialog-5.24 {GetFileName: convert \ to /} {nt testwinevent} { start {set x [tk_getSaveFile -title Back]} then { - SetText 0x480 "c:\\12x 457" + SetText 0x480 "$::env(TEMP)\\12x 457" Click 1 } set x -} {c:/12x 457} +} [file join [file normalize $::env(TEMP)] "12x 457"] +} test winDialog-5.25 {GetFileName: file types: MakeFilter() succeeds} {nt} { # MacOS type that is correct, but has embedded nulls. -- cgit v0.12