feat: add Java JRXML-to-PNG rendering pipeline with pixel-level SSIM comparison
- lib/java/: Java renderer (JrxmlRenderer) using JasperReports 6.21.0 - JrxmlDebug for diagnostics, JrxmlGen for format reference - download_jars.sh for one-time dependency setup - agent/nodes.py: _render_jrxml_to_png() and _compute_pixel_similarity() - Pixel comparison integrates into validate node (SSIM < 0.4 fails) - Pixel fidelity context injected into correct_jrxml for targeted fixes - tests/test_pixel_comparison.py: 15 unit tests (render, SSIM, integration) - .gitignore: exclude lib/java/*.jar, lib/java/*.class, tmp/ - CLAUDE.md: v11 changelog documenting the rendering pipeline - All non-LLM tests pass (97/97)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import net.sf.jasperreports.engine.*;
|
||||
import net.sf.jasperreports.engine.design.*;
|
||||
import net.sf.jasperreports.engine.xml.*;
|
||||
import java.io.*;
|
||||
|
||||
public class JrxmlDebug {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String path = args.length > 0 ? args[0] : "D:/Idea Project/jaspersoft/tmp/test_simple.jrxml";
|
||||
File f = new File(path);
|
||||
System.out.println("File: " + path + " (exists=" + f.exists() + ", len=" + f.length() + ")");
|
||||
|
||||
// Test 1: JRXmlLoader.load()
|
||||
System.out.println("\n=== JRXmlLoader.load() ===");
|
||||
try {
|
||||
JasperDesign design = JRXmlLoader.load(f);
|
||||
System.out.println("PASS: " + design.getName()
|
||||
+ " pages=" + design.getPageWidth() + "x" + design.getPageHeight());
|
||||
System.out.println(" Title: " + (design.getTitle() != null ? design.getTitle().getHeight() + "px" : "null"));
|
||||
System.out.println(" Detail: " + (design.getDetailSection() != null ? "present" : "null"));
|
||||
} catch (Throwable t) {
|
||||
System.out.println("FAIL: " + t.getMessage());
|
||||
Throwable c = t;
|
||||
int d = 0;
|
||||
while (c != null) {
|
||||
System.out.println(" [" + d + "] " + c.getClass().getName() + ": " + c.getMessage());
|
||||
for (int i = 0; i < Math.min(5, c.getStackTrace().length); i++)
|
||||
System.out.println(" at " + c.getStackTrace()[i]);
|
||||
c = c.getCause();
|
||||
d++;
|
||||
}
|
||||
}
|
||||
|
||||
// Test 2: JasperCompileManager.compileReport()
|
||||
System.out.println("\n=== JasperCompileManager.compileReport() ===");
|
||||
try {
|
||||
JasperReport report = JasperCompileManager.compileReport(path);
|
||||
System.out.println("PASS: " + report.getName());
|
||||
} catch (Throwable t) {
|
||||
System.out.println("FAIL: " + t.getMessage());
|
||||
Throwable c = t;
|
||||
while (c != null) {
|
||||
System.out.println(" -> " + c.getClass().getName() + ": " + c.getMessage());
|
||||
c = c.getCause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user