Changeset 5952 for branches/cleanup


Ignore:
Timestamp:
02/23/10 11:48:57 (10 years ago)
Author:
callan
Message:

Test case for lossless JPEG2000 compression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/components/bio-formats/test/loci/formats/utests/JAIIIOServiceTest.java

    r5939 r5952  
    5353  private static final int SIZE_Y = 96; 
    5454 
     55  private static final int[] CODE_BLOCK = new int[] { 4, 4 }; 
     56 
    5557  private static final int IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB; 
    5658 
     
    6971    ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
    7072    // Code block size minimum is 4x4 
    71     service.writeImage(stream, image, false, new int[] { 4, 4 }, 1.0); 
     73    service.writeImage(stream, image, false, CODE_BLOCK, 1.0); 
    7274    assertTrue(stream.size() > 0); 
    7375    return stream; 
     
    7577 
    7678  @Test 
    77   public void testReadImage() throws IOException, ServiceException { 
     79  public ByteArrayOutputStream testWriteImageLossless() 
     80    throws IOException, ServiceException { 
     81    BufferedImage image = new BufferedImage(SIZE_X, SIZE_Y, IMAGE_TYPE); 
     82    ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
     83    // Code block size minimum is 4x4 
     84    service.writeImage(stream, image, true, CODE_BLOCK, 1.0); 
     85    assertTrue(stream.size() > 0); 
     86    return stream; 
     87  } 
     88 
     89  @Test 
     90  public void testReadImageLossy() throws IOException, ServiceException { 
    7891    ByteArrayOutputStream outputStream = testWriteImageLossy(); 
    7992    ByteArrayInputStream inputStream =  
     
    8598  } 
    8699 
     100  @Test 
     101  public void testReadImageLossless() throws IOException, ServiceException { 
     102    ByteArrayOutputStream outputStream = testWriteImageLossless(); 
     103    ByteArrayInputStream inputStream =  
     104      new ByteArrayInputStream(outputStream.toByteArray()); 
     105    BufferedImage image = service.readImage(inputStream); 
     106    assertNotNull(image); 
     107    assertEquals(SIZE_X, image.getWidth()); 
     108    assertEquals(SIZE_Y, image.getHeight()); 
     109  } 
     110 
    87111} 
Note: See TracChangeset for help on using the changeset viewer.