Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/arranger/jarl/test/IOUtilTest.java


1   package com.arranger.jarl.test;
2   
3   import junit.framework.TestCase;
4   
5   import java.awt.*;
6   import java.awt.image.BufferedImage;
7   import java.io.File;
8   
9   import com.arranger.jarl.util.IOUtil;
10  
11  /**
12   * IOUtilTest created on Feb 19, 2003
13   */
14  public class IOUtilTest extends TestCase {
15  
16      protected static final String SUB_DIR = "output";
17  
18      public void testSave() throws Exception {
19          File file = new File(SUB_DIR);
20          file.mkdirs();
21  
22          Image image = new BufferedImage(250, 250, BufferedImage.TYPE_INT_RGB);
23          Graphics2D graphics2D = (Graphics2D)image.getGraphics();
24          graphics2D.setBackground(Color.RED);
25          graphics2D.clearRect(0, 0, image.getHeight(null), image.getWidth(null));
26          IOUtil.save(image, new File(SUB_DIR + "/test.bmp"));
27      }
28  }