diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-03-04 14:24:19 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2021-03-04 14:24:19 +0300 |
commit | 920fa9c38f66c8a319ed09cb008609974cdb7bf5 (patch) | |
tree | b7e12318c268b6b08c2688acc25c9a4087e36e08 /app/src/test/java/it/niedermann/nextcloud/deck | |
parent | bb4054277c8b54a461da0ad7d7ff817363dbf8c2 (diff) |
Fix #804 ⚠️ Show only warning when moving a card if the card has attachments or comments
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/test/java/it/niedermann/nextcloud/deck')
-rw-r--r-- | app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java index a033ef7e4..10fa52cf5 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java @@ -19,6 +19,7 @@ import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.Collections; +import it.niedermann.nextcloud.deck.model.Attachment; import it.niedermann.nextcloud.deck.model.Card; import it.niedermann.nextcloud.deck.model.Label; import it.niedermann.nextcloud.deck.model.full.FullCard; @@ -75,6 +76,25 @@ public class CardUtilTest { } @Test + public void testCardHasCommentsOrAttachments() { + final FullCard fullCard = new FullCard(); + + assertFalse(CardUtil.cardHasCommentsOrAttachments(fullCard)); + + fullCard.setCommentIDs(Collections.singletonList(1L)); + assertTrue(CardUtil.cardHasCommentsOrAttachments(fullCard)); + + fullCard.setCommentIDs(null); + assertFalse(CardUtil.cardHasCommentsOrAttachments(fullCard)); + + fullCard.setAttachments(Collections.singletonList(new Attachment())); + assertTrue(CardUtil.cardHasCommentsOrAttachments(fullCard)); + + fullCard.setCommentIDs(Collections.singletonList(1L)); + assertTrue(CardUtil.cardHasCommentsOrAttachments(fullCard)); + } + + @Test public void generateTitleFromDescription() { final String content = "" + "# Heading\n" + |