01: package jimm.datavision.test;
02:
03: import jimm.datavision.Report;
04: import jimm.datavision.layout.pdf.PDFLE;
05: import jimm.datavision.source.charsep.CharSepSource;
06: import java.io.*;
07: import junit.framework.TestCase;
08: import junit.framework.TestSuite;
09: import junit.framework.Test;
10:
11: /**
12: * Tests for the {@link PDFLE} PDF layout engine.
13: *
14: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
15: */
16: public class PDFLETest extends TestCase {
17:
18: protected static final File EXAMPLE_REPORT = new File(AllTests
19: .testDataFile("charsep.xml"));
20: protected static final String DATA_FILE = AllTests
21: .testDataFile("charsep_data.csv");
22: protected static final File OUT_FILE = new File(System
23: .getProperty("java.io.tmpdir"),
24: "datavision_pdfle_test_out.txt");
25:
26: protected Report report;
27: protected CharSepSource dataSource;
28:
29: public static Test suite() {
30: return new TestSuite(PDFLETest.class);
31: }
32:
33: public PDFLETest(String name) {
34: super (name);
35: }
36:
37: public void setUp() throws Exception {
38: report = new Report();
39:
40: OUT_FILE.deleteOnExit();
41: report
42: .setLayoutEngine(new PDFLE(new FileOutputStream(
43: OUT_FILE)));
44:
45: report.read(EXAMPLE_REPORT);
46:
47: dataSource = (CharSepSource) report.getDataSource();
48: dataSource.setSepChar(',');
49: dataSource.setInput(DATA_FILE);
50: }
51:
52: public void tearDown() {
53: if (OUT_FILE.exists())
54: OUT_FILE.delete();
55: }
56:
57: public void testNullReportSummary() {
58: report.setName(null);
59: report.setTitle(null);
60: report.setAuthor(null);
61: report.setDescription(null);
62: report.runReport();
63: }
64:
65: public static void main(String[] args) {
66: junit.textui.TestRunner.run(suite());
67: System.exit(0);
68: }
69:
70: }
|