blob: 74eef72b588b340eac6549143fb25ca344fe4226 (
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
|
# This file is a Tcl script to test out embedded Windows.
#
# Copyright © 1996-1997 Sun Microsystems, Inc.
# Copyright © 1998-1999 Scriptics Corporation.
# All rights reserved.
# NOTE
#
# This test file is platform-indifferent. Tests regarding embedded windows that
# are specific to the unix platform (this includes macOS) go into the test file
# unixEmbed.test.
#
#
# 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
#
# TESTS
#
test embed-1.1 {Tk_UseWindow procedure, bad window identifier} -setup {
deleteWindows
} -body {
toplevel .t -use xyz
} -cleanup {
deleteWindows
} -returnCodes error -result {expected integer but got "xyz"}
test embed-1.2 {CreateFrame procedure, bad window identifier} -setup {
deleteWindows
} -body {
toplevel .t -container xyz
} -cleanup {
deleteWindows
} -returnCodes error -result {expected boolean value but got "xyz"}
test embed-1.3 {CreateFrame procedure, both -use and -container is invalid} -setup {
deleteWindows
} -body {
toplevel .container -container 1
toplevel .t -use [winfo id .container] -container 1
} -cleanup {
deleteWindows
} -returnCodes error -result {windows cannot have both the -use and the -container option set}
# testing window embedding for win platforms
test embed-1.4.win {Tk_UseWindow procedure, -container must be set} -constraints {
win
} -setup {
deleteWindows
} -body {
toplevel .container
toplevel .embd -use [winfo id .container]
} -cleanup {
deleteWindows
} -returnCodes error -result {the window to use is not a Tk container}
# testing window embedding for win platforms
test embed-1.5.win {Tk_UseWindow procedure, -container must be set} -constraints {
win
} -setup {
deleteWindows
} -body {
frame .container
toplevel .embd -use [winfo id .container]
} -cleanup {
deleteWindows
} -returnCodes error -result {the window to use is not a Tk container}
# testing window embedding for other than win platforms
test embed-1.4.nonwin {Tk_UseWindow procedure, -container must be set} -constraints {
nonwin
} -setup {
deleteWindows
} -body {
toplevel .container
toplevel .embd -use [winfo id .container]
} -cleanup {
deleteWindows
} -returnCodes error -result {window ".container" doesn't have -container option set}
# testing window embedding for other than win platforms
test embed-1.5.nonwin {Tk_UseWindow procedure, -container must be set} -constraints {
nonwin
} -setup {
deleteWindows
} -body {
frame .container
toplevel .embd -use [winfo id .container]
} -cleanup {
deleteWindows
} -returnCodes error -result {window ".container" doesn't have -container option set}
#
# TESTFILE CLEANUP
#
cleanupTests
|