File: html4.test

package info (click to toggle)
tk-html3 3.0~fossil20110109-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,644 kB
  • ctags: 5,882
  • sloc: ansic: 48,994; tcl: 26,030; sh: 1,190; yacc: 161; makefile: 24
file content (64 lines) | stat: -rwxr-xr-x 1,711 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/wish
if {[info commands html] == ""} {
    if {[file exists libTkhtml2.0.so]} {
	load ./libTkhtml2.0.so
    } else {
	package require Tkhtml
    }
}
package require tcltest

::tcltest::test html-4.1 {textarea space after dot} {
    set ::RESULT {}
    proc FormCmd {n cmd args} {
	if {$cmd != "textarea"} return
	set ::RESULT [lindex $args end]
    }
    html .html -formcommand FormCmd
    pack .html
    .html parse {
	<html><body><form action="submit" method="get">
	<textarea name="test" cols="20" rows="2">A.B. C.  D.</textarea>
	</form></body></html>
    }
    # To force all FormCmd is executed...
    update
    
    set ::RESULT
} {A.B. C.  D.}

::tcltest::test html-4.2 {pre space after dot} {
    catch {destroy .html}
    pack [html .html]
    .html parse {<body>BEGIN<pre>A.B. C.  D.</pre>END</body>}
    .html text ascii 1 end
} {BEGINA.B. C.  D.END}

::tcltest::test html-4.3 {SentencePadding A. B. C.} {
    catch {destroy .html}
    pack [html .html -sentencepadding 1]
    .html parse {<h1>A. B. C.</h1>}
    set result [.html text ascii 1 end]
    destroy .html
    set result
} {A.  B.  C.}

::tcltest::test html-4.4 {SentencePadding for D.C...} {
    catch {destroy .html}
    pack [html .html]
    catch {.html configure -sentencepadding 1}
    .html parse {<h1>Today Washington D.C. is ...</h1>}
    set result [.html text ascii 1 end]
    destroy .html
    set result
} {Today Washington D.C. is ...}

::tcltest::test html-4.5 {No SentencePadding for "A.  B."} {
    catch {destroy .html}
    pack [html .html]
    catch {.html configure -sentencepadding 1}
    .html parse {<h1>A.  B.</h1>}
    set result [.html text ascii 1 end]
    destroy .html
    set result
} {A.  B.}