OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [hyperhelp.test] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file is a Tcl script to test out [incr Widgets] Hyperhelp class.
2
# It is organized in the standard fashion for Tcl tests with the following
3
# notation for test case labels:
4
#
5
#   1.x - Construction/Destruction tests
6
#   2.x - Configuration option tests
7
#   3.x - Method tests
8
#
9
# Copyright (c) 1995 DSC Technologies Corporation
10
#
11
# See the file "license.terms" for information on usage and redistribution
12
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
#
14
# @(#) $Id: hyperhelp.test
15
 
16
package require Iwidgets 3.0
17
 
18
if {[string compare test [info procs test]] == 1} {
19
    source defs
20
}
21
 
22
set c 1
23
set o 1
24
set m 1
25
 
26
#
27
# Initial construction test
28
#
29
test Hyperhelp-1.$c {Hyperhelp construction} {
30
    iwidgets::Hyperhelp .h
31
    .h center
32
    .h activate
33
    update
34
} {}
35
 
36
incr c
37
 
38
#
39
# Option tests which are successful.
40
#
41
test Hyperhelp-2.$o {configuration option} {
42
    llength [.h configure]
43
} {43}
44
 
45
incr o
46
 
47
foreach test [concat {
48
    {-activebackground #ececec #ececec}
49
    {-activeforeground Black Black}
50
    {-activerelief raised raised}
51
    {-background #d9d9d9 #d9d9d9}
52
    {-borderwidth 3 3}
53
    {-cursor gumby gumby}
54
    {-font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* \
55
       -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*}
56
    {-foreground Black Black}
57
    {-highlightcolor Black Black}
58
    {-highlightthickness 3 3}
59
    {-height 120 120}
60
    {-width 500 500}
61
    {-relief raised raised}
62
    {-relief sunken sunken}
63
    {-vscrollmode none none}
64
    {-vscrollmode static static}
65
    {-vscrollmode dynamic dynamic}
66
    {-hscrollmode none none}
67
    {-hscrollmode static static}
68
    {-hscrollmode dynamic dynamic}
69
    {-sbwidth 20 20}
70
    {-scrollmargin 5 5}
71
    {-selectborderwidth 2 2}
72
    {-textbackground GhostWhite GhostWhite}
73
    {-visibleitems 72x40 72x40}
74
    {-height 0 0}
75
    {-width 0 0}
76
    {-wrap char char}
77
    {-wrap none none}
78
    {-unknownimage {} {}}
79
    {-link blue blue}
80
    {-linkhighlight red red}
81
    {-fontname times times}
82
    {-fixedfont courier courier}
83
    {-fontsize medium medium}
84
    {-topics {} {}}
85
    {-title "Test" "Test"} } \
86
    [list [list -helpdir . [pwd]/.]]] {
87
        set option [lindex $test 0]
88
        test Hyperhelp-2.$o "configuration options, $option" {
89
            .h configure $option [lindex $test 1]
90
            lindex [.h configure $option] 4
91
        } [lindex $test 2]
92
        update
93
        incr o
94
}
95
 
96
#
97
# Option tests which fail and produce errors.
98
#
99
foreach test {
100
  {-visibleitems bogus {bad visibleitems option "bogus": should be widthxheight}}
101
  {-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}
102
  {-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}
103
  {-fontname bogus {Invalid font name "bogus". Must be one of  helvetica courier times symbol}}
104
  {-fontsize bogus {bad fontsize option "bogus": should be small, medium, large, or huge}}
105
  {-fixedfont bogus {Invalid font name "bogus". Must be one of  helvetica courier times symbol}}} {
106
        set option [lindex $test 0]
107
        test Hyperhelp-2.$o "configuration options, $option" {
108
            list [catch {.h configure $option [lindex $test 1]} msg] $msg
109
        } [list 1 [lindex $test 2]]
110
        incr o
111
}
112
 
113
#
114
# Method tests which are successful.
115
#
116
foreach test {
117
    {{.h showtopic hyperhelp} -1}
118
    {{.h followlink scrolledhtml.test#} -1}
119
    {{.h back} -1}
120
    {{.h forward} -1}} {
121
        set method [lindex [lindex $test 0] 1]
122
        test Hyperhelp-3.$m "object methods, $method" {
123
            list [catch {eval [lindex $test 0]} msg] $msg
124
        } [list 0 [lindex $test 1]]
125
        update
126
        incr m
127
}
128
 
129
#
130
# Conclusion of construction/destruction tests
131
#
132
test Hyperhelp-1.$c {Hyperhelp destruction} {
133
    destroy .h
134
    update
135
} {}
136
 
137
incr c
138
 
139
test Hyperhelp-1.$c {Hyperhelp construction} {
140
    iwidgets::hyperhelp .h -topics {index} -helpdir ~/public_html
141
    .h center
142
    .h activate
143
    update
144
} {}
145
 
146
incr c
147
 
148
test Hyperhelp-1.$c {Hyperhelp destruction} {
149
    destroy .h
150
    update
151
} {}
152
 
153
incr c
154
 
155
test Hyperhelp-1.$c {Hyperhelp destruction} {
156
    iwidgets::hyperhelp .h
157
    .h center
158
    .h activate
159
    .h deactivate
160
    destroy .h
161
    update
162
} {}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.