summaryrefslogtreecommitdiffstats
path: root/tests/choosedir.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/choosedir.test')
-rw-r--r--tests/choosedir.test35
1 files changed, 15 insertions, 20 deletions
diff --git a/tests/choosedir.test b/tests/choosedir.test
index 94dbf90..01a319f 100644
--- a/tests/choosedir.test
+++ b/tests/choosedir.test
@@ -6,14 +6,9 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::makeDirectory
-
#----------------------------------------------------------------------
#
# Procedures needed by this test file
@@ -83,32 +78,31 @@ proc SendButtonPress {parent btn type} {
#
#----------------------------------------------------------------------
# Make a dir for us to rely on for tests
-makeDirectory choosedirTest
-set dir [pwd]
+set real [makeDirectory choosedirTest]
+set dir [file dirname $real]
set fake [file join $dir non-existant]
-set real [file join $dir choosedirTest]
set parent .
foreach opt {-initialdir -mustexist -parent -title} {
- test choosedir-1.1 "tk_chooseDirectory command" unixOnly {
+ test choosedir-1.1$opt "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory $opt} msg] $msg
} [list 1 "value for \"$opt\" missing"]
}
-test choosedir-1.2 "tk_chooseDirectory command" unixOnly {
+test choosedir-1.2 "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory -foo bar} msg] $msg
} [list 1 "bad option \"-foo\": must be -initialdir, -mustexist, -parent, or -title"]
-test choosedir-1.3 "tk_chooseDirectory command" unixOnly {
+test choosedir-1.3 "tk_chooseDirectory command" unix {
list [catch {tk_chooseDirectory -parent foo.bar} msg] $msg
} {1 {bad window path name "foo.bar"}}
-test choosedir-2.1 "tk_chooseDirectory command, cancel gives null" {unixOnly} {
+test choosedir-2.1 "tk_chooseDirectory command, cancel gives null" {unix notAqua} {
ToPressButton $parent cancel
tk_chooseDirectory -title "Press Cancel" -parent $parent
} ""
-test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unixOnly} {
+test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unix notAqua} {
# first enter a bogus dirname, then enter a real one.
ToEnterDirsByKey $parent [list $fake $real $real]
set result [tk_chooseDirectory \
@@ -116,23 +110,23 @@ test choosedir-3.1 "tk_chooseDirectory -mustexist 1" {unixOnly} {
-parent $parent -mustexist 1]
set result
} $real
-test choosedir-3.2 "tk_chooseDirectory -mustexist 0" {unixOnly} {
+test choosedir-3.2 "tk_chooseDirectory -mustexist 0" {unix notAqua} {
ToEnterDirsByKey $parent [list $fake $fake]
tk_chooseDirectory -title "Enter \"$fake\", press OK" \
-parent $parent -mustexist 0
} $fake
-test choosedir-4.1 "tk_chooseDirectory command, initialdir" {unixOnly} {
+test choosedir-4.1 "tk_chooseDirectory command, initialdir" {unix notAqua} {
ToPressButton $parent ok
tk_chooseDirectory -title "Press Ok" -parent $parent -initialdir $real
} $real
-test choosedir-4.2 "tk_chooseDirectory command, initialdir" {unixOnly} {
+test choosedir-4.2 "tk_chooseDirectory command, initialdir" {unix notAqua} {
ToEnterDirsByKey $parent [list $fake $fake]
tk_chooseDirectory \
-title "Enter \"$fake\" and press Ok" \
-parent $parent -initialdir $real
} $fake
-test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unixOnly} {
+test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unix notAqua} {
catch {unset ::tk::dialog::file::__tk_choosedir}
ToPressButton $parent ok
tk_chooseDirectory \
@@ -140,12 +134,13 @@ test choosedir-4.3 "tk_chooseDirectory, -initialdir {}" {unixOnly} {
-parent $parent -initialdir ""
} [pwd]
-test choosedir-5.1 "tk_chooseDirectory, handles {} entry text" {unixOnly} {
+test choosedir-5.1 "tk_chooseDirectory, handles {} entry text" {unix notAqua} {
ToEnterDirsByKey $parent [list "" $real $real]
tk_chooseDirectory -title "Clear entry, Press OK; Enter $real, press OK" \
-parent $parent
} $real
# cleanup
-::tcltest::cleanupTests
+removeDirectory choosedirTest
+cleanupTests
return