Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.core.content.pm.PackageInfoCompat
import androidx.test.platform.app.InstrumentationRegistry
import at.bitfire.ical4android.impl.TestJtxCollection
import at.bitfire.ical4android.impl.testProdId

import at.bitfire.synctools.icalendar.ICalendarParser
import at.bitfire.synctools.test.GrantPermissionOrSkipRule
import at.techbee.jtx.JtxContract
import at.techbee.jtx.JtxContract.JtxICalObject
Expand All @@ -35,6 +35,7 @@ import org.junit.Rule
import org.junit.Test
import java.io.ByteArrayOutputStream
import java.io.InputStreamReader
import kotlin.jvm.optionals.getOrNull

class JtxICalObjectTest {

Expand Down Expand Up @@ -837,17 +838,16 @@ class JtxICalObjectTest {
//assertEquals(iCalIn.components[0].getProperty(Component.VTODO), iCalOut.components[0].getProperty(Component.VTODO))

// there should only be one component for VJOURNAL and VTODO!
TODO("ical4j 4.x")
/*for(i in 0 until iCalIn.components.size) {
for(i in 0 until iCalIn.componentList.all.size) {

iCalIn.components[i].properties.forEach { inProp ->
iCalIn.componentList.all[i].propertyList.all.forEach { inProp ->

if(inProp.name == "DTSTAMP" || exceptions?.contains(inProp.name) == true)
return@forEach
val outProp = iCalOut.components[i].properties.getProperty<Property>(inProp.name)
val outProp = iCalOut.componentList.all[i].propertyList.getFirst<Property>(inProp.name)?.getOrNull()
assertEquals(inProp, outProp)
}
}*/
}
}


Expand All @@ -861,7 +861,7 @@ class JtxICalObjectTest {
val stream = javaClass.classLoader!!.getResourceAsStream(filename)
val reader = InputStreamReader(stream, Charsets.UTF_8)

val iCalIn = ICalendar.fromReader(reader)
val iCalIn = ICalendarParser().parse(reader)

stream.close()
reader.close()
Expand All @@ -885,7 +885,7 @@ class JtxICalObjectTest {

iCalObject[0].write(os, testProdId)

val iCalOut = ICalendar.fromReader(os.toByteArray().inputStream().reader())
val iCalOut = ICalendarParser().parse(os.toByteArray().inputStream().reader())

stream.close()
reader.close()
Expand Down
5 changes: 2 additions & 3 deletions lib/src/main/kotlin/at/bitfire/ical4android/JtxCollection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import at.bitfire.synctools.storage.toContentValues
import at.techbee.jtx.JtxContract
import at.techbee.jtx.JtxContract.asSyncAdapter
import net.fortuna.ical4j.model.Calendar
import net.fortuna.ical4j.model.component.CalendarComponent
import net.fortuna.ical4j.model.component.VJournal
import net.fortuna.ical4j.model.component.VToDo
import net.fortuna.ical4j.model.property.ProdId
Expand Down Expand Up @@ -268,9 +267,9 @@ open class JtxCollection<out T: JtxICalObject>(val account: Account,
val jtxIcalObject = JtxICalObject(this)
jtxIcalObject.populateFromContentValues(cursor.toContentValues())
val singleICS = jtxIcalObject.getICalendarFormat(prodId)
singleICS?.getComponents<CalendarComponent>()?.forEach { component ->
singleICS?.componentList?.all?.forEach { component ->
if(component is VToDo || component is VJournal)
ical.getComponents<CalendarComponent>() += component
ical += component
}
}
return ical.toString()
Expand Down
Loading