1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
# Commands covered: sound cget
#
package require -exact snack 2.2
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import ::tcltest::*
}
test cget-1.1 {cget command, bad args} {
set s [snack::sound snd]
set res [list [catch {$s cget -junk} msg] $msg]
$s destroy
set res
} {1 {bad option "-junk": must be -load, -file, -channel, -rate, -frequency, -channels, -encoding, -format, -byteorder, -buffersize, -skiphead, -guessproperties, -precision, -changecommand, -fileformat, or -debug}}
test cget-1.2 {cget command, option -load} {
set s [snack::sound snd -load ex1.wav]
set res [$s cget -load]
$s destroy
set res
} {ex1.wav}
test cget-1.3 {cget command, option -file} {
set s [snack::sound snd -file ex1.wav]
set res [$s cget -file]
$s destroy
set res
} {ex1.wav}
test cget-1.4 {cget command, option -rate} {
set s [snack::sound snd -load ex1.wav]
set res [$s cget -rate]
$s destroy
set res
} 16000
test cget-1.5 {cget command, option -encoding} {
set s [snack::sound snd -load ex1.wav]
set res [$s cget -encoding]
$s destroy
set res
} Lin16
test cget-1.6 {cget command, option -channels} {
set s [snack::sound snd -load ex1.wav]
set res [$s cget -channels]
$s destroy
set res
} 1
test cget-1.7 {cget command, option -byteorder} {
set s [snack::sound snd -load ex1.wav]
set res [$s cget -byteorder]
$s destroy
set res
} littleEndian
test cget-1.7 {cget command, option -precision} {
set s [snack::sound snd]
set res [$s cget -precision]
$s destroy
set res
} single
# cleanup
::tcltest::cleanupTests
return
|