summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorashok <ashok>2014-10-16 02:48:20 (GMT)
committerashok <ashok>2014-10-16 02:48:20 (GMT)
commitc92b7c501167ca465f16ca7a00d876719a781e07 (patch)
tree54d82ac179c37a7d6d61383d7b10f2afaf10df2e /tests
parent7ce8f8785fa58840a3a8cc90c6b3dab49b4f06bd (diff)
downloadtk-c92b7c501167ca465f16ca7a00d876719a781e07.zip
tk-c92b7c501167ca465f16ca7a00d876719a781e07.tar.gz
tk-c92b7c501167ca465f16ca7a00d876719a781e07.tar.bz2
Changed to not use c:/ as initialdir
Diffstat (limited to 'tests')
-rw-r--r--tests/winDialog.test18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/winDialog.test b/tests/winDialog.test
index f21fa18..fc1114a 100644
--- a/tests/winDialog.test
+++ b/tests/winDialog.test
@@ -27,6 +27,16 @@ proc vista? {{prevista 0} {postvista 1}} {
return [expr {$major >= 6 ? $postvista : $prevista}]
}
+# What directory to use in initialdir tests. Old code used to use
+# c:/. However, on Vista/later that is a protected directory if you
+# are not running privileged. Moreover, not everyone has a drive c:
+# but not having a TEMP would break a lot Windows programs
+proc initialdir {} {
+ # file join to return in Tcl canonical format (/ separator, not \)
+ return [file join $::env(TEMP)]
+}
+
+
proc start {arg} {
set ::tk_dialog 0
set ::iter_after 0
@@ -227,7 +237,7 @@ test winDialog-5.2 {GetFileName: one argument} -constraints {
test winDialog-5.3 {GetFileName: many arguments} -constraints {
nt testwinevent
} -body {
- start {tk_getOpenFile -initialdir c:/ -parent . -title test -initialfile foo}
+ start {tk_getOpenFile -initialdir [initialdir] -parent . -title test -initialfile foo}
then {
Click cancel
}
@@ -539,7 +549,7 @@ test winDialog-9.3 {Tk_ChooseDirectoryObjCmd: many arguments} -constraints {
nt testwinevent
} -body {
start {
- tk_chooseDirectory -initialdir c:/ -mustexist 1 -parent . -title test
+ tk_chooseDirectory -initialdir [initialdir] -mustexist 1 -parent . -title test
}
then {
Click cancel
@@ -568,12 +578,12 @@ test winDialog-9.7 {Tk_ChooseDirectoryObjCmd: -initialdir} -constraints {
} -body {
# case DIR_INITIAL:
- start {set x [tk_chooseDirectory -initialdir c:/ -title Foo]}
+ start {set x [tk_chooseDirectory -initialdir [initialdir] -title Foo]}
then {
Click ok
}
string tolower [set x]
-} -result {c:/}
+} -result [initialdir]
test winDialog-9.8 {Tk_ChooseDirectoryObjCmd: initial directory: Tcl_TranslateFilename()} -constraints {
nt
} -body {