-
Notifications
You must be signed in to change notification settings - Fork 3
LocalCalendar/LocalEvent: provide all fields for DAVx5 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
71e36ff
Update color insertion logic to use Css3Color.entries
rfc2822 305e240
Add access level to AndroidCalendar
rfc2822 39e7b24
Add methods to get and set calendar sync state
rfc2822 fc65f19
[WIP] AndroidEvent: add more sync columns
rfc2822 254b6d2
Tests
rfc2822 8a0a193
Let new AndroidEvents have public setters for now
rfc2822 6530bba
Update AndroidEvent constructor to accept new fields
rfc2822 48a729c
Minor changes
rfc2822 44cad55
Update sync state methods to use read and write semantics
rfc2822 1f61343
Move companion objects to end of class declarations
rfc2822 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,14 +63,6 @@ import java.net.URI | |
| import java.time.Duration | ||
| import java.time.Period | ||
| import java.util.logging.Logger | ||
| import kotlin.collections.Map | ||
| import kotlin.collections.component1 | ||
| import kotlin.collections.component2 | ||
| import kotlin.collections.emptyMap | ||
| import kotlin.collections.first | ||
| import kotlin.collections.firstOrNull | ||
| import kotlin.collections.iterator | ||
| import kotlin.collections.mapOf | ||
| import kotlin.collections.plusAssign | ||
|
|
||
| class AndroidEventTest { | ||
|
|
@@ -126,6 +118,25 @@ class AndroidEventTest { | |
| } | ||
|
|
||
|
|
||
| @Test | ||
| fun testConstructor_ContentValues() { | ||
| val e = AndroidEvent( | ||
| calendar, contentValuesOf( | ||
| Events._ID to 123, | ||
| Events._SYNC_ID to "some-ical.ics", | ||
| AndroidEvent.COLUMN_ETAG to "some-etag", | ||
| AndroidEvent.COLUMN_SCHEDULE_TAG to "some-schedule-tag", | ||
| AndroidEvent.COLUMN_FLAGS to 45 | ||
| ) | ||
| ) | ||
| assertEquals(123L, e.id) | ||
| assertEquals("some-ical.ics", e.syncId) | ||
| assertEquals("some-etag", e.eTag) | ||
| assertEquals("some-schedule-tag", e.scheduleTag) | ||
| assertEquals(45, e.flags) | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * buildEvent() BASIC TEST MATRIX: | ||
| * | ||
|
|
@@ -1522,6 +1533,87 @@ class AndroidEventTest { | |
| ).event!! | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_iCalUid() { | ||
| populateEvent( | ||
| true, | ||
| extendedProperties = mapOf( | ||
| AndroidEvent.EXTNAME_ICAL_UID to "[email protected]" | ||
| ) | ||
| ).let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_UID_2445() { | ||
| populateEvent(true) { | ||
| put(Events.UID_2445, "[email protected]") | ||
| }.let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_UID_2445_and_iCalUid() { | ||
| populateEvent( | ||
| true, | ||
| extendedProperties = mapOf( | ||
| AndroidEvent.EXTNAME_ICAL_UID to "[email protected]" | ||
| ) | ||
| ) { | ||
| put(Events.UID_2445, "[email protected]") | ||
| }.let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @Test | ||
| fun testPopulateEvent_Sequence_Int() { | ||
| populateEvent(true, asSyncAdapter = true) { | ||
| put(AndroidEvent.COLUMN_SEQUENCE, 5) | ||
| }.let { result -> | ||
| assertEquals(5, result.sequence) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Sequence_Null() { | ||
| populateEvent(true, asSyncAdapter = true) { | ||
| putNull(AndroidEvent.COLUMN_SEQUENCE) | ||
| }.let { result -> | ||
| assertNull(result.sequence) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_IsOrganizer_False() { | ||
| populateEvent(true, asSyncAdapter = true) { | ||
| put(Events.IS_ORGANIZER, "0") | ||
| }.let { result -> | ||
| assertFalse(result.isOrganizer!!) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_IsOrganizer_Null() { | ||
| populateEvent(true, asSyncAdapter = true) { | ||
| putNull(Events.IS_ORGANIZER) | ||
| }.let { result -> | ||
| assertNull(result.isOrganizer) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_IsOrganizer_True() { | ||
| populateEvent(true, asSyncAdapter = true) { | ||
| put(Events.IS_ORGANIZER, "1") | ||
| }.let { result -> | ||
| assertTrue(result.isOrganizer!!) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_NonAllDay_NonRecurring() { | ||
| populateEvent(false) { | ||
|
|
@@ -1886,39 +1978,6 @@ class AndroidEventTest { | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_iCalUid() { | ||
| populateEvent( | ||
| true, | ||
| extendedProperties = mapOf( | ||
| AndroidEvent.EXTNAME_ICAL_UID to "[email protected]" | ||
| ) | ||
| ).let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_UID_2445() { | ||
| populateEvent(true) { | ||
| put(Events.UID_2445, "[email protected]") | ||
| }.let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testPopulateEvent_Uid_UID_2445_and_iCalUid() { | ||
| populateEvent(true, | ||
| extendedProperties = mapOf( | ||
| AndroidEvent.EXTNAME_ICAL_UID to "[email protected]" | ||
| )) { | ||
| put(Events.UID_2445, "[email protected]") | ||
| }.let { result -> | ||
| assertEquals("[email protected]", result.uid) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| private fun populateReminder(destinationCalendar: TestCalendar = calendar, builder: ContentValues.() -> Unit): VAlarm? { | ||
| populateEvent(true, destinationCalendar = destinationCalendar, insertCallback = { id -> | ||
|
|
@@ -2340,7 +2399,6 @@ class AndroidEventTest { | |
| } | ||
|
|
||
|
|
||
|
|
||
| @Test | ||
| fun testUpdateEvent() { | ||
| // add test event without reminder | ||
|
|
@@ -2480,4 +2538,4 @@ class AndroidEventTest { | |
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.