From 10f85eeb1c6100719ef63f3d48089c52f39507ab Mon Sep 17 00:00:00 2001 From: hxw Date: Wed, 2 Aug 2023 17:46:07 +0800 Subject: [PATCH 1/2] modify event start end reminder name Signed-off-by: hxw huangxinwei2@huawei.com --- calendarmanager/common/calendar_define.h | 6 ++--- calendarmanager/native/src/native_util.cpp | 8 +++---- .../test/unittest/src/event_filter_test.cpp | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/calendarmanager/common/calendar_define.h b/calendarmanager/common/calendar_define.h index 7ed2abe..6eefeb1 100644 --- a/calendarmanager/common/calendar_define.h +++ b/calendarmanager/common/calendar_define.h @@ -81,12 +81,12 @@ struct Event { EventType type; optional location; optional title; - int64_t start; - int64_t end; + int64_t startTime; + int64_t endTime; optional isAllDay; vector attendees; optional timeZone; - optional> remind; + optional> reminderTime; optional recurrenceRule; optional description; optional service; diff --git a/calendarmanager/native/src/native_util.cpp b/calendarmanager/native/src/native_util.cpp index a7860ba..cc93542 100644 --- a/calendarmanager/native/src/native_util.cpp +++ b/calendarmanager/native/src/native_util.cpp @@ -38,8 +38,8 @@ void DumpEvent(const Event &event) LOG_DEBUG("location [null]"); } LOG_DEBUG("title :%{public}s", event.title.value_or("").c_str()); - LOG_DEBUG("start :%{public}lu", event.start); - LOG_DEBUG("end :%{public}lu", event.end); + LOG_DEBUG("startTime :%{public}lu", event.startTime); + LOG_DEBUG("endTime :%{public}lu", event.endTime); LOG_DEBUG("isAllDay :%{public}d", event.isAllDay.value_or(0)); for (const auto &attendee : event.attendees) { @@ -58,8 +58,8 @@ DataShare::DataShareValuesBucket BuildValueEvent(const Event &event, int calenda LOG_DEBUG("title %{public}s", event.title.value_or("").c_str()); valuesBucket.Put("title", event.title.value_or("")); - valuesBucket.Put("dtstart", event.start); - valuesBucket.Put("dtend", event.end); + valuesBucket.Put("dtstart", event.startTime); + valuesBucket.Put("dtend", event.endTime); LOG_DEBUG("description %{public}s", event.description.value_or("").c_str()); valuesBucket.Put("description", event.description.value_or("")); diff --git a/calendarmanager/test/unittest/src/event_filter_test.cpp b/calendarmanager/test/unittest/src/event_filter_test.cpp index 561219f..e796985 100644 --- a/calendarmanager/test/unittest/src/event_filter_test.cpp +++ b/calendarmanager/test/unittest/src/event_filter_test.cpp @@ -152,11 +152,11 @@ HWTEST_F(EventFilterTest, FilterByTime_test_001, testing::ext::TestSize.Level1) Event event; event.title = title; auto timeNow = Now(); - event.start = timeNow; - event.end = timeNow + 100000; + event.startTime = timeNow; + event.endTime = timeNow + 100000; auto eventId = calendar->AddEvent(event); ASSERT_TRUE(eventId > 0); - auto events = calendar->GetEvents(FilterByTime(event.start, event.end), {}); + auto events = calendar->GetEvents(FilterByTime(event.startTime, event.endTime), {}); ASSERT_EQ(1, events.size()); EXPECT_EQ(events.at(0).title.value(), title); } @@ -166,14 +166,14 @@ HWTEST_F(EventFilterTest, FilterByTime_test_002, testing::ext::TestSize.Level1) Event event; event.title = "FilterByTime_test_002"; auto timeNow = Now(); - event.start = timeNow; + event.startTime = timeNow; const int64_t interval = 100; - event.end = timeNow + interval; + event.endTime = timeNow + interval; auto eventId = calendar->AddEvent(event); ASSERT_TRUE(eventId > 0); - auto events = calendar->GetEvents(FilterByTime(event.start - interval * 2, event.start - interval), {}); + auto events = calendar->GetEvents(FilterByTime(event.startTime - interval * 2, event.startTime - interval), {}); EXPECT_TRUE(events.empty()); - events = calendar->GetEvents(FilterByTime(event.end + interval, event.end + interval * 2), {}); + events = calendar->GetEvents(FilterByTime(event.endTime + interval, event.endTime + interval * 2), {}); ASSERT_TRUE(events.empty()); } @@ -183,18 +183,18 @@ HWTEST_F(EventFilterTest, FilterByTime_test_003, testing::ext::TestSize.Level1) auto timeNow = Now(); Event event1; event1.title = title1; - event1.start = timeNow; + event1.startTime = timeNow; const int64_t interval = 100; - event1.end = timeNow + interval; + event1.endTime = timeNow + interval; const string title2 = "FilterByTime_test_003_2"; Event event2; event2.title = title2; - event2.start = timeNow; - event2.end = timeNow + interval * 2; + event2.startTime = timeNow; + event2.endTime = timeNow + interval * 2; auto count = calendar->AddEvents({event1, event2}); ASSERT_TRUE(count == 2); - auto events = calendar->GetEvents(FilterByTime(timeNow, event2.end), {}); + auto events = calendar->GetEvents(FilterByTime(timeNow, event2.endTime), {}); ASSERT_EQ(2, events.size()); EXPECT_EQ(events.at(0).title.value(), title1); EXPECT_EQ(events.at(1).title.value(), title2); -- Gitee From b5347c215fa6fb8e1da6ef1d8efb62c53b4f3f97 Mon Sep 17 00:00:00 2001 From: hxw Date: Wed, 2 Aug 2023 17:46:07 +0800 Subject: [PATCH 2/2] modify event start end reminder name Signed-off-by: hxw --- calendarmanager/common/calendar_define.h | 6 ++--- calendarmanager/native/src/native_util.cpp | 8 +++---- .../test/unittest/src/event_filter_test.cpp | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/calendarmanager/common/calendar_define.h b/calendarmanager/common/calendar_define.h index 7ed2abe..6eefeb1 100644 --- a/calendarmanager/common/calendar_define.h +++ b/calendarmanager/common/calendar_define.h @@ -81,12 +81,12 @@ struct Event { EventType type; optional location; optional title; - int64_t start; - int64_t end; + int64_t startTime; + int64_t endTime; optional isAllDay; vector attendees; optional timeZone; - optional> remind; + optional> reminderTime; optional recurrenceRule; optional description; optional service; diff --git a/calendarmanager/native/src/native_util.cpp b/calendarmanager/native/src/native_util.cpp index a7860ba..cc93542 100644 --- a/calendarmanager/native/src/native_util.cpp +++ b/calendarmanager/native/src/native_util.cpp @@ -38,8 +38,8 @@ void DumpEvent(const Event &event) LOG_DEBUG("location [null]"); } LOG_DEBUG("title :%{public}s", event.title.value_or("").c_str()); - LOG_DEBUG("start :%{public}lu", event.start); - LOG_DEBUG("end :%{public}lu", event.end); + LOG_DEBUG("startTime :%{public}lu", event.startTime); + LOG_DEBUG("endTime :%{public}lu", event.endTime); LOG_DEBUG("isAllDay :%{public}d", event.isAllDay.value_or(0)); for (const auto &attendee : event.attendees) { @@ -58,8 +58,8 @@ DataShare::DataShareValuesBucket BuildValueEvent(const Event &event, int calenda LOG_DEBUG("title %{public}s", event.title.value_or("").c_str()); valuesBucket.Put("title", event.title.value_or("")); - valuesBucket.Put("dtstart", event.start); - valuesBucket.Put("dtend", event.end); + valuesBucket.Put("dtstart", event.startTime); + valuesBucket.Put("dtend", event.endTime); LOG_DEBUG("description %{public}s", event.description.value_or("").c_str()); valuesBucket.Put("description", event.description.value_or("")); diff --git a/calendarmanager/test/unittest/src/event_filter_test.cpp b/calendarmanager/test/unittest/src/event_filter_test.cpp index 561219f..e796985 100644 --- a/calendarmanager/test/unittest/src/event_filter_test.cpp +++ b/calendarmanager/test/unittest/src/event_filter_test.cpp @@ -152,11 +152,11 @@ HWTEST_F(EventFilterTest, FilterByTime_test_001, testing::ext::TestSize.Level1) Event event; event.title = title; auto timeNow = Now(); - event.start = timeNow; - event.end = timeNow + 100000; + event.startTime = timeNow; + event.endTime = timeNow + 100000; auto eventId = calendar->AddEvent(event); ASSERT_TRUE(eventId > 0); - auto events = calendar->GetEvents(FilterByTime(event.start, event.end), {}); + auto events = calendar->GetEvents(FilterByTime(event.startTime, event.endTime), {}); ASSERT_EQ(1, events.size()); EXPECT_EQ(events.at(0).title.value(), title); } @@ -166,14 +166,14 @@ HWTEST_F(EventFilterTest, FilterByTime_test_002, testing::ext::TestSize.Level1) Event event; event.title = "FilterByTime_test_002"; auto timeNow = Now(); - event.start = timeNow; + event.startTime = timeNow; const int64_t interval = 100; - event.end = timeNow + interval; + event.endTime = timeNow + interval; auto eventId = calendar->AddEvent(event); ASSERT_TRUE(eventId > 0); - auto events = calendar->GetEvents(FilterByTime(event.start - interval * 2, event.start - interval), {}); + auto events = calendar->GetEvents(FilterByTime(event.startTime - interval * 2, event.startTime - interval), {}); EXPECT_TRUE(events.empty()); - events = calendar->GetEvents(FilterByTime(event.end + interval, event.end + interval * 2), {}); + events = calendar->GetEvents(FilterByTime(event.endTime + interval, event.endTime + interval * 2), {}); ASSERT_TRUE(events.empty()); } @@ -183,18 +183,18 @@ HWTEST_F(EventFilterTest, FilterByTime_test_003, testing::ext::TestSize.Level1) auto timeNow = Now(); Event event1; event1.title = title1; - event1.start = timeNow; + event1.startTime = timeNow; const int64_t interval = 100; - event1.end = timeNow + interval; + event1.endTime = timeNow + interval; const string title2 = "FilterByTime_test_003_2"; Event event2; event2.title = title2; - event2.start = timeNow; - event2.end = timeNow + interval * 2; + event2.startTime = timeNow; + event2.endTime = timeNow + interval * 2; auto count = calendar->AddEvents({event1, event2}); ASSERT_TRUE(count == 2); - auto events = calendar->GetEvents(FilterByTime(timeNow, event2.end), {}); + auto events = calendar->GetEvents(FilterByTime(timeNow, event2.endTime), {}); ASSERT_EQ(2, events.size()); EXPECT_EQ(events.at(0).title.value(), title1); EXPECT_EQ(events.at(1).title.value(), title2); -- Gitee