# grid.test --
#
#       This file is a Tcl script to test out tixGrid.c and tixGrRC.c
#       It is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: grid.test,v 1.1 2001/01/11 07:25:42 ioilam Exp $

package require Tix 8.2

if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

set longword xx
for {set i 0} {$i < 10} {incr i} {
    set longword $longword$longword
}

proc format-$longword {args} {
    global format_called

    set format_called 1
}

test grid-1.1 {Tix_GrCallFormatCmd()} {
    set format_called 0
    tixGrid .grid -formatcmd format-$longword
    pack .grid
    update idletasks
    destroy .grid
    set format_called
} {1}


test grrc-1.1 {Tix_GrRCSize} {
    tixGrid .grid

    set a [list [catch {
        .grid size row xx
    } msg] $msg]

    destroy .grid
    set a
} {1 {unknown option "xx"; must be an integer or "default"}}

test grrc-1.2 {Tix_GrRCSize(): sprintf} {
    tixGrid .grid

    set a [list [catch {
        .grid size row default -pad
    } msg] $msg]

    destroy .grid
    set a
} {1 {value missing for option "-pad"}}

test grrc-1.3 {Tix_GrRCSize(): sprintf} {
    tixGrid .grid

    set a [list [catch {
        .grid size row 123 -pad
    } msg] $msg]

    destroy .grid
    set a
} {1 {value missing for option "-pad"}}


# cleanup
::tcltest::cleanupTests
return

