Update of /cvsroot/perl-win32-gui/Win32-GUI/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1048/t
Modified Files: 01_basic.t 05_Timer_01_OEM.t 05_Timer_02_NEM.t 05_Timer_03_Interval.t Added Files: 98_Pod.t Log Message: Tests and 1.03 release candidate Index: 01_basic.t =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/t/01_basic.t,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** 01_basic.t 3 Aug 2005 21:45:59 -0000 1.2 --- 01_basic.t 21 Nov 2005 22:33:34 -0000 1.3 *************** *** 12,27 **** BEGIN { $| = 1 } # Autoflush - use Test::More tests => 2; - # Perform tests ! # Check tha Win32::GUI load, and bail out of all ! # tests if it doesn't ! BEGIN { ! use_ok('Win32::GUI') ! or print STDOUT "Bail out! Can't load Win32::GUI"; ! }; ! ok($Win32::GUI::VERSION, "Win32::GUI version check"); --- 12,43 ---- BEGIN { $| = 1 } # Autoflush # Perform tests ! # Bail out if we havent got Test::More ! eval "use Test::More"; ! if($@) { ! # As we haven't got Test::More, can't use diag() ! print "#\n# Test::More required to perform any Win32::GUI test\n"; ! chomp $@; ! $@ =~ s/^/# /gm; ! print "[EMAIL PROTECTED]"; ! print "Bail Out! Test::More not available\n"; ! exit(1); ! } + plan( tests => 3 ); ! # Check that we're on windows or cygwin ! # bail out if we're not ! if ( not ($^O =~ /MSwin32|cygwin/i)) { ! diag("\nWin32::GUI can only run on MSWin32 or cygwin, not '$^O'"); ! print "Bail out! Incompatible Operating System\n"; ! } ! pass("Correct OS"); ! ! # Check that Win32::GUI loads, and bail out of all ! # tests if it doesn't ! use_ok('Win32::GUI') or print STDOUT "Bail out! Can't load Win32::GUI"; ! ! ok(defined $Win32::GUI::VERSION, "Win32::GUI version check"); Index: 05_Timer_01_OEM.t =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/t/05_Timer_01_OEM.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 05_Timer_01_OEM.t 13 Nov 2005 18:57:52 -0000 1.1 --- 05_Timer_01_OEM.t 21 Nov 2005 22:33:34 -0000 1.2 *************** *** 23,27 **** my @times; - my $t0 = time; my $W = new Win32::GUI::Window( --- 23,26 ---- *************** *** 30,33 **** --- 29,33 ---- isa_ok($W, "Win32::GUI::Window", "\$W"); + my $t0 = Win32::GetTickCount(); my $C = $W->AddTimer('T1', $elapse); isa_ok($C,$class, "\$W->AddTimer creats $class object"); *************** *** 48,58 **** is(scalar(@times), 3, "Timer went off 3 times"); for my $interval (@times) { ! ok(($interval <= 1) && ($interval >= 0), "Timer interval(${interval}s) appropriate"); } sub T1_Timer { ! my $t1 = time; push @times, ($t1 - $t0); $t0 = $t1; --- 48,59 ---- is(scalar(@times), 3, "Timer went off 3 times"); + my $delta = 150; #ms for my $interval (@times) { ! ok((abs($interval - $elapse) < $delta), "Timer interval(${interval}ms) appropriate"); } sub T1_Timer { ! my $t1 = Win32::GetTickCount(); push @times, ($t1 - $t0); $t0 = $t1; --- NEW FILE: 98_Pod.t --- #!perl -wT # Win32::GUI test suite. # $Id: 98_Pod.t,v 1.1 2005/11/21 22:33:34 robertemay Exp $ # Testing RichEdit::GetCharFormat() use strict; use warnings; BEGIN { $| = 1 } # Autoflush use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); Index: 05_Timer_02_NEM.t =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/t/05_Timer_02_NEM.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 05_Timer_02_NEM.t 13 Nov 2005 18:57:52 -0000 1.1 --- 05_Timer_02_NEM.t 21 Nov 2005 22:33:34 -0000 1.2 *************** *** 24,28 **** my %params; - my $t0 = time; my $W = new Win32::GUI::Window( --- 24,27 ---- *************** *** 32,35 **** --- 31,35 ---- isa_ok($W, "Win32::GUI::Window", "\$W"); + my $t0 = Win32::GetTickCount(); my $C = $W->AddTimer('T1', $elapse); isa_ok($C,$class, "\$W->AddTimer creats $class object"); *************** *** 50,55 **** is(scalar(@times), 3, "Timer went off 3 times"); for my $interval (@times) { ! ok(($interval <= 1) && ($interval >= 0), "Timer interval(${interval}s) appropriate"); } @times=(); --- 50,56 ---- is(scalar(@times), 3, "Timer went off 3 times"); + my $delta = 150; #ms for my $interval (@times) { ! ok((abs($interval - $elapse) < $delta), "Timer interval(${interval}ms) appropriate"); } @times=(); *************** *** 64,68 **** $params{name} = shift; ! my $t1 = time; push @times, ($t1 - $t0); $t0 = $t1; --- 65,69 ---- $params{name} = shift; ! my $t1 = Win32::GetTickCount(); push @times, ($t1 - $t0); $t0 = $t1; Index: 05_Timer_03_Interval.t =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/t/05_Timer_03_Interval.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 05_Timer_03_Interval.t 13 Nov 2005 18:57:52 -0000 1.1 --- 05_Timer_03_Interval.t 21 Nov 2005 22:33:34 -0000 1.2 *************** *** 23,32 **** my @times; - my $t0 = time; - my $W = new Win32::GUI::Window( -name => "TestWindow", -onTimer => \&_process_timer, ); my $C = $W->AddTimer('T1', $elapse); --- 23,31 ---- my @times; my $W = new Win32::GUI::Window( -name => "TestWindow", -onTimer => \&_process_timer, ); + my $t0 = Win32::GetTickCount(); my $C = $W->AddTimer('T1', $elapse); *************** *** 37,42 **** is(scalar(@times), 3, "Timer went off 3 times"); for my $interval (@times) { ! ok(($interval <= 1) && ($interval >= 0), "Timer interval(${interval}s) appropriate"); } --- 36,42 ---- is(scalar(@times), 3, "Timer went off 3 times"); + my $delta = 150; #ms for my $interval (@times) { ! ok((abs($interval - $elapse) < $delta), "Timer interval(${interval}ms) appropriate"); } *************** *** 49,58 **** is(scalar(@times), 3, "Timer went off 3 times"); for my $interval (@times) { ! ok(($interval <= 2) && ($interval >= 0), "Timer interval(${interval}s) appropriate"); } sub _process_timer { ! my $t1 = time; push @times, ($t1 - $t0); $t0 = $t1; --- 49,58 ---- is(scalar(@times), 3, "Timer went off 3 times"); for my $interval (@times) { ! ok((abs($interval-($elapse+500)) < $delta), "Timer interval(${interval}ms) appropriate"); } sub _process_timer { ! my $t1 = Win32::GetTickCount(); push @times, ($t1 - $t0); $t0 = $t1;