@@ -6,7 +6,9 @@ package at.bitfire.ical4android
66
77import android.accounts.Account
88import android.content.ContentProviderClient
9+ import android.content.ContentResolver
910import android.content.ContentValues
11+ import android.content.Context
1012import android.database.DatabaseUtils
1113import android.os.ParcelFileDescriptor
1214import androidx.test.platform.app.InstrumentationRegistry
@@ -38,14 +40,14 @@ class JtxICalObjectTest {
3840
3941 companion object {
4042
41- val context = InstrumentationRegistry .getInstrumentation().targetContext
42- val contentResolver = context.contentResolver
43+ private val context: Context = InstrumentationRegistry .getInstrumentation().targetContext
44+ private val contentResolver: ContentResolver = context.contentResolver
4345
4446 private lateinit var client: ContentProviderClient
4547
4648 @JvmField
4749 @ClassRule
48- val permissionRule = GrantPermissionRule .grant(* TaskProvider .PERMISSIONS_JTX )
50+ val permissionRule: GrantPermissionRule = GrantPermissionRule .grant(* TaskProvider .PERMISSIONS_JTX )
4951
5052 @BeforeClass
5153 @JvmStatic
@@ -65,8 +67,8 @@ class JtxICalObjectTest {
6567 }
6668
6769 private val testAccount = Account (" TEST" , JtxContract .JtxCollection .TEST_ACCOUNT_TYPE )
68- var collection: JtxCollection < at.bitfire.ical4android.JtxICalObject > ? = null
69- var sample: at.bitfire.ical4android.JtxICalObject ? = null
70+ private var collection: JtxCollection < at.bitfire.ical4android.JtxICalObject > ? = null
71+ private var sample: at.bitfire.ical4android.JtxICalObject ? = null
7072
7173 private val url = " https://jtx.techbee.at"
7274 private val displayname = " jtxTest"
@@ -95,13 +97,15 @@ class JtxICalObjectTest {
9597 this .dtend = System .currentTimeMillis()
9698 this .dtendTimezone = " Europe/Paris"
9799 this .status = JtxICalObject .StatusJournal .FINAL .name
100+ this .xstatus = " my status"
98101 this .classification = JtxICalObject .Classification .PUBLIC .name
99102 this .url = " https://jtx.techbee.at"
100103 this .contact
= " [email protected] " 101104 this .geoLat = 48.2082
102105 this .geoLong = 16.3738
103106 this .location = " Vienna"
104107 this .locationAltrep = " Wien"
108+ this .geofenceRadius = 10
105109 this .percent = 99
106110 this .priority = 1
107111 this .due = System .currentTimeMillis()
@@ -144,13 +148,25 @@ class JtxICalObjectTest {
144148 @Test fun check_DTEND () = insertRetrieveAssertLong(JtxICalObject .DTEND , sample?.dtend, Component .VJOURNAL .name)
145149 @Test fun check_DTEND_TIMEZONE () = insertRetrieveAssertString(JtxICalObject .DTEND_TIMEZONE , sample?.dtendTimezone, Component .VJOURNAL .name)
146150 @Test fun check_STATUS () = insertRetrieveAssertString(JtxICalObject .STATUS , sample?.status, Component .VJOURNAL .name)
151+ @Test fun check_XSTATUS () {
152+ val jtxVersionCode = context.packageManager.getPackageInfo(" at.techbee.jtx" , 0 ).longVersionCode
153+ Assume .assumeTrue(jtxVersionCode > 204020003 )
154+ insertRetrieveAssertString(JtxICalObject .EXTENDED_STATUS , sample?.xstatus, Component .VJOURNAL .name)
155+ }
156+
147157 @Test fun check_CLASSIFICATION () = insertRetrieveAssertString(JtxICalObject .CLASSIFICATION , sample?.classification, Component .VJOURNAL .name)
148158 @Test fun check_URL () = insertRetrieveAssertString(JtxICalObject .URL , sample?.url, Component .VJOURNAL .name)
149159 @Test fun check_CONTACT () = insertRetrieveAssertString(JtxICalObject .CONTACT , sample?.contact, Component .VJOURNAL .name)
150160 @Test fun check_GEO_LAT () = insertRetrieveAssertDouble(JtxICalObject .GEO_LAT , sample?.geoLat, Component .VJOURNAL .name)
151161 @Test fun check_GEO_LONG () = insertRetrieveAssertDouble(JtxICalObject .GEO_LONG , sample?.geoLong, Component .VJOURNAL .name)
152162 @Test fun check_LOCATION () = insertRetrieveAssertString(JtxICalObject .LOCATION , sample?.location, Component .VJOURNAL .name)
153163 @Test fun check_LOCATION_ALTREP () = insertRetrieveAssertString(JtxICalObject .LOCATION_ALTREP , sample?.locationAltrep, Component .VJOURNAL .name)
164+ @Test fun check_GEOFENCE_RADIUS () {
165+ val jtxVersionCode = context.packageManager.getPackageInfo(" at.techbee.jtx" , 0 ).longVersionCode
166+ Assume .assumeTrue(jtxVersionCode > 204020003 )
167+ insertRetrieveAssertInt(JtxICalObject .GEOFENCE_RADIUS , sample?.geofenceRadius, Component .VJOURNAL .name)
168+ }
169+
154170 @Test fun check_PERCENT () = insertRetrieveAssertInt(JtxICalObject .PERCENT , sample?.percent, Component .VJOURNAL .name)
155171 @Test fun check_PRIORITY () = insertRetrieveAssertInt(JtxICalObject .PRIORITY , sample?.priority, Component .VJOURNAL .name)
156172 @Test fun check_DUE () = insertRetrieveAssertLong(JtxICalObject .DUE , sample?.due, Component .VJOURNAL .name)
0 commit comments