summaryrefslogtreecommitdiffstats
path: root/tests/entry.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/entry.test')
-rw-r--r--tests/entry.test52
1 files changed, 33 insertions, 19 deletions
diff --git a/tests/entry.test b/tests/entry.test
index 701bb29..a765b2a 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -1,24 +1,47 @@
-# This file is a Tcl script to test entry widgets in Tk. It is
-# organized in the standard fashion for Tcl tests.
+# This file is a Tcl script to test entry widgets in Tk.
#
# Copyright © 1994 The Regents of the University of California.
# Copyright © 1994-1997 Sun Microsystems, Inc.
# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.2
-namespace import ::tcltest::*
-eval tcltest::configure $argv
-tcltest::loadTestedCommands
+# NOTE
+#
+# Gathered comments about lacks
+# Still need to write tests for EntryBlinkProc, EntryFocusProc,
+# EntryTextVarProc, EntryScanTo and EntrySelectTo, DisplayEntry, EventuallyRedraw.
+
+#
+# TESTFILE INITIALIZATION
+#
+
+package require tcltest 2.2; # needed in mode -singleproc 0
+
+# Load the main script "main.tcl", which takes care of:
+# - setup for the application and the root window
+# - importing commands from the tcltest namespace
+# - loading of the testutils mechanism along with its utility procs
+# - loading of Tk specific test constraints (additionally to constraints
+# provided by the package tcltest)
+source [file join [tcltest::configure -testdir] main.tcl]
+# Ensure a pristine initial window state
+resetWindows
# Import utility procs for specific functional areas
testutils import entry scroll
+#
+# COMMON TEST SETUP
+#
+
foreach i {1 2 3} {
set validateCmd$i [list validateCommand$i %W %d %i %P %s %S %v %V]
}
set cy [font metrics {Courier -12} -linespace]
+#
+# TESTS
+#
test entry-1.1 {configuration option: "background" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
@@ -2851,7 +2874,7 @@ test entry-13.26 {GetEntryIndex procedure} -constraints fonts -body {
destroy .e
} -result {0 1}
-# XXX Still need to write tests for EntryScanTo and EntrySelectTo.
+# Still need to write tests for EntryScanTo and EntrySelectTo.
test entry-14.1 {EntryFetchSelection procedure} -body {
@@ -3331,7 +3354,7 @@ test entry-19.17 {entry widget validation} -setup {
} -result {focusout {.e -1 -1 newdata abcd {} focusout forced}}
-# proc doval changed - returns 0
+# Using validateCmd3, which returns 0
test entry-19.18 {entry widget validation} -setup {
unset -nocomplain textVar validationData
} -body {
@@ -3351,7 +3374,7 @@ test entry-19.18 {entry widget validation} -setup {
## This sets validate to none because it shows that we prevent a possible
## loop condition in the validation, when the entry textvar is also set
-# proc doval2 used
+# Using validateCmd2
test entry-19.19 {entry widget validation} -setup {
unset -nocomplain textVar validationData
} -body {
@@ -3596,16 +3619,8 @@ test entry-25.3 {Bug [2a32225cd1] - Navigation in a password made of several wor
destroy .e
} -result {{} {}}
-
-# Gathered comments about lacks
-# XXX Still need to write tests for EntryBlinkProc, EntryFocusProc,
-# and EntryTextVarProc.
-# No tests for DisplayEntry.
-# XXX Still need to write tests for EntryScanTo and EntrySelectTo.
-# No tests for EventuallyRedraw
-
#
-# CLEANUP
+# TESTFILE CLEANUP
#
# option clear
@@ -3615,5 +3630,4 @@ foreach i {1 2 3} {
unset i
testutils forget entry scroll
cleanupTests
-return