Exemplo n.º 1
0
  @Test
  public void testGetMimeType() {
    assertEquals("image/png", Utils.getImageMimeType("png"));
    assertEquals("image/gif", Utils.getImageMimeType("gif"));
    assertEquals("image/jpeg", Utils.getImageMimeType("jpeg"));
    assertEquals("image/jpeg", Utils.getImageMimeType("jpg"));

    assertEquals("image/png", Utils.getImageMimeType("PNG"));
    assertEquals("image/gif", Utils.getImageMimeType("GIF"));
    assertEquals("image/jpeg", Utils.getImageMimeType("JPEG"));
    assertEquals("image/jpeg", Utils.getImageMimeType("JPG"));

    assertEquals("application/octet-stream", Utils.getImageMimeType("unknown"));
  }
Exemplo n.º 2
0
 @Test
 public void testSubstractWebLengths() {
   assertEquals("30px", Utils.substractWebLengths("40px", "10px"));
   assertEquals("3em", Utils.substractWebLengths("5em", "2em"));
   assertNull(Utils.substractWebLengths("25%", "2em"));
 }
Exemplo n.º 3
0
 @Test
 public void testDivideWebLengths() {
   assertEquals("20px", Utils.divideWebLength("40px", 2));
   assertEquals("1em", Utils.divideWebLength("5em", 3));
   assertNull(Utils.divideWebLength("25%", 0));
 }
Exemplo n.º 4
0
 @Test
 public void testAddWebLengths() {
   assertEquals("30px", Utils.addWebLengths("10px", "20px"));
   assertEquals("3em", Utils.addWebLengths("1em", "2em"));
   assertNull(Utils.addWebLengths("25%", "2em"));
 }