diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/option.file3 | 18 | ||||
-rw-r--r-- | tests/option.test | 11 | ||||
-rw-r--r-- | tests/text.test | 19 | ||||
-rw-r--r-- | tests/ttk/spinbox.test | 2 |
4 files changed, 38 insertions, 12 deletions
diff --git a/tests/option.file3 b/tests/option.file3 new file mode 100755 index 0000000..87f41ae --- /dev/null +++ b/tests/option.file3 @@ -0,0 +1,18 @@ +! This file is a sample option (resource) database used to test +! Tk's option-handling capabilities. + +! Comment line \ + with a backslash-newline sequence embedded in it. + +*x1: blue + tktest.x2 : green +*\ +x3 \ + : pur\ +ple +*x 4: brówn +# More comments, this time delimited by hash-marks. + # Comment-line with space. +*x6: +*x9: \ \ \\\101\n +# comment line as last line of file. diff --git a/tests/option.test b/tests/option.test index 1bfcb7c..4668771 100644 --- a/tests/option.test +++ b/tests/option.test @@ -187,6 +187,7 @@ test option-14.12 {error conditions} { set option1 [file join [testsDirectory] option.file1] set option2 [file join [testsDirectory] option.file2] +set option3 [file join [testsDirectory] option.file3] test option-15.1 {database files} { list [catch {option read non-existent} msg] $msg @@ -207,16 +208,18 @@ test option-15.9 {database files} {option get . x3 color} burgundy test option-15.10 {database files} { list [catch {option read $option2} msg] $msg } {1 {missing colon on line 2}} +option read $option3 +test option-15.11 {database files} {option get . {x 4} color} br\xf3wn test option-16.1 {ReadOptionFile} { - set option3 [makeFile {} option.file3] - set file [open $option3 w] + set option4 [makeFile {} option.file3] + set file [open $option4 w] fconfigure $file -translation crlf puts $file "*x7: true\n*x8: false" close $file - option read $option3 userDefault + option read $option4 userDefault set result [list [option get . x7 color] [option get . x8 color]] - removeFile $option3 + removeFile $option4 set result } {true false} diff --git a/tests/text.test b/tests/text.test index a58ffc2..7c1731d 100644 --- a/tests/text.test +++ b/tests/text.test @@ -714,22 +714,23 @@ test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup { } -result {0} test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup { toplevel .mytop - pack [text .mytop.t] - wm geometry .mytop 100x300+0+0 + pack [text .mytop.t -font TkFixedFont -bd 0 -padx 0 -wrap char] + set spec [font measure TkFixedFont "Line 1+++Line 1---Li"] ; # 20 chars + append spec x300+0+0 + wm geometry .mytop $spec .mytop.t delete 1.0 end update set res {} } -body { for {set i 1} {$i < 5} {incr i} { - # 0 1 2 3 4 - # 012345 678901234 567890123 456789012 34567890123456789 + # 0 1 2 3 4 + # 012345 678901234 567890123 456789012 34567890123456789 .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n" } .mytop.t tag configure hidden -elide true - .mytop.t tag add hidden 2.20 3.10 - .mytop.t configure -wrap char + .mytop.t tag add hidden 2.30 3.10 lappend res [.mytop.t count -displaylines 2.0 3.0] - lappend res [.mytop.t count -displaylines 2.0 3.40] + lappend res [.mytop.t count -displaylines 2.0 3.50] } -cleanup { destroy .mytop } -result {1 3} @@ -744,6 +745,10 @@ test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup { .t tag configure hidden -elide true .t tag add hidden 5.7 11.0 update + # next line to be fully sure that asynchronous line heights calculation is + # up-to-date otherwise this test may fail (depending on the computer + # performance), especially when the . toplevel has small height + .t count -update -ypixels 1.0 end set y1 [lindex [.t yview] 1] .t count -displaylines 5.0 11.0 set y2 [lindex [.t yview] 1] diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index f7741c6..32b77af 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -143,7 +143,7 @@ test spinbox-1.8.4 "-validate option: " -setup { .sb configure -validate all -validatecommand {lappend ::spinbox_test %P} pack .sb .sb set 50 - focus .sb + focus -force .sb after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait set ::spinbox_test } -cleanup { |