[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3882] branches/1.3



Revision: 3882
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3882&view=rev
Author:   einhverfr
Date:     2011-10-18 05:51:57 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
Correcting test cases so they don't fail when optional LaTeX modules not installed

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/t/01-load.t
    branches/1.3/t/04-template-handling.t

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-10-17 23:48:11 UTC (rev 3881)
+++ branches/1.3/Changelog	2011-10-18 05:51:57 UTC (rev 3882)
@@ -3,8 +3,9 @@
 Supported Presently
 
 Changelog for LedgerSMB 1.3.2
-* Fixed a few files where suExec fixes were not applied
-* Fixed erroneous buttons marked "Save and Post" showing up
+* Fixed a few files where suExec fixes were not applied (Chris T)
+* Fixed erroneous buttons marked "Save and Post" showing up (Chris T)
+* Corrected test cases so they do not fail w/o optional LaTeX mods (Chris T)
 
 Changelog for LedgerSMB 1.3.1
 * Language selection for invoice templates fixed (Chris T)

Modified: branches/1.3/t/01-load.t
===================================================================
--- branches/1.3/t/01-load.t	2011-10-17 23:48:11 UTC (rev 3881)
+++ branches/1.3/t/01-load.t	2011-10-18 05:51:57 UTC (rev 3882)
@@ -56,8 +56,11 @@
 use_ok('LedgerSMB::DBObject::Asset_Report');
 use_ok('LedgerSMB::DBObject::Asset_Class');
 SKIP: {
-    eval{ require Template::Plugin::Latex};
-    skip 'Template::Plugin::Latex not installed', 1 if @_;
+    eval{ require Template::Plugin::Latex} ||
+    skip 'Template::Plugin::Latex not installed';
+    eval{ require Template::Latex} ||
+    skip 'Template::Latex not installed';
+
     use_ok('LedgerSMB::Template::LaTeX');
 }
 use_ok('LedgerSMB::Template::TXT');

Modified: branches/1.3/t/04-template-handling.t
===================================================================
--- branches/1.3/t/04-template-handling.t	2011-10-17 23:48:11 UTC (rev 3881)
+++ branches/1.3/t/04-template-handling.t	2011-10-18 05:51:57 UTC (rev 3882)
@@ -20,7 +20,11 @@
 use LedgerSMB::Template::Elements;
 use LedgerSMB::Template::CSV;
 use LedgerSMB::Template::HTML;
-use LedgerSMB::Template::LaTeX;
+my $has_latex = 0;
+ (  eval {require LedgerSMB::Template::LaTeX } 
+&&  eval {require Template::Latex} 
+&&  eval {require Template::Plugins::Latex}
+) || ($has_latex = 1) ;
 use LedgerSMB::Template::TXT;
 
 $LedgerSMB::Sysconfig::tempdir = 't/var';
@@ -336,41 +340,45 @@
 ## Rendering tests ##
 #####################
 
-$template = undef;
-$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PDF', 
+SKIP: {
+    skip "LaTeX modules not installed" unless $has_latex;
+    $template = undef;
+    $template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PDF', 
 	'template' => '04-template', 'no_auto_output' => 1);
-ok(defined $template, 
+    ok(defined $template, 
 	'Template, new (PDF): Object creation with format and template');
-isa_ok($template, 'LedgerSMB::Template', 
+    isa_ok($template, 'LedgerSMB::Template', 
 	'Template, new (PDF): Object creation with format and template');
-is($template->{include_path}, 't/data',
+    is($template->{include_path}, 't/data',
 	'Template, new (PDF): Object creation with format and template');
-is($template->render({'login' => 'foo&bar'}), "t/var/04-template-output-$$.pdf",
+    is($template->render({'login' => 'foo&bar'}), 
+        "t/var/04-template-output-$$.pdf",
 	'Template, render (PDF): Simple PDF template, default filename');
-ok(-e "t/var/04-template-output-$$.pdf",
+    ok(-e "t/var/04-template-output-$$.pdf",
 	'Template, render (PDF): File created');
-is(unlink("t/var/04-template-output-$$.pdf"), 1,
+    is(unlink("t/var/04-template-output-$$.pdf"), 1,
 	'Template, render (PDF): removing testfile');
-ok(!-e "t/var/04-template-output-$$.pdf",
+    ok(!-e "t/var/04-template-output-$$.pdf",
 	'Template, render (PDF): testfile removed');
 
-$template = undef;
-$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PS', 
+    $template = undef;
+    $template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PS', 
 	'template' => '04-template', 'no_auto_output' => 1);
-ok(defined $template, 
+    ok(defined $template, 
 	'Template, new (PS): Object creation with format and template');
-isa_ok($template, 'LedgerSMB::Template', 
+    isa_ok($template, 'LedgerSMB::Template', 
 	'Template, new (PS): Object creation with format and template');
-is($template->{include_path}, 't/data',
+    is($template->{include_path}, 't/data',
 	'Template, new (PS): Object creation with format and template');
-is($template->render({'login' => 'foo\&bar'}),
+    is($template->render({'login' => 'foo\&bar'}),
 	"t/var/04-template-output-$$.ps",
 	'Template, render (PS): Simple Postscript template, default filename');
-ok(-e "t/var/04-template-output-$$.ps", 'Template, render (PS): File created');
-is(unlink("t/var/04-template-output-$$.ps"), 1,
+    ok(-e "t/var/04-template-output-$$.ps", 'Template, render (PS): File created');
+    is(unlink("t/var/04-template-output-$$.ps"), 1,
 	'Template, render (PS): removing testfile');
-ok(!-e "t/var/04-template-output-$$.ps",
+    ok(!-e "t/var/04-template-output-$$.ps",
 	'Template, render (PS): testfile removed');
+}
 
 $template = undef;
 $template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'TXT', 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.