Skip to content

Commit 43b5821

Browse files
nitzanjtocker
authored andcommitted
Add support for format in Responsive breakpoints transformation. (#78)
1 parent a5d9595 commit 43b5821

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cloudinary-core/src/main/java/com/cloudinary/ResponsiveBreakpoint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.cloudinary.json.JSONObject;
44

5+
import java.util.Collections;
6+
57
public class ResponsiveBreakpoint extends JSONObject {
68
public ResponsiveBreakpoint() {
79
put("create_derived", true);
@@ -21,7 +23,7 @@ public Transformation transformation() {
2123
}
2224

2325
public ResponsiveBreakpoint transformation(Transformation transformation) {
24-
put("transformation", transformation);
26+
put("transformation", Util.buildEager(Collections.singletonList(transformation)));
2527
return this;
2628
}
2729

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractUploaderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public void testFilenameOption() throws Exception {
462462

463463
@Test
464464
public void testResponsiveBreakpoints() throws Exception {
465-
ResponsiveBreakpoint breakpoint = new ResponsiveBreakpoint().maxImages(2).createDerived(false);
465+
ResponsiveBreakpoint breakpoint = new ResponsiveBreakpoint().maxImages(2).createDerived(false).transformation(new EagerTransformation().format("gif").effect("sepia"));
466466

467467
// A single breakpoint
468468
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("responsive_breakpoints",
@@ -471,6 +471,7 @@ public void testResponsiveBreakpoints() throws Exception {
471471
java.util.ArrayList breakpointsResponse = (java.util.ArrayList) result.get("responsive_breakpoints");
472472
java.util.ArrayList breakpoints = (java.util.ArrayList) ((Map) breakpointsResponse.get(0)).get("breakpoints");
473473
assertEquals(2, breakpoints.size());
474+
assertTrue(((Map)breakpoints.get(0)).get("url").toString().endsWith("gif"));
474475

475476
// an array of breakpoints
476477
result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("responsive_breakpoints",

0 commit comments

Comments
 (0)