aboutsummaryrefslogtreecommitdiff
path: root/Perl/t
diff options
context:
space:
mode:
authormertz2003-11-07 15:36:50 +0000
committermertz2003-11-07 15:36:50 +0000
commit25225610627298db1bb70e3b7d296c7ce848d6ae (patch)
tree5e7761eb18c79d4d8de9c153233cb059e6d1db83 /Perl/t
parentfc6b9897872007d57a2145e5d07d90f7e5305a0a (diff)
downloadtkzinc-25225610627298db1bb70e3b7d296c7ce848d6ae.zip
tkzinc-25225610627298db1bb70e3b7d296c7ce848d6ae.tar.gz
tkzinc-25225610627298db1bb70e3b7d296c7ce848d6ae.tar.bz2
tkzinc-25225610627298db1bb70e3b7d296c7ce848d6ae.tar.xz
Slight modifications to even better display zinc methods calls as code
and addition of some tests
Diffstat (limited to 'Perl/t')
-rw-r--r--Perl/t/traceutils.t90
1 files changed, 90 insertions, 0 deletions
diff --git a/Perl/t/traceutils.t b/Perl/t/traceutils.t
new file mode 100644
index 0000000..ad18813
--- /dev/null
+++ b/Perl/t/traceutils.t
@@ -0,0 +1,90 @@
+#!/usr/bin/perl -w
+
+#
+# $Id: traceutils.t,v 1.1 2003-11-07 15:36:49 mertz Exp $
+# Author: Christophe Mertz
+#
+
+# testing Tk::Zinc::TraceUtils utilities
+
+use Tk::Zinc::TraceUtils;
+use strict;
+
+BEGIN {
+ if (!eval q{
+# use Test::More qw(no_plan);
+ use Test::More tests => 14;
+ 1;
+ }) {
+ print "# tests only work properly with installed Test::More module\n";
+ print "1..1\n";
+ print "ok 1\n";
+ exit;
+ }
+ if (!eval q{
+ use Tk::Zinc::TraceUtils;
+ 1;
+ }) {
+ print "unable to load Tk::ZincTraceUtils";
+ print "1..1\n";
+ print "ok 1\n";
+ exit;
+ }
+}
+
+
+
+#### creating different images, bitmaps and pixmaps...
+
+my $arg;
+
+$arg = "1";
+is (&Item ($arg), $arg, "testing " . $arg);
+
+SKIP: {
+ my $mw;
+ skip "not able to create a MainWindow", 3 if !eval q{$mw = MainWindow->new()} ;
+ require Tk::Font;
+ my $font = $mw->fontCreate("testfont", -family => "Helvetica");
+
+ like ($font, qr/^testfont/, "font creation");
+ is (&Item ($font), "'testfont'", "testing " . "testfont"); # not so sure about this result!
+ print "$font : ", ref($font), "\n";
+ is (&List (-font => $font), "(-font => 'testfont')", );
+}
+
+$arg = "()";
+is (&List (eval $arg), $arg, "empty list: ". $arg);
+
+$arg = "(-option_without_value)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "(1, 2, 3, 4)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "(-1, -2, -3, -4)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "(1.2, -2, .01, -1.2e+22, 1.02e+34)";
+
+is (&List (eval $arg), ($arg =~ s/\.01/0.01/ , $arg ), $arg);
+
+$arg = "('-1aa' => -2, '-a b', -1.2)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "(-option => -2, -option2 => -1.2, -option3)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "('icon', 1, -priority => 210, -visible => 1)";
+is (&List (eval $arg), $arg, $arg);
+
+$arg = "('text', 1, -font => '-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*')";
+is (&List (eval $arg), $arg, $arg);
+
+
+$arg = "-option, -2, -option2, -1.2, -option3";
+is (&Array (eval "(".$arg.")"), "[".$arg."]", "[".$arg."]");
+
+
+
+diag("############## Tk::Zinc::TraceUtils test");