Пример #1
0
 /** Test of getHeight method, of class Image. */
 @Test
 public void testGetHeight() {
   System.out.println("getHeight");
   Image instance = loadTestImage();
   int expResult = 450;
   int result = instance.getHeight();
   assertEquals(expResult, result);
 }
Пример #2
0
 /** Test of getAspectRatio method, of class Image. */
 @Test
 public void testGetAspectRatio() {
   System.out.println("getAspectRatio");
   Image instance = loadTestImage();
   double expResult = 1.3333333333;
   double result = instance.getAspectRatio();
   assertEquals(expResult, result, 0.01);
 }
Пример #3
0
 /** Test of getSourceType method, of class Image. */
 @Test
 public void testGetSourceType() {
   System.out.println("getSourceType");
   Image instance = loadTestImage();
   ImageType expResult = ImageType.JPG;
   ImageType result = instance.getSourceType();
   assertEquals(expResult, result);
 }
Пример #4
0
  /** Test of writeToFile method, of class Image. */
  @Test
  public void testWriteToFile_File() throws Exception {
    System.out.println("writeToFile1");
    File file = new File("./test/test");
    Image instance = loadTestImage();
    File expResult = new File("./test/test.jpg");
    File result = instance.writeToFile(file);
    assertEquals(expResult, result);
    removeFile(result);

    System.out.println("writeToFile2");
    file = new File("./test/test.gif");
    expResult = new File("./test/test.gif");
    result = instance.writeToFile(file);
    assertEquals(expResult, result);
    removeFile(result);

    System.out.println("writeToFile3");
    file = new File("./test/test.xyz");
    expResult = new File("./test/test.xyz.jpg");
    result = instance.writeToFile(file);
    assertEquals(expResult, result);
    removeFile(result);
  }