#!/usr/bin/perl -w
# -*- perl -*-

#
# $Id: noprereq.t,v 1.3 2001/08/08 21:15:25 eserte Exp $
# Author: Slaven Rezic
#

use strict;

use Tk;
use Tk::Date;

BEGIN {
    if (!eval q{
	use Test;
	1;
    }) {
	print "# tests only work with installed Test module\n";
	print "1..1\n";
	print "ok 1\n";
	exit;
    }
}

BEGIN { plan tests => 12 }

# simulate not having some prereq widgets
$Tk::Date::has_numentryplain = 0;
$Tk::Date::has_numentry      = 0;

$^W = 0;

my $top = new MainWindow;

my $d1 = $top->Date->pack;
ok(ref $d1, "Tk::Date");
my $d2 = $top->Date(-allarrows => 1)->pack;
ok(ref $d2, "Tk::Date");
ok($d2->cget(-allarrows), undef);
my $d3 = $top->Date(-monthmenu => 1)->pack;
ok(ref $d3, "Tk::Date");
ok(!!$d3->cget(-monthmenu), !!$Tk::VERSION >= 800.023);
my $d4 = $top->Date(-readonly => 1)->pack;
ok(ref $d4, "Tk::Date");

{
    # test -state
    my $d = $top->Date(-state => "disabled");
    ok($d->isa('Tk::Date'), 1);
    ok($d->cget(-state), 'disabled');
    $d->configure(-state => "normal");
    ok($d->cget(-state), 'normal');
}

{
    # test -state together with -editable
    my $d = $top->Date(-editable => 0);
    ok($d->isa('Tk::Date'), 1);
    $d->configure(-state => 'disabled');
    ok($d->cget(-state), 'disabled');
    $d->configure(-state => "normal");
    ok($d->cget(-state), 'normal');
}

#MainLoop;

__END__
