Package com.cloudinary

Examples of com.cloudinary.Transformation


  }

  @Test
  public void testTransformationSimple() {
    // should support named transformation
    Transformation transformation = new Transformation().named("blip");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/t_blip/test", result);
  }
View Full Code Here


  }

  @Test
  public void testTransformationArray() {
    // should support array of named transformations
    Transformation transformation = new Transformation().named("blip", "blop");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/t_blip.blop/test", result);
  }
View Full Code Here

  }

  @Test
  public void testBaseTransformations() {
    // should support base transformation
    Transformation transformation = new Transformation().x(100).y(100).crop("fill").chain().crop("crop").width(100);
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("100", transformation.getHtmlWidth().toString());
    assertEquals("http://res.cloudinary.com/test123/image/upload/c_fill,x_100,y_100/c_crop,w_100/test", result);
  }
View Full Code Here

  }

  @Test
  public void testBaseTransformationArray() {
    // should support array of base transformations
    Transformation transformation = new Transformation().x(100).y(100).width(200).crop("fill").chain().radius(10).chain().crop("crop")
        .width(100);
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("100", transformation.getHtmlWidth().toString());
    assertEquals("http://res.cloudinary.com/test123/image/upload/c_fill,w_200,x_100,y_100/r_10/c_crop,w_100/test", result);
  }
View Full Code Here

  }

  @Test
  public void testNoEmptyTransformation() {
    // should not include empty transformations
    Transformation transformation = new Transformation().chain().x(100).y(100).crop("fill").chain();
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/c_fill,x_100,y_100/test", result);
  }
View Full Code Here

  }

  @Test
  public void testBackground() {
    // should support background
    Transformation transformation = new Transformation().background("red");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/b_red/test", result);
    transformation = new Transformation().background("#112233");
    result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/b_rgb:112233/test", result);
  }
View Full Code Here

  }

  @Test
  public void testDefaultImage() {
    // should support default_image
    Transformation transformation = new Transformation().defaultImage("default");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/d_default/test", result);
  }
View Full Code Here

  }

  @Test
  public void testAngle() {
    // should support angle
    Transformation transformation = new Transformation().angle(12);
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/a_12/test", result);
    transformation = new Transformation().angle("exif", "12");
    result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/a_exif.12/test", result);
  }
View Full Code Here

  }

  @Test
  public void testOverlay() {
    // should support overlay
    Transformation transformation = new Transformation().overlay("text:hello");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/l_text:hello/test", result);
    // should not pass width/height to html if overlay
    transformation = new Transformation().overlay("text:hello").width(100).height(100);
    result = cloudinary.url().transformation(transformation).generate("test");
    assertNull(transformation.getHtmlHeight());
    assertNull(transformation.getHtmlWidth());
    assertEquals("http://res.cloudinary.com/test123/image/upload/h_100,l_text:hello,w_100/test", result);
  }
View Full Code Here

    assertEquals("http://res.cloudinary.com/test123/image/upload/h_100,l_text:hello,w_100/test", result);
  }

  @Test
  public void testUnderlay() {
    Transformation transformation = new Transformation().underlay("text:hello");
    String result = cloudinary.url().transformation(transformation).generate("test");
    assertEquals("http://res.cloudinary.com/test123/image/upload/u_text:hello/test", result);
    // should not pass width/height to html if underlay
    transformation = new Transformation().underlay("text:hello").width(100).height(100);
    result = cloudinary.url().transformation(transformation).generate("test");
    assertNull(transformation.getHtmlHeight());
    assertNull(transformation.getHtmlWidth());
    assertEquals("http://res.cloudinary.com/test123/image/upload/h_100,u_text:hello,w_100/test", result);
  }
View Full Code Here

TOP

Related Classes of com.cloudinary.Transformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.