summaryrefslogtreecommitdiff
path: root/tix/tests/hlist/DirList.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tix/tests/hlist/DirList.tcl')
-rw-r--r--tix/tests/hlist/DirList.tcl51
1 files changed, 51 insertions, 0 deletions
diff --git a/tix/tests/hlist/DirList.tcl b/tix/tests/hlist/DirList.tcl
new file mode 100644
index 00000000000..3c4abe93309
--- /dev/null
+++ b/tix/tests/hlist/DirList.tcl
@@ -0,0 +1,51 @@
+# This file tests the pixmap image reader
+#
+
+proc About {} {
+ return "This file performs test on the DirList widget"
+}
+
+proc Test {} {
+ set w .dirlist
+
+ tixDirList $w
+ pack $w
+
+ set h [$w subwidget hlist]
+
+ # If we didn't specifi -value, the DirList should display the
+ # current directory
+ Assert {[tixStrEq [$w cget -value] [tixFSPWD]]}
+
+ # After changing the directory, the selection and anchor should change as
+ # well
+ set root [$h info children ""]
+ ClickHListEntry $h $root single
+ Assert {[tixStrEq [$w cget -value] [$h info data $root]]}
+ Assert {[tixStrEq [$h info selection] $root]}
+ Assert {[tixStrEq [$h info anchor] $root]}
+
+ case [tix platform] {
+ unix {
+ set dir1 /etc
+ set dir2 /etc
+ }
+ windows {
+ set dir1 C:\\Windows
+ set dir2 C:\\Backup
+ }
+ default {
+ return
+ }
+ }
+
+ foreach dir [list $dir1 $dir2] {
+ if ![file exists $dir] {
+ continue
+ }
+
+ $w config -value $dir
+ Assert {[tixStrEq [$w cget -value] $dir]}
+ Assert {[tixStrEq [$h info data [$h info anchor]] $dir]}
+ }
+}