diff options
author | Vitaly Takmazov | 2018-07-23 15:47:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-07-23 15:48:12 +0300 |
commit | 10ee29dcb05f992fe2b7aa726b6ac7c9e9aba87d (patch) | |
tree | ccb9e152d63b5891019ff7fffe4bf150ae52b5b6 /juick-server/src/test | |
parent | f6e91616f77fe2426fcdc92e4cdfd3a847f8ac30 (diff) |
Add TwelveMonkeys jpeg library to handle JPG CMYK and other exotic jpegs
Diffstat (limited to 'juick-server/src/test')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 14 | ||||
-rw-r--r-- | juick-server/src/test/resources/cmyk.jpg | bin | 0 -> 3945732 bytes |
2 files changed, 14 insertions, 0 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 3ac4ff82..2d45aae0 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -1084,4 +1084,18 @@ public class ServerTests { commandsManager.processCommand(ugnich, "BL @freefd", emptyUri); messagesService.setLastReadComment(ugnich, mid, 5); } + @Test + public void cmykJpegShouldBeProcessedCorrectly() throws Exception { + CommandResult postJpgCmyk = commandsManager.processCommand(ugnich, "YO", URI.create("classpath:cmyk.jpg")); + assertThat(postJpgCmyk.getNewMessage().isPresent(), is(true)); + int mid = postJpgCmyk.getNewMessage().get().getMid(); + File originalFile = Paths.get(imgDir, "p", String.format("%d.jpg", mid)).toFile(); + assertThat(originalFile.exists(), is(true)); + File mediumFile = Paths.get(imgDir, "photos-1024", String.format("%d.jpg", mid)).toFile(); + assertThat(mediumFile.exists(), is(true)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getWidth(), is(2585)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getHeight(), is(3335)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getMedium().getHeight(), is(1024)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512)); + } } diff --git a/juick-server/src/test/resources/cmyk.jpg b/juick-server/src/test/resources/cmyk.jpg Binary files differnew file mode 100644 index 00000000..40af259c --- /dev/null +++ b/juick-server/src/test/resources/cmyk.jpg |