diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bevel.tcl | 39 | ||||
-rw-r--r-- | tests/entry.test | 8 | ||||
-rw-r--r-- | tests/event.test | 4 | ||||
-rw-r--r-- | tests/font.test | 2 | ||||
-rw-r--r-- | tests/menu.test | 9 | ||||
-rwxr-xr-x | tests/option.file3 | 18 | ||||
-rw-r--r-- | tests/option.test | 11 | ||||
-rw-r--r-- | tests/text.test | 4 | ||||
-rw-r--r-- | tests/textDisp.test | 20 |
9 files changed, 97 insertions, 18 deletions
diff --git a/tests/bevel.tcl b/tests/bevel.tcl index 950b714..531def0 100644 --- a/tests/bevel.tcl +++ b/tests/bevel.tcl @@ -42,6 +42,7 @@ significance: r - should appear raised u - should appear raised and also slightly offset vertically s - should appear sunken +S - should appear solid n - preceding relief should extend right to end of line. * - should appear "normal" x - extra long lines to allow horizontal scrolling. @@ -125,15 +126,35 @@ foreach i {1 2 3} { .t.t insert end ***** .t.t insert end rrr r1 +font configure TkFixedFont -size 20 +.t.t tag configure sol100 -relief solid -borderwidth 100 \ + -foreground red -font TkFixedFont +.t.t tag configure sol12 -relief solid -borderwidth 12 \ + -foreground red -font TkFixedFont +.t.t tag configure big -font TkFixedFont +set ind [.t.t index end] + +.t.t insert end "\n\nBorders do not leak on the neighbour chars" +.t.t insert end "\nOnly \"S\" is on dark background" +.t.t insert end { + xxx + x} {} S sol100 {x + xxx} + +.t.t insert end "\n\nA very thick border grows toward the inside of the tagged area only" +.t.t insert end "\nOnly \"S\" is on dark background" +.t.t insert end { + xxxx} {} SSSSS sol100 {xxxx + x} {} SSSSSSSSSSSSSSSSSS sol100 {x + xxx} {} SSSSSSSSS sol100 xxxx {} +} +.t.t insert end "\n\nA thinner border is continuous" +.t.t insert end { + xxxx} {} SSSSS sol12 {xxxx + x} {} SSSSSSSSSSSSSSSSSS sol12 {x + xxx} {} SSSSSSSSS sol12 xxxx {} +} - - - - - - - - - +.t.t tag add big $ind end diff --git a/tests/entry.test b/tests/entry.test index ffdbf45..27acfc1 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -778,6 +778,14 @@ test entry-6.11 {EntryComputeGeometry procedure} win { [expr 8+5*[font measure {helvetica 12} .]] \ [expr 8+5*[font measure {helvetica 12} X]] \ [expr 8+[font measure {helvetica 12} 12345]]] +test entry-6.12 {EntryComputeGeometry procedure} {fonts} { + catch {destroy .e} + entry .e -font $fixed -bd 2 -relief raised -width 20 + pack .e + .e insert end "012\t456\t" + update + list [.e index @81] [.e index @82] [.e index @116] [.e index @117] +} {6 7 7 8} catch {destroy .e} entry .e -width 10 -font $fixed -textvariable contents -xscrollcommand scroll diff --git a/tests/event.test b/tests/event.test index fa75610..95be5f4 100644 --- a/tests/event.test +++ b/tests/event.test @@ -705,7 +705,7 @@ test event-7.1(double-click) {A double click on a lone character set result } {1.3 A 1.3 A} test event-7.2(double-click) {A double click on a lone character\ - in an entry widget should select that character} {knownBug} { + in an entry widget should select that character} { destroy .t set t [toplevel .t] set e [entry $t.e] @@ -766,7 +766,7 @@ test event-7.2(double-click) {A double click on a lone character\ lappend result [_get_selection $e] set result -} {3 A 4 A} +} {4 A 4 A} # cleanup diff --git a/tests/font.test b/tests/font.test index a02cc2e..9ed24dc 100644 --- a/tests/font.test +++ b/tests/font.test @@ -829,7 +829,7 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} { lappend x [getsize] .b.l config -wrap 0 set x -} "{[expr $ax*3] $ay} {[expr $ax*3] [expr $ay*2]}" +} "{[expr $ax*8] $ay} {[expr $ax*8] [expr $ay*2]}" test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} { set x {} .b.l config -text "000 000" -wrap [expr $ax*5] diff --git a/tests/menu.test b/tests/menu.test index cfe00b9..c797281 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -2566,6 +2566,15 @@ test menu-36.1 {menu -underline string overruns Bug 1599877} {} { tk::TraverseToMenu . "e" } {} +test menu-37.1 {menubar menues cannot be posted - bug 2160206} {} { + # On Linux the following used to panic + # It now returns an error (on all platforms) + catch {destroy .m} + menu .m -type menubar + list [catch ".m post 1 1" msg] $msg +} {1 {a menubar menu cannot be posted}} + + # cleanup deleteWindows cleanupTests 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 0909d2f..7c1731d 100644 --- a/tests/text.test +++ b/tests/text.test @@ -745,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/textDisp.test b/tests/textDisp.test index a6bbfd7..5508d7c 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -4104,7 +4104,7 @@ test textDisp-33.2 {one line longer than fits in the widget} { .tt debug 1 set tk_textHeightCalc "" .tt insert 1.0 [string repeat "more wrap + " 1] - after 100 ; update + after 100 ; update idletasks # Nothing should have been recalculated. set tk_textHeightCalc } {} @@ -4184,7 +4184,23 @@ test textDisp-34.1 {Text widgets multi-scrolling problem: Bug 2677890} -setup { return $result } -cleanup { destroy .t1 .sy -} -result {{0.0 1.0} {0.0 1.0} {0.0 1.0} {0.0 0.24}} +} -result {{0.0 0.24} {0.0 0.24} {0.0 0.24} {0.0 0.24}} + +test textDisp-35.1 {Init value of charHeight - Dancing scrollbar bug 1499165} -setup { + pack [text .t1] -fill both -expand y -side left + .t insert end "[string repeat a\nb\nc\n 500000]THE END\n" + set res {} +} -body { + .t see 10000.0 + after 300 {set fr1 [.t yview] ; set done 1} + vwait done + after 300 {set fr2 [.t yview] ; set done 1} + vwait done + lappend res [expr {[lindex $fr1 0] == [lindex $fr2 0]}] + lappend res [expr {[lindex $fr1 1] == [lindex $fr2 1]}] +} -cleanup { + destroy .t1 +} -result {1 1} deleteWindows option clear |