コード例 #1
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
  private void testFormat(String format) {
    ImageReader reader = ImageIO.getImageReadersByFormatName(format).next();
    ImageWriter writer = ImageIO.getImageWritersByFormatName(format).next();

    assertEquals(
        "getImageReader() returns an incorrect reader for " + format,
        ImageIO.getImageReader(writer).getClass(),
        reader.getClass());
    assertEquals(
        "getImageWriter() returns an incorrect writer for " + format,
        ImageIO.getImageWriter(reader).getClass(),
        writer.getClass());
  }
コード例 #2
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
  public void testGetNullReaderWriter() throws Exception {
    try {
      ImageIO.getImageWriter(null);
      fail("Expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      // Ok
    }

    try {
      ImageIO.getImageReader(null);
      fail("Expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      // Ok
    }
  }
コード例 #3
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
  public void testGetWriterMIMETypes() {
    Set<String> expectedMIMETypes =
        new HashSet<String>(Arrays.asList(new String[] {"image/x-png", "image/png", "image/jpeg"}));

    Set<String> actualMIMETypes = new HashSet<String>(Arrays.asList(ImageIO.getWriterMIMETypes()));
    assertTrue(actualMIMETypes.containsAll(expectedMIMETypes));
  }
コード例 #4
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
 public void testReadURL() throws Exception {
   // Regression for HARMONY-3135
   for (URL url : listImages()) {
     assertNotNull("Failed to load image from URL " + url, ImageIO.read(url));
     assertFalse(
         "The current thread has been interrupted! URL: " + url, // $NON-NLS-1$
         Thread.currentThread().isInterrupted());
   }
 }
コード例 #5
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
  public void testGetWriterFormatNames() {
    Set<String> expectedFormatNames =
        new HashSet<String>(
            Arrays.asList(new String[] {"JPG", "jpg", "JPEG", "jpeg", "PNG", "png"}));

    Set<String> actualFormatNames =
        new HashSet<String>(Arrays.asList(ImageIO.getWriterFormatNames()));
    assertTrue(actualFormatNames.containsAll(expectedFormatNames));
  }
コード例 #6
0
ファイル: ImageIOTest.java プロジェクト: eGit/appengine-awt
  public void testCache() throws Exception {
    ImageIO.setUseCache(true);
    assertTrue("Failed to enable cache", ImageIO.getUseCache());
    ImageIO.setUseCache(false);
    assertFalse("Failed to disable cache", ImageIO.getUseCache());

    ImageIO.setCacheDirectory(null);
    assertNull("Failed to set cache directory", ImageIO.getCacheDirectory());

    try {
      ImageIO.setCacheDirectory(new File(""));
      fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException expected) {
      // OK
    }
  }