Loading lib/src/main/java/at/bitfire/vcard4android/ContactReader.kt +6 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import java.time.LocalDateTime import java.time.OffsetDateTime import java.time.temporal.ChronoField import java.time.temporal.Temporal import java.util.* import java.util.UUID import java.util.logging.Level /** Loading Loading @@ -125,13 +125,12 @@ class ContactReader internal constructor(val vCard: VCard, val downloader: Conta is Uid -> c.uid = uriToUid(prop.value) is Kind, is XAddressBookServerKind -> { val kindProp = prop as Kind c.group = kindProp.isGroup is Kind -> { // includes XAddressBookServerKind // c.group = prop.isGroup // https://github.com/mangstadt/ez-vcard/issues/140 c.group = prop.value.equals(Kind.GROUP, true) } is Member, is XAddressBookServerMember -> { val uriProp = prop as Member uriToUid(uriProp.uri)?.let { c.members += it } is Member -> { // includes XAddressBookServerMember uriToUid(prop.uri)?.let { c.members += it } } is FormattedName -> Loading lib/src/test/java/at/bitfire/vcard4android/ContactReaderTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,14 @@ class ContactReaderTest { assertTrue(c.group) } @Test fun testKind_Group_Uppercase() { val c = ContactReader.fromVCard(VCard().apply { kind = Kind("GROUP") }) assertTrue(c.group) } @Test fun testKind_Individual() { val c = ContactReader.fromVCard(VCard().apply { Loading lib/src/test/java/at/bitfire/vcard4android/ContactTest.kt +1 −7 Original line number Diff line number Diff line Loading @@ -35,12 +35,6 @@ class ContactTest { return Contact.fromReader(InputStreamReader(ByteArrayInputStream(os.toByteArray()), Charsets.UTF_8), false,null).first() } private fun toString(c: Contact, groupMethod: GroupMethod, vCardVersion: VCardVersion): String { val os = ByteArrayOutputStream() c.writeVCard(vCardVersion, os) return os.toString() } @Test fun testVCard3FieldsAsVCard3() { Loading lib/src/test/java/at/bitfire/vcard4android/EzVCardTest.kt +11 −4 Original line number Diff line number Diff line Loading @@ -8,14 +8,21 @@ import ezvcard.Ezvcard import ezvcard.VCard import ezvcard.VCardVersion import ezvcard.property.Address import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Before import org.junit.Assert.* import org.junit.Test import java.util.* class EzVCardTest { // https://github.com/mangstadt/ez-vcard/issues/140 @Test(expected = AssertionError::class) fun testKind_GROUP_uppercase() { val vCard = Ezvcard.parse("BEGIN:VCARD\r\n" + "VERSION:4.0\r\n" + "KIND:GROUP\r\n" + "END:VCARD").first() assertTrue(vCard.kind.isGroup) } @Test fun testREV_UTC() { val vCard = Ezvcard.parse("BEGIN:VCARD\r\n" + Loading Loading
lib/src/main/java/at/bitfire/vcard4android/ContactReader.kt +6 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import java.time.LocalDateTime import java.time.OffsetDateTime import java.time.temporal.ChronoField import java.time.temporal.Temporal import java.util.* import java.util.UUID import java.util.logging.Level /** Loading Loading @@ -125,13 +125,12 @@ class ContactReader internal constructor(val vCard: VCard, val downloader: Conta is Uid -> c.uid = uriToUid(prop.value) is Kind, is XAddressBookServerKind -> { val kindProp = prop as Kind c.group = kindProp.isGroup is Kind -> { // includes XAddressBookServerKind // c.group = prop.isGroup // https://github.com/mangstadt/ez-vcard/issues/140 c.group = prop.value.equals(Kind.GROUP, true) } is Member, is XAddressBookServerMember -> { val uriProp = prop as Member uriToUid(uriProp.uri)?.let { c.members += it } is Member -> { // includes XAddressBookServerMember uriToUid(prop.uri)?.let { c.members += it } } is FormattedName -> Loading
lib/src/test/java/at/bitfire/vcard4android/ContactReaderTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,14 @@ class ContactReaderTest { assertTrue(c.group) } @Test fun testKind_Group_Uppercase() { val c = ContactReader.fromVCard(VCard().apply { kind = Kind("GROUP") }) assertTrue(c.group) } @Test fun testKind_Individual() { val c = ContactReader.fromVCard(VCard().apply { Loading
lib/src/test/java/at/bitfire/vcard4android/ContactTest.kt +1 −7 Original line number Diff line number Diff line Loading @@ -35,12 +35,6 @@ class ContactTest { return Contact.fromReader(InputStreamReader(ByteArrayInputStream(os.toByteArray()), Charsets.UTF_8), false,null).first() } private fun toString(c: Contact, groupMethod: GroupMethod, vCardVersion: VCardVersion): String { val os = ByteArrayOutputStream() c.writeVCard(vCardVersion, os) return os.toString() } @Test fun testVCard3FieldsAsVCard3() { Loading
lib/src/test/java/at/bitfire/vcard4android/EzVCardTest.kt +11 −4 Original line number Diff line number Diff line Loading @@ -8,14 +8,21 @@ import ezvcard.Ezvcard import ezvcard.VCard import ezvcard.VCardVersion import ezvcard.property.Address import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Before import org.junit.Assert.* import org.junit.Test import java.util.* class EzVCardTest { // https://github.com/mangstadt/ez-vcard/issues/140 @Test(expected = AssertionError::class) fun testKind_GROUP_uppercase() { val vCard = Ezvcard.parse("BEGIN:VCARD\r\n" + "VERSION:4.0\r\n" + "KIND:GROUP\r\n" + "END:VCARD").first() assertTrue(vCard.kind.isGroup) } @Test fun testREV_UTC() { val vCard = Ezvcard.parse("BEGIN:VCARD\r\n" + Loading