Ejemplo n.º 1
0
 protected void saveChart(BufferedImage img, String name) throws IOException {
   File target = new File("target/test-tmp/chart/");
   FileUtils.forceMkdir(target);
   ByteArrayOutputStream imgOutput = new ByteArrayOutputStream();
   ChartUtilities.writeBufferedImageAsPNG(imgOutput, img, true, 0);
   OutputStream out = new FileOutputStream(new File(target, name));
   out.write(imgOutput.toByteArray());
   out.close();
 }
Ejemplo n.º 2
0
 protected void assertChartSizeLesserThan(BufferedImage img, int size) throws IOException {
   ByteArrayOutputStream output = new ByteArrayOutputStream();
   ChartUtilities.writeBufferedImageAsPNG(output, img, true, 0);
   assertTrue("PNG size in bits=" + output.size(), output.size() < size);
 }