summaryrefslogtreecommitdiff
path: root/itcl/iwidgets/tests/disjointlistbox.test
blob: 0cee69b3d9c7f35bf8cea15a0a554f589f29a676 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# This file is a Tcl script to test out [incr Widgets] Disjointlistbox class.
# It is organized in the standard fashion for Tcl tests with the following
# notation for test case labels:
#
#   1.x - Construction/Destruction tests
#   2.x - Configuration option tests
#   3.x - Method tests
#
# Copyright (c) 1995 DSC Technologies Corporation
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id$

package require tcltest
namespace import -force ::tcltest::*

if [catch {package require Iwidgets 4.0}] {
  # Let's try modifying the auto_path.  Note that the IWIDGETS_LIBRARY
  # env var is initialized in the Makefile when doing a 'make test'.
  # If sourcing this file independently, this variable must be set manually.
  if ![info exists env(IWIDGETS_LIBRARY)] {
    error "Unable to locate Iwidgets package.  Set your IWIDGETS_LIBRARY\
      environment\nvariable to the directory that contains iwidgets.tcl"
  }
  lappend auto_path $env(IWIDGETS_LIBRARY)
  package require Iwidgets 4.0
}

if {[string compare test [info procs test]] == 1} {
    source defs
}

wm geometry . {}
raise .

set c 1
set o 1
set m 1

#
# Initial construction test
#
test Disjointlistbox-1.$c {Disjointlistbox construction} {
    iwidgets::Disjointlistbox .lf
    pack .lf -fill both -expand yes
    update 
} {}

incr c

#
# Option tests which are successful.
#
test Disjointlistbox-2.$o {configuration option} {
    llength [.lf configure]
} {30}

incr o

foreach test {
    {-lhslabeltext "LHS" "LHS"}
    {-lhslabeltext "Available" "Available"}
    {-lhslabeltext "Don't Print" "Don't Print"}
    {-rhslabeltext "RHS" "RHS"}
    {-rhslabeltext "Current" "Current"}
    {-rhslabeltext "Print" "Print"}
    {-lhssortoption "none" "none"}
    {-rhssortoption "none" "none"}
    {-buttonplacement bottom bottom}
    {-buttonplacement center center}
    } {
	set option [lindex $test 0]
	test Disjointlistbox-1.$o "configuration options, $option" {
	    .lf configure $option [lindex $test 1]
	    lindex [.lf configure $option] 4
	} [lindex $test 2]
        update 
	incr o
    }

#
# Method tests which are successful.
#
test Disjointlistbox-1.$c {Disjointlistbox destruction} {
    destroy .lf
    update 
} {}

incr c

test Disjointlistbox-1.$c {Disjointlistbox construction} {
    iwidgets::disjointlistbox .lf -lhslabeltext "Don't Print" -rhslabeltext "Print"
    pack .lf -fill both -expand yes
    update 
} {}

incr c

test Disjointlistbox-1.$c {Disjointlistbox destruction} {
    destroy .lf
    update 
} {}

incr c

test Disjointlistbox-1.$c {Disjointlistbox construction} {
    iwidgets::disjointlistbox .lf 
    pack .lf 
    destroy .lf
    update 
} {}

::tcltest::cleanupTests
exit