summaryrefslogtreecommitdiffstats
path: root/tests/embed.test
diff options
context:
space:
mode:
authormdejong <mdejong>2002-05-27 17:33:26 (GMT)
committermdejong <mdejong>2002-05-27 17:33:26 (GMT)
commit717618cf1c5064691abc8e4c200af7c109d688a9 (patch)
treec7b04c113fc582c6f1a250ccdc79fea74d634d4a /tests/embed.test
parentc19b3eb722ba8c6dd0d936b8ed1af843d676ff34 (diff)
downloadtk-717618cf1c5064691abc8e4c200af7c109d688a9.zip
tk-717618cf1c5064691abc8e4c200af7c109d688a9.tar.gz
tk-717618cf1c5064691abc8e4c200af7c109d688a9.tar.bz2
* tests/embed.test: Added cross platform embed tests.
Check that window passed to -use has the -container option set. * tests/wm.test: Remove useless catch call. Deiconify . just in case, stackorder tests will not pass unless it is in the normal state. Add -container flag to embedded stackorder test. * unix/tkUnixEmbed.c (TkpUseWindow): * win/tkWinEmbed.c (TkpUseWindow): Lookup Tk window based on the id passed in as the value for -use. Generate an error if the Tk window did not have the -container option set.
Diffstat (limited to 'tests/embed.test')
-rw-r--r--tests/embed.test51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/embed.test b/tests/embed.test
new file mode 100644
index 0000000..f19583a
--- /dev/null
+++ b/tests/embed.test
@@ -0,0 +1,51 @@
+# This file is a Tcl script to test out embedded Windows.
+#
+# Copyright (c) 1996-1997 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+# All rights reserved.
+#
+# RCS: @(#) $Id: embed.test,v 1.1 2002/05/27 17:33:26 mdejong Exp $
+
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
+
+proc deleteWindows {} {
+ foreach i [winfo children .] {
+ destroy $i
+ }
+}
+
+test embed-1.1 {TkpUseWindow procedure, bad window identifier} {
+ deleteWindows
+ list [catch {toplevel .t -use xyz} msg] $msg
+} {1 {expected integer but got "xyz"}}
+
+test embed-1.2 {CreateFrame procedure, bad window identifier} {
+ deleteWindows
+ list [catch {toplevel .t -container xyz} msg] $msg
+} {1 {expected boolean value but got "xyz"}}
+
+test embed-1.3 {CreateFrame procedure, both -use and
+ -container is invalid } {
+ deleteWindows
+ toplevel .container -container 1
+ list [catch {toplevel .t -use [winfo id .container] \
+ -container 1} msg] $msg
+} {1 {A window cannot have both the -use and the -container option set.}}
+
+test embed-1.4 {TkpUseWindow procedure, -container must be set} {
+ deleteWindows
+ toplevel .container
+ list [catch {toplevel .embd -use [winfo id .container]} err] $err
+} {1 {window ".container" doesn't have -container option set}}
+
+test embed-1.5 {TkpUseWindow procedure, -container must be set} {
+ deleteWindows
+ frame .container
+ list [catch {toplevel .embd -use [winfo id .container]} err] $err
+} {1 {window ".container" doesn't have -container option set}}
+
+
+# FIXME: test cases common to unixEmbed.test and macEmbed.test should
+# be moved here.