aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick/server')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java21
1 files changed, 18 insertions, 3 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 b468daff..b4d91b79 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
@@ -79,9 +79,7 @@ import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.nio.file.*;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.*;
@@ -1089,6 +1087,23 @@ public class ServerTests {
assertThat(postJpgCmyk.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512));
}
@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);
+ assertThat(tmpFile.toFile().exists(), is(true));
+ CommandResult postJpgiPhone = commandsManager.processCommand(ugnich, "YO", URI.create("juick://2915104.jpg"));
+ assertThat(postJpgiPhone.getNewMessage().isPresent(), is(true));
+ int mid = postJpgiPhone.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(postJpgiPhone.getNewMessage().get().getAttachment().getWidth(), is(1280));
+ assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getHeight(), is(1280));
+ assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getMedium().getHeight(), is(1024));
+ assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512));
+ }
+ @Test
public void changeExtensionWhenReceiveFileWithWrongContentType() throws Exception {
Path pngOutput = Paths.get(tmpDir, "cmyk.png");
Files.deleteIfExists(pngOutput);