diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/choosedir.test | 16 | ||||
-rw-r--r-- | tests/filebox.test | 34 | ||||
-rw-r--r-- | tests/msgbox.test | 26 |
3 files changed, 45 insertions, 31 deletions
diff --git a/tests/choosedir.test b/tests/choosedir.test index fb6e62d..f67a721 100644 --- a/tests/choosedir.test +++ b/tests/choosedir.test @@ -85,23 +85,25 @@ set fake [file join $dir non-existant] set parent . -test choosedir-1.1 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.1 {tk_chooseDirectory command} -body { tk_chooseDirectory -initialdir } -returnCodes error -result {value for "-initialdir" missing} -test choosedir-1.2 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.2 {tk_chooseDirectory command} -body { tk_chooseDirectory -mustexist } -returnCodes error -result {value for "-mustexist" missing} -test choosedir-1.3 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.3 {tk_chooseDirectory command} -body { tk_chooseDirectory -parent } -returnCodes error -result {value for "-parent" missing} -test choosedir-1.4 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.4 {tk_chooseDirectory command} -body { tk_chooseDirectory -title } -returnCodes error -result {value for "-title" missing} - -test choosedir-1.5 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.5.1 {tk_chooseDirectory command} -constraints notAqua -body { tk_chooseDirectory -foo bar } -returnCodes error -result {bad option "-foo": must be -initialdir, -mustexist, -parent, or -title} -test choosedir-1.6 {tk_chooseDirectory command} -constraints unix -body { +test choosedir-1.5.2 {tk_chooseDirectory command} -constraints aqua -body { + tk_chooseDirectory -foo bar +} -returnCodes error -result {bad option "-foo": must be -initialdir, -message, -mustexist, -parent, -title, or -command} +test choosedir-1.6 {tk_chooseDirectory command} -body { tk_chooseDirectory -parent foo.bar } -returnCodes error -result {bad window path name "foo.bar"} diff --git a/tests/filebox.test b/tests/filebox.test index 2f87c3e..0114a07 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -110,8 +110,10 @@ if {$tcl_platform(platform) == "unix"} { set modes 1 } -set unknownOptionsMsg(tk_getOpenFile) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable} -set unknownOptionsMsg(tk_getSaveFile) {bad option "-foo": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable} +set unknownOptionsMsg(tk_getOpenFile,notAqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable} +set unknownOptionsMsg(tk_getOpenFile,aqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -message, -multiple, -parent, -title, -typevariable, or -command} +set unknownOptionsMsg(tk_getSaveFile,notAqua) {bad option "-foo": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable} +set unknownOptionsMsg(tk_getSaveFile,aqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -message, -parent, -title, -typevariable, -command, or -confirmoverwrite} set tmpFile "filebox.tmp" makeFile { @@ -155,9 +157,12 @@ foreach mode $modes { } } - test filebox-1.1-$mode "tk_getOpenFile command" -body { + test filebox-1.1.1-$mode "tk_getOpenFile command" -constraints notAqua -body { tk_getOpenFile -foo - } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile) + } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,notAqua) + test filebox-1.1.2-$mode "tk_getOpenFile command" -constraints aqua -body { + tk_getOpenFile -foo + } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,aqua) catch {tk_getOpenFile -foo 1} msg regsub -all , $msg "" options @@ -171,9 +176,12 @@ foreach mode $modes { } } - test filebox-1.3-$mode "tk_getOpenFile command" -body { + test filebox-1.3.1-$mode "tk_getOpenFile command" -constraints notAqua -body { + tk_getOpenFile -foo bar + } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,notAqua) + test filebox-1.3.2-$mode "tk_getOpenFile command" -constraints aqua -body { tk_getOpenFile -foo bar - } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile) + } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,aqua) test filebox-1.4-$mode "tk_getOpenFile command" -body { tk_getOpenFile -initialdir } -returnCodes error -result {value for "-initialdir" missing} @@ -289,9 +297,12 @@ foreach mode $modes { } $res } - test filebox-4.1-$mode "tk_getSaveFile command" -body { + test filebox-4.1.1-$mode "tk_getSaveFile command" -constraints notAqua -body { tk_getSaveFile -foo - } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile) + } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile,notAqua) + test filebox-4.1.2-$mode "tk_getSaveFile command" -constraints aqua -body { + tk_getSaveFile -foo + } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile,aqua) catch {tk_getSaveFile -foo 1} msg regsub -all , $msg "" options @@ -305,9 +316,12 @@ foreach mode $modes { } } - test filebox-4.3-$mode "tk_getSaveFile command" -body { + test filebox-4.3.1-$mode "tk_getSaveFile command" -constraints notAqua -body { + tk_getSaveFile -foo bar + } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile,notAqua) + test filebox-4.3.2-$mode "tk_getSaveFile command" -constraints aqua -body { tk_getSaveFile -foo bar - } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile) + } -returnCodes error -result $unknownOptionsMsg(tk_getSaveFile,aqua) test filebox-4.4-$mode "tk_getSaveFile command" -body { tk_getSaveFile -initialdir } -returnCodes error -result {value for "-initialdir" missing} diff --git a/tests/msgbox.test b/tests/msgbox.test index 643ae2c..1b84463 100644 --- a/tests/msgbox.test +++ b/tests/msgbox.test @@ -11,12 +11,18 @@ tcltest::loadTestedCommands namespace import -force tcltest::test -test msgbox-1.1 {tk_messageBox command} -body { +test msgbox-1.1.1 {tk_messageBox command} -constraints notAqua -body { tk_messageBox -foo } -returnCodes error -result {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, or -type} -test msgbox-1.2 {tk_messageBox command} -body { +test msgbox-1.1.2 {tk_messageBox command} -constraints aqua -body { + tk_messageBox -foo +} -returnCodes error -result {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, -type, or -command} +test msgbox-1.2.1 {tk_messageBox command} -constraints notAqua -body { tk_messageBox -foo bar } -returnCodes error -result {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, or -type} +test msgbox-1.2.2 {tk_messageBox command} -constraints aqua -body { + tk_messageBox -foo bar +} -returnCodes error -result {bad option "-foo": must be -default, -detail, -icon, -message, -parent, -title, -type, or -command} test msgbox-1.3 {tk_messageBox command} -body { tk_messageBox -default @@ -48,30 +54,22 @@ test msgbox-1.11 {tk_messageBox command} -body { tk_messageBox -type foo } -returnCodes error -result {bad -type value "foo": must be abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel} -test msgbox-1.12 {tk_messageBox command} -constraints unix -body { - tk_messageBox -default 1.1 -} -returnCodes error -result {invalid default button "1.1"} -test msgbox-1.13 {tk_messageBox command} -constraints macOrWin -body { +test msgbox-1.13 {tk_messageBox command} -body { tk_messageBox -default 1.1 } -returnCodes error -result {bad -default value "1.1": must be abort, retry, ignore, ok, cancel, no, or yes} -test msgbox-1.14 {tk_messageBox command} -constraints unix -body { - tk_messageBox -default foo -} -returnCodes error -result {invalid default button "foo"} -test msgbox-1.15 {tk_messageBox command} -constraints macOrWin -body { +test msgbox-1.14 {tk_messageBox command} -body { tk_messageBox -default foo } -returnCodes error -result {bad -default value "foo": must be abort, retry, ignore, ok, cancel, no, or yes} -test msgbox-1.16 {tk_messageBox command} -constraints unix -body { - tk_messageBox -type yesno -default 3 -} -returnCodes error -result {invalid default button "3"} -test msgbox-1.17 {tk_messageBox command} -constraints macOrWin -body { +test msgbox-1.16 {tk_messageBox command} -body { tk_messageBox -type yesno -default 3 } -returnCodes error -result {bad -default value "3": must be abort, retry, ignore, ok, cancel, no, or yes} test msgbox-1.18 {tk_messageBox command} -body { tk_messageBox -icon foo } -returnCodes error -result {bad -icon value "foo": must be error, info, question, or warning} + test msgbox-1.19 {tk_messageBox command} -body { tk_messageBox -parent foo.bar } -returnCodes error -result {bad window path name "foo.bar"} |