@@ -71,6 +71,18 @@ class DurationBuilderTest {
7171 assertEquals(" P3D" , result.entityValues.get(Events .DURATION ))
7272 }
7373
74+ @Test
75+ fun `Recurring all-day event (with negative DURATION)` () {
76+ val result = Entity (ContentValues ())
77+ val event = VEvent (propertyListOf(
78+ DtStart (Date (" 20251010" )),
79+ Duration (Period .ofDays(- 3 )), // invalid negative DURATION will be treated as positive
80+ RRule (" FREQ=DAILY;COUNT=5" )
81+ ))
82+ builder.build(event, event, result)
83+ assertEquals(" P3D" , result.entityValues.get(Events .DURATION ))
84+ }
85+
7486 @Test
7587 fun `Recurring all-day event (with zero seconds DURATION)` () {
7688 val result = Entity (ContentValues ())
@@ -95,6 +107,18 @@ class DurationBuilderTest {
95107 assertEquals(" PT1H30M" , result.entityValues.get(Events .DURATION ))
96108 }
97109
110+ @Test
111+ fun `Recurring non-all-day event (with negative DURATION)` () {
112+ val result = Entity (ContentValues ())
113+ val event = VEvent (propertyListOf(
114+ DtStart (DateTime (" 20251010T010203" , tzVienna)),
115+ Duration (java.time.Duration .ofMinutes(- 90 )), // invalid negative DURATION will be treated as positive
116+ RRule (" FREQ=DAILY;COUNT=5" )
117+ ))
118+ builder.build(event, event, result)
119+ assertEquals(" PT1H30M" , result.entityValues.get(Events .DURATION ))
120+ }
121+
98122 @Test
99123 fun `Recurring all-day event (with DTEND)` () {
100124 val result = Entity (ContentValues ())
0 commit comments