# class.test --
#
#       This file is a Tcl script to test out tixClass.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: class.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]
}

if {![info exists widgetTestClass1]} {
    source [file join [pwd] [file dirname [info script]] widgetTestClass1.tcl]
}

test class-1.1 {Tix_InstanceCmd(): subwidget} {
    widgetTestClass1 .test
    set a [.test subwidget $longword]
    destroy .test
    list $a
} [list .test.$longword]

test class-2.1 {Tix_InstanceCmd(): subwidgets} {
    widgetTestClass1 .test

    set a [list [catch {
        .test subwidgets
    } msg] $msg]

    destroy .test
    set a
} {1 {unknown flag , should be -all, -class or -group}}

test class-2.2 {Tix_InstanceCmd(): subwidgets} {
    widgetTestClass1 .test

    set a [.test subwidgets -class Button]
    destroy .test
    expr {[lsearch  $a .test.$longword] >= 0}
} {1}

# todo: subwidgets -group, -all -

# cleanup
::tcltest::cleanupTests
return
