Changeset 2387


Ignore:
Timestamp:
03/06/07 08:42:45 (13 years ago)
Author:
melissa
Message:

Added new test to check that the used file list is sane.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/test/ReaderTest.java

    r2381 r2387  
    255255        int sizeX = reader.getThumbSizeX(id); 
    256256        int sizeY = reader.getThumbSizeY(id); 
    257         int bytesPerPixel = 
    258           FormatReader.getBytesPerPixel(reader.getPixelType(id)); 
    259         int sizeC = reader.getSizeC(id); 
    260         boolean rgb = reader.isRGB(id); 
    261  
    262         int expectedBytes = sizeX * sizeY * bytesPerPixel * (rgb ? sizeC : 1); 
     257        int sizeC = reader.getRGBChannelCount(id); 
     258 
     259        int expectedBytes = sizeX * sizeY * sizeC; 
    263260 
    264261        for (int j=0; j<imageCount; j++) { 
     
    566563  } 
    567564 
     565  /**  
     566   * Check that the used file list produced by each file in a set is the same.  
     567   */ 
     568  public void testSaneUsedFiles() { 
     569    try { 
     570      String[] base = reader.getUsedFiles(id); 
     571      Arrays.sort(base); 
     572 
     573      FileStitcher fs = new FileStitcher(); 
     574 
     575      for (int i=0; i<base.length; i++) { 
     576        String[] comp = fs.getUsedFiles(base[i]); 
     577        Arrays.sort(comp); 
     578        for (int j=0; j<comp.length; j++) { 
     579          if (!comp[j].equals(base[j])) { 
     580            writeLog(id + " failed sane used files test (" + base[i] + ")");  
     581            assertTrue(false); 
     582          }  
     583        } 
     584      } 
     585 
     586      fs.close(); 
     587      assertTrue(true); 
     588    } 
     589    catch (Exception e) { 
     590      if (FormatReader.debug) e.printStackTrace(); 
     591      writeLog(id + " failed sane used files test");  
     592    } 
     593    assertTrue(false);  
     594  } 
     595 
    568596  // -- TestCase API methods -- 
    569597 
     
    605633      suite.addTest(new ReaderTest("testImageCount", id)); 
    606634      suite.addTest(new ReaderTest("testOMEXML", id)); 
     635      suite.addTest(new ReaderTest("testSaneUsedFiles", id));  
    607636    } 
    608637    if (config.initialized(id) || writeConfigFiles) { 
Note: See TracChangeset for help on using the changeset viewer.