Release 1.3.1 (#146)
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 18s
Renovate / renovate (push) Successful in 2m30s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Successful in 21m13s
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Successful in 1m28s
Beta — Codeberg pre-release / detect (push) Successful in 5s
Beta — Codeberg pre-release / beta (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 18s
Renovate / renovate (push) Successful in 2m30s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Successful in 21m13s
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Successful in 1m28s
Beta — Codeberg pre-release / detect (push) Successful in 5s
Beta — Codeberg pre-release / beta (push) Skipped
Bumps to 1.3.1 (1030199), dates the changelog and adds the What's New for all eight store locales. - Ticking a repeating task moves the series on (#137, #144) - Recurring tasks keep their rule with tasks.org and OpenTasks (#135, #142) - Keep the list order with tasks.org and OpenTasks (#136, #143) Closes #135, closes #136, closes #137 Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de> Reviewed-on: https://codeberg.org/jlmakiola/agendula/pulls/146
This commit is contained in:
1 parent
caf4357cee
commit
3e34c60577
43 files changed
+3419
-225
No files matched your search
@@ -0,0 +1,56 @@
|
||||
package de.jeanlucmakiola.agendula.data.tasks
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import de.jeanlucmakiola.agendula.domain.TaskList
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ListOrderTest {
|
||||
|
||||
private fun list(id: Long, name: String, account: String = "Radicale") = TaskList(
|
||||
id = id, name = name, color = 0, accountName = account, accountType = "bitfire.at.davdroid",
|
||||
isSynced = true, isVisible = true, owner = null,
|
||||
)
|
||||
|
||||
@Test
|
||||
fun `an order survives encoding`() {
|
||||
val order = mapOf(3L to 0, 1L to 1, 2L to 2)
|
||||
assertThat(ListOrder.decode(ListOrder.encode(order))).isEqualTo(order)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `nothing stored and garbage both decode to no order`() {
|
||||
assertThat(ListOrder.decode(null)).isEmpty()
|
||||
assertThat(ListOrder.decode("x=1,2,=3,4=y")).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `lists follow the stored order within their account (#136)`() {
|
||||
val lists = listOf(list(1, "Groceries"), list(2, "Home"), list(3, "Work"), list(4, "Inbox", account = "Local"))
|
||||
val order = ListOrder.reordered(listOf(4, 1, 2, 3), listOf(3, 1, 2))
|
||||
|
||||
assertThat(ListOrder.sorted(lists, order).map { it.id }).containsExactly(4L, 3L, 1L, 2L).inOrder()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `reordering one account leaves every other list in its slot`() {
|
||||
// 7 and 8 are another account; 5 joined this one after the screen was drawn.
|
||||
val order = ListOrder.reordered(listOf(7, 8, 1, 5, 2), listOf(2, 1))
|
||||
|
||||
assertThat(order).isEqualTo(mapOf(7L to 0, 8L to 1, 2L to 2, 5L to 3, 1L to 4))
|
||||
assertThat(order.values.toSet()).hasSize(order.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `names sort without regard to case`() {
|
||||
val lists = listOf(list(1, "Zeta"), list(2, "apple"))
|
||||
assertThat(ListOrder.sorted(lists, emptyMap()).map { it.id }).containsExactly(2L, 1L).inOrder()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a list without a position counts as the first, as in the own store`() {
|
||||
val lists = listOf(list(1, "Zeta"), list(2, "Alpha"), list(3, "Mid"))
|
||||
val order = mapOf(3L to 0, 1L to 1)
|
||||
|
||||
assertThat(ListOrder.sorted(lists, order).map { it.id }).containsExactly(2L, 3L, 1L).inOrder()
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import de.jeanlucmakiola.agendula.data.tasks.TasksContract.Tasks
|
||||
import de.jeanlucmakiola.agendula.domain.Priority
|
||||
import de.jeanlucmakiola.agendula.domain.TaskStatus
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.time.Instant
|
||||
|
||||
class TaskMapperTest {
|
||||
|
||||
@@ -34,7 +35,7 @@ class TaskMapperTest {
|
||||
),
|
||||
)
|
||||
|
||||
val task = TaskMapper.task(reader)
|
||||
val task = mapTask(reader)
|
||||
|
||||
assertThat(task.taskId).isEqualTo(7L)
|
||||
assertThat(task.listId).isEqualTo(3L)
|
||||
@@ -52,7 +53,7 @@ class TaskMapperTest {
|
||||
@Test
|
||||
fun `an occurrence is identified by its recurrence-id anchor`() {
|
||||
fun occurrence(columns: Map<String, Any?>) =
|
||||
TaskMapper.task(MapColumnReader(columns + (Tasks.RRULE to "FREQ=DAILY")))
|
||||
mapTask(MapColumnReader(columns), SeriesRule(rrule = "FREQ=DAILY", rdate = null))
|
||||
|
||||
// instance_original_time is the provider's own RECURRENCE-ID and wins.
|
||||
val anchored = occurrence(
|
||||
@@ -76,7 +77,7 @@ class TaskMapperTest {
|
||||
|
||||
@Test
|
||||
fun `a non-recurring task has no occurrence anchor and keys by task id`() {
|
||||
val task = TaskMapper.task(
|
||||
val task = mapTask(
|
||||
MapColumnReader(mapOf(Tasks.ID to 4L, Instances.INSTANCE_START to 500L)),
|
||||
)
|
||||
assertThat(task.occurrenceStart).isNull()
|
||||
@@ -84,33 +85,81 @@ class TaskMapperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `recurrence is detected from rrule when is_recurring is absent`() {
|
||||
// tasks.org's bundled provider is DB 22 and has no `is_recurring` column;
|
||||
// reading it alone would report the series as one-off and send its edits
|
||||
// to the master row, re-anchoring the whole thing.
|
||||
val task = TaskMapper.task(
|
||||
MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.RRULE to "FREQ=WEEKLY;BYDAY=MO")),
|
||||
fun `a series is detected from its master rule when the view masks it (#135)`() {
|
||||
// tasks.org (DB 22): rule masked in the view, no `is_recurring`.
|
||||
val task = mapTask(
|
||||
MapColumnReader(
|
||||
mapOf(
|
||||
Tasks.ID to 90L,
|
||||
Instances.TASK_ID to 9L,
|
||||
Instances.INSTANCE_START to 1_000L,
|
||||
Instances.INSTANCE_ORIGINAL_TIME to 1_000L,
|
||||
),
|
||||
),
|
||||
SeriesRule(rrule = "FREQ=DAILY", rdate = null),
|
||||
)
|
||||
assertThat(task.isRecurring).isTrue()
|
||||
assertThat(task.seriesId).isEqualTo(9L)
|
||||
assertThat(task.occurrenceStart).isEqualTo(Instant.fromEpochMilliseconds(1_000L))
|
||||
assertThat(task.isOccurrence).isTrue()
|
||||
assertThat(task.recurrenceRule).isEqualTo("FREQ=DAILY")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the master rule fills the editor even where is_recurring exists`() {
|
||||
// OpenTasks (DB 23) flags the row but masks the rule too.
|
||||
val task = mapTask(
|
||||
MapColumnReader(mapOf(Tasks.ID to 90L, Instances.TASK_ID to 9L, Instances.IS_RECURRING to 1)),
|
||||
SeriesRule(rrule = "FREQ=WEEKLY;BYDAY=MO", rdate = null),
|
||||
)
|
||||
assertThat(task.recurrenceRule).isEqualTo("FREQ=WEEKLY;BYDAY=MO")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a tasks row without a rule is no series`() {
|
||||
assertThat(TaskMapper.seriesRule(MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.RRULE to "")))).isNull()
|
||||
assertThat(TaskMapper.seriesRule(MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.RDATE to "20260720T090000Z"))))
|
||||
.isEqualTo(SeriesRule(rrule = null, rdate = "20260720T090000Z"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `recurrence is detected from rdate alone`() {
|
||||
val task = TaskMapper.task(
|
||||
MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.RDATE to "20260720T090000Z")),
|
||||
val task = mapTask(
|
||||
MapColumnReader(mapOf(Tasks.ID to 1L)),
|
||||
SeriesRule(rrule = null, rdate = "20260720T090000Z"),
|
||||
)
|
||||
assertThat(task.isRecurring).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `an override belongs to its master's series`() {
|
||||
// An edited occurrence is its own task row, without a rule of its own.
|
||||
val task = mapTask(
|
||||
MapColumnReader(
|
||||
mapOf(
|
||||
Tasks.ID to 95L,
|
||||
Instances.TASK_ID to 12L,
|
||||
Tasks.ORIGINAL_INSTANCE_ID to 9L,
|
||||
Instances.INSTANCE_ORIGINAL_TIME to 2_000L,
|
||||
),
|
||||
),
|
||||
SeriesRule(rrule = "FREQ=DAILY", rdate = null),
|
||||
)
|
||||
assertThat(task.taskId).isEqualTo(12L)
|
||||
assertThat(task.seriesId).isEqualTo(9L)
|
||||
assertThat(task.occurrenceStart).isEqualTo(Instant.fromEpochMilliseconds(2_000L))
|
||||
assertThat(task.recurrenceRule).isEqualTo("FREQ=DAILY")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a plain task is not recurring`() {
|
||||
val task = TaskMapper.task(MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.TITLE to "One-off")))
|
||||
val task = mapTask(MapColumnReader(mapOf(Tasks.ID to 1L, Tasks.TITLE to "One-off")))
|
||||
assertThat(task.isRecurring).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `falls back to instance id when task_id missing, and list color when no task color`() {
|
||||
val task = TaskMapper.task(
|
||||
val task = mapTask(
|
||||
MapColumnReader(mapOf(Tasks.ID to 9L, Tasks.LIST_COLOR to 0x111111)),
|
||||
)
|
||||
assertThat(task.taskId).isEqualTo(9L)
|
||||
@@ -140,3 +189,5 @@ class TaskMapperTest {
|
||||
assertThat(list.isLocal).isFalse()
|
||||
}
|
||||
}
|
||||
|
||||
private fun mapTask(r: ColumnReader, rule: SeriesRule? = null) = TaskMapper.withRule(TaskMapper.instance(r), rule)
|
||||
@@ -102,14 +102,15 @@ class TaskWriteMapperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `timed timestamps are written untouched`() {
|
||||
fun `timed timestamps are kept to the second`() {
|
||||
// The provider expands series in whole seconds.
|
||||
val at = Instant.fromEpochMilliseconds(1_784_412_345_678L)
|
||||
val values = TaskWriteMapper.taskValues(
|
||||
TaskForm(title = "Standup", listId = 1L, start = at, due = at),
|
||||
tzId = "Europe/Berlin",
|
||||
)
|
||||
assertThat(values[Tasks.DTSTART]).isEqualTo(1_784_412_345_678L)
|
||||
assertThat(values[Tasks.DUE]).isEqualTo(1_784_412_345_678L)
|
||||
assertThat(values[Tasks.DTSTART]).isEqualTo(1_784_412_345_000L)
|
||||
assertThat(values[Tasks.DUE]).isEqualTo(1_784_412_345_000L)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user