# This file is a Tcl script to test the procedures in the file # tkGeometry.c (generic support for geometry managers). It is # organized in the standard fashion for Tcl tests. # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # # RCS: @(#) $Id: geometry.test,v 1.1.1.1 2007/07/10 15:05:18 duncan Exp $ package require tcltest 2.1 namespace import -force tcltest::configure namespace import -force tcltest::testsDirectory configure -testdir [file join [pwd] [file dirname [info script]]] configure -loadfile [file join [testsDirectory] constraints.tcl] tcltest::loadTestedCommands wm geometry . 300x300 raise . update frame .f -bd 2 -relief raised frame .f.f -bd 2 -relief sunken frame .f.f.f -bd 2 -relief raised button .b1 -text .b1 button .b2 -text .b2 button .b3 -text .b3 button .f.f.b4 -text .b4 test geometry-1.1 {Tk_ManageGeometry procedure} { place .b1 -x 120 -y 80 update list [winfo x .b1] [winfo y .b1] } {120 80} test geometry-1.2 {Tk_ManageGeometry procedure} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .b1 -in .f -x 40 -y 30 update pack .b1 -side top -anchor w place .f -x 30 -y 40 update list [winfo x .b1] [winfo y .b1] } {0 0} test geometry-2.1 {Tk_GeometryRequest procedure} { frame .f2 set result [list [winfo reqwidth .f2] [winfo reqheight .f2]] .f2 configure -width 150 -height 300 update lappend result [winfo reqwidth .f2] [winfo reqheight .f2] \ [winfo geom .f2] place .f2 -x 10 -y 20 update lappend result [winfo geom .f2] .f2 configure -width 100 -height 80 update lappend result [winfo geom .f2] } {1 1 150 300 1x1+0+0 150x300+10+20 100x80+10+20} catch {destroy .f2} test geometry-3.1 {Tk_SetInternalBorder procedure} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .b1 -in .f -x 50 -y 5 update set x [list [winfo x .b1] [winfo y .b1]] .f configure -bd 5 update lappend x [winfo x .b1] [winfo y .b1] } {72 37 75 40} .f configure -bd 2 test geometry-4.1 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 update list [winfo x .b1] [winfo y .b1] } {91 46} test geometry-4.2 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 place .b3 -in .f.f.f -x 50 -y 25 update place .f -x 30 -y 25 update list [winfo x .b1] [winfo y .b1] [winfo x .b2] [winfo y .b2] \ [winfo x .b3] [winfo y .b3] } {101 41 61 61 101 61} test geometry-4.3 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 place .b3 -in .f.f.f -x 50 -y 25 update destroy .b1 button .b1 -text .b1 place .f.f -x 10 -y 25 update list [winfo x .b1] [winfo y .b1] [winfo x .b2] [winfo y .b2] \ [winfo x .b3] [winfo y .b3] } {0 0 46 86 86 86} test geometry-4.4 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 place .b3 -in .f.f.f -x 50 -y 25 update destroy .b2 button .b2 -text .b2 place .f.f.f -x 2 -y 3 update list [winfo x .b1] [winfo y .b1] [winfo x .b2] [winfo y .b2] \ [winfo x .b3] [winfo y .b3] } {93 49 0 0 93 69} test geometry-4.5 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 place .b3 -in .f.f.f -x 50 -y 25 update destroy .b3 button .b3 -text .b3 place .f.f.f -x 2 -y 3 update list [winfo x .b1] [winfo y .b1] [winfo x .b2] [winfo y .b2] \ [winfo x .b3] [winfo y .b3] } {93 49 53 69 0 0} test geometry-4.6 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3 .f.f.b4} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .f.f.b4 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 update place .f -x 25 -y 35 update list [winfo x .f.f.b4] [winfo y .f.f.b4] [winfo x .b2] [winfo y .b2] } {54 9 56 71} test geometry-4.7 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3 .f.f.b4} { place forget $w } bind .b1 {lappend x configure} place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .f.f.b4 -in .f.f.f -x 50 -y 5 place .b1 -in .f.f.f -x 10 -y 25 update set x init place .f -x 25 -y 35 update lappend x | place .f -x 30 -y 40 place .f.f -x 10 -y 0 update bind .b1 {} set x } {init configure |} test geometry-4.8 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 place .b2 -in .f.f.f -x 10 -y 25 place .b3 -in .f.f.f -x 50 -y 25 update destroy .f.f frame .f.f -bd 2 -relief raised frame .f.f.f -bd 2 -relief raised place .f -x 30 -y 25 update list [winfo x .b1] [winfo y .b1] [winfo ismapped .b1] \ [winfo x .b2] [winfo y .b2] [winfo ismapped .b2] \ [winfo x .b3] [winfo y .b3] [winfo ismapped .b3] } {91 46 0 51 66 0 91 66 0} test geometry-4.9 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w } place .f -x 20 -y 30 -width 200 -height 200 place .f.f -x 15 -y 5 -width 150 -height 120 place .f.f.f -width 100 -height 80 place .b1 -in .f.f.f -x 50 -y 5 update set result [winfo ismapped .b1] place forget .f.f update lappend result [winfo ismapped .b1] place .f.f -x 15 -y 5 -width 150 -height 120 update lappend result [winfo ismapped .b1] } {1 0 1} test geometry-4.10 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} { toplevel .t wm geometry .t +0+0 tkwait visibility .t update frame .t.f pack .t.f button .t.quit -text Quit -command exit pack .t.quit -in .t.f wm iconify .t set x 0 after 500 {set x 1} tkwait variable x wm deiconify .t update winfo ismapped .t.quit } {1} catch {destroy .t} # cleanup ::tcltest::cleanupTests return