diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-06-24 14:03:18 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-06-24 14:03:18 +0300 |
commit | f828c7187bc14df52d9a9c9108151232208d735b (patch) | |
tree | cd3b2d37f3bbd078631633c5d0f69d81e43fb933 /app/src/test/java/it/niedermann/nextcloud/deck | |
parent | 719ac9ebee257f9254e35c2501b1eff28f6a2992 (diff) |
version bump to 1.5.61.5.6
- 🐞 Fix sharing text based files like contacts
Diffstat (limited to 'app/src/test/java/it/niedermann/nextcloud/deck')
-rw-r--r-- | app/src/test/java/it/niedermann/nextcloud/deck/MimeTypeUtilTest.java | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/MimeTypeUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/MimeTypeUtilTest.java index 757a6ec35..5b5528bdd 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/MimeTypeUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/MimeTypeUtilTest.java @@ -18,7 +18,7 @@ public class MimeTypeUtilTest { "image/jpeg", "image/png", "image/tiff", "image/svg", }; final String[] invalidMimeTypes = new String[]{ - "audio/jpg", "img/jpg", "application/octet-stream", "image/djvu" + "audio/jpg", "img/jpg", "application/octet-stream", "image/djvu", "", null }; for (String validMimeType : validMimeTypes) { @@ -36,7 +36,7 @@ public class MimeTypeUtilTest { "video/mkv", "video/mp4", "video/mp2", "ViDeO/avi", "VIDEO/mp4", "Video/mp2" }; final String[] invalidMimeTypes = new String[]{ - "audio/jpg", "img/jpg", "application/octet-stream" + "audio/jpg", "img/jpg", "application/octet-stream", "", null }; for (String validMimeType : validMimeTypes) { @@ -54,7 +54,7 @@ public class MimeTypeUtilTest { "audio/mp3", "audio/ogg", "audio/vorbis", "audio/flac", "Audio/mp3", "AUDIO/MP3" }; final String[] invalidMimeTypes = new String[]{ - "text/plain", "img/jpg", "application/octet-stream" + "text/plain", "img/jpg", "application/octet-stream", "", null }; for (String validMimeType : validMimeTypes) { @@ -72,7 +72,7 @@ public class MimeTypeUtilTest { "text/plain", "text/rtf", "text/PLAIN", "Text/Plain", "TEXT/rtf", "TEXT/RTF" }; final String[] invalidMimeTypes = new String[]{ - "audio/jpg", "img/jpg", "application/octet-stream" + "audio/jpg", "img/jpg", "application/octet-stream", "", null }; for (String validMimeType : validMimeTypes) { @@ -85,12 +85,48 @@ public class MimeTypeUtilTest { } @Test + public void isTextPlain() { + final String[] validMimeTypes = new String[]{ + "text/plain", "TEXT/PLAIN", "Text/Plain" + }; + final String[] invalidMimeTypes = new String[]{ + "text/rtf", "text/jpg", "", null + }; + + for (String validMimeType : validMimeTypes) { + assertTrue("Expecting " + validMimeType + " to be a valid text mimetype", MimeTypeUtil.isTextPlain(validMimeType)); + } + + for (String invalidMimeType : invalidMimeTypes) { + assertFalse("Expecting " + invalidMimeType + " to be an invalid text mimetype", MimeTypeUtil.isTextPlain(invalidMimeType)); + } + } + + @Test + public void isContact() { + final String[] validMimeTypes = new String[]{ + "text/vcard", "TEXT/VCARD", "Text/vCard", "text/VCard" + }; + final String[] invalidMimeTypes = new String[]{ + "text/plain", "text/rtf", "text/jpg", "", null + }; + + for (String validMimeType : validMimeTypes) { + assertTrue("Expecting " + validMimeType + " to be a valid text mimetype", MimeTypeUtil.isContact(validMimeType)); + } + + for (String invalidMimeType : invalidMimeTypes) { + assertFalse("Expecting " + invalidMimeType + " to be an invalid text mimetype", MimeTypeUtil.isContact(invalidMimeType)); + } + } + + @Test public void isPdf() { final String[] validMimeTypes = new String[]{ "application/pdf", "APPLICATION/PDF", "Application/Pdf" }; final String[] invalidMimeTypes = new String[]{ - "audio/jpg", "img/jpg", "application/octet-stream", "app/pdf" + "audio/jpg", "img/jpg", "application/octet-stream", "app/pdf", "", null }; for (String validMimeType : validMimeTypes) { |