diff options
author | Vitaly Takmazov | 2018-09-15 23:36:00 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-09-15 23:36:00 +0300 |
commit | 49fa015cb3e069b9b1c62685dfe4996a42f1812f (patch) | |
tree | 80a7f8b0c6fe05abbfcbd912d9874e6b306f5f6e /juick-server | |
parent | 14c6c6c061fd460cb33105bfe181d4b1e5997b00 (diff) |
Correctly detect attachments content type
Diffstat (limited to 'juick-server')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 14 | ||||
-rw-r--r-- | juick-server/src/test/resources/nojfif.jpg | bin | 0 -> 417629 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 185137b0..8c3e6a01 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 @@ -1147,6 +1147,20 @@ public class ServerTests { assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512)); } @Test + public void JpegWithoutJfifShouldBeProcessedCorrectly() throws Exception { + CommandResult postJpgCmyk = commandsManager.processCommand(ugnich, "YO", URI.create("classpath:nojfif.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(3264)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getHeight(), is(2448)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getMedium().getHeight(), is(768)); + assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getSmall().getHeight(), is(384)); + } + @Test public void JpegFromJuickUriShouldBeProcessedCorrectly() throws Exception { Path tmpFile = Paths.get(tmpDir, "2915104.jpg"); Files.copy(Paths.get(ClassLoader.getSystemResource("2915104.jpg").toURI()), tmpFile, StandardCopyOption.REPLACE_EXISTING); diff --git a/juick-server/src/test/resources/nojfif.jpg b/juick-server/src/test/resources/nojfif.jpg Binary files differnew file mode 100644 index 00000000..16ddec1b --- /dev/null +++ b/juick-server/src/test/resources/nojfif.jpg |