| 1 |
// SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#include "test_cscheduleoperation.h" |
| 6 |
|
| 7 |
//#include "cscheduledbus.h" |
| 8 |
//#include "dialog/dcalendarddialog.h" |
| 9 |
//#include "schedulectrldlg.h" |
| 10 |
//#include "dialog_stub.h" |
| 11 |
//#include "cscheduledbusstub.h" |
| 12 |
|
| 13 |
//test_cscheduleoperation::test_cscheduleoperation() |
| 14 |
//{ |
| 15 |
//} |
| 16 |
|
| 17 |
//test_cscheduleoperation::~test_cscheduleoperation() |
| 18 |
//{ |
| 19 |
//} |
| 20 |
|
| 21 |
//namespace ScheduleTestBtnNum { |
| 22 |
//static int button_num = 0; |
| 23 |
//} |
| 24 |
//int clickButton_stub(void *obj) |
| 25 |
//{ |
| 26 |
// Q_UNUSED(obj) |
| 27 |
// return ScheduleTestBtnNum::button_num; |
| 28 |
//} |
| 29 |
|
| 30 |
//void test_cscheduleoperation::SetUp() |
| 31 |
//{ |
| 32 |
// cscheduleDbusStub(stub); |
| 33 |
//} |
| 34 |
|
| 35 |
//void test_cscheduleoperation::TearDown() |
| 36 |
//{ |
| 37 |
//} |
| 38 |
|
| 39 |
//TEST_F(test_cscheduleoperation, createSchedule) |
| 40 |
//{ |
| 41 |
// ScheduleDataInfo info; |
| 42 |
// operation.createSchedule(info); |
| 43 |
//} |
| 44 |
|
| 45 |
//TEST_F(test_cscheduleoperation, changeSchedule) |
| 46 |
//{ |
| 47 |
// calendarDDialogExecStub(stub); |
| 48 |
// stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); |
| 49 |
// ScheduleDataInfo info; |
| 50 |
// QDate current = QDate::currentDate(); |
| 51 |
// info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); |
| 52 |
// info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); |
| 53 |
// info.setTitleName(tr("New Event")); |
| 54 |
// info.setAllDay(true); |
| 55 |
// info.setRemindData(RemindData(1, QTime(9, 0))); |
| 56 |
// info.setID(0); |
| 57 |
// info.setRecurID(0); |
| 58 |
|
| 59 |
// ScheduleDataInfo newinfo = info; |
| 60 |
// newinfo.setTitleName(tr("test")); |
| 61 |
|
| 62 |
// newinfo.setAllDay(false); |
| 63 |
// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_NONE); |
| 64 |
// ScheduleTestBtnNum::button_num = 0; |
| 65 |
// operation.changeSchedule(newinfo, info); |
| 66 |
// ScheduleTestBtnNum::button_num = 1; |
| 67 |
// operation.changeSchedule(newinfo, info); |
| 68 |
|
| 69 |
// newinfo.setAllDay(true); |
| 70 |
// operation.changeSchedule(newinfo, info); |
| 71 |
// ScheduleTestBtnNum::button_num = 0; |
| 72 |
// newinfo.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); |
| 73 |
// operation.changeSchedule(newinfo, info); |
| 74 |
// ScheduleTestBtnNum::button_num = 1; |
| 75 |
// operation.changeSchedule(newinfo, info); |
| 76 |
// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); |
| 77 |
// operation.changeSchedule(newinfo, info); |
| 78 |
// ScheduleTestBtnNum::button_num = 0; |
| 79 |
// operation.changeSchedule(newinfo, info); |
| 80 |
// ScheduleTestBtnNum::button_num = 2; |
| 81 |
// operation.changeSchedule(newinfo, info); |
| 82 |
|
| 83 |
// newinfo.setRecurID(2); |
| 84 |
// ScheduleTestBtnNum::button_num = 0; |
| 85 |
// operation.changeSchedule(newinfo, info); |
| 86 |
// ScheduleTestBtnNum::button_num = 1; |
| 87 |
// operation.changeSchedule(newinfo, info); |
| 88 |
// ScheduleTestBtnNum::button_num = 2; |
| 89 |
// operation.changeSchedule(newinfo, info); |
| 90 |
//} |
| 91 |
|
| 92 |
//TEST_F(test_cscheduleoperation, changeSchedule_01) |
| 93 |
//{ |
| 94 |
// calendarDDialogExecStub(stub); |
| 95 |
// ScheduleDataInfo oldInfo; |
| 96 |
// ScheduleDataInfo newInfo; |
| 97 |
// oldInfo.setAllDay(true); |
| 98 |
// oldInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_NONE); |
| 99 |
// newInfo.setAllDay(false); |
| 100 |
// newInfo.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); |
| 101 |
// operation.changeSchedule(oldInfo, newInfo); |
| 102 |
//} |
| 103 |
|
| 104 |
//TEST_F(test_cscheduleoperation, deleteSchedule) |
| 105 |
//{ |
| 106 |
// calendarDDialogExecStub(stub); |
| 107 |
// stub.set(ADDR(CScheduleCtrlDlg, clickButton), clickButton_stub); |
| 108 |
// ScheduleDataInfo info; |
| 109 |
// QDate current = QDate::currentDate(); |
| 110 |
// info.setBeginDateTime(QDateTime(current, QTime(0, 0, 0))); |
| 111 |
// info.setEndDateTime(QDateTime(current, QTime(23, 59, 59))); |
| 112 |
// info.setTitleName(tr("New Event")); |
| 113 |
// info.setAllDay(true); |
| 114 |
// info.setRemindData(RemindData(1, QTime(9, 0))); |
| 115 |
// info.setID(0); |
| 116 |
// info.setRecurID(0); |
| 117 |
// ScheduleTestBtnNum::button_num = 0; |
| 118 |
// operation.deleteSchedule(info); |
| 119 |
// ScheduleTestBtnNum::button_num = 1; |
| 120 |
// operation.deleteSchedule(info); |
| 121 |
|
| 122 |
// //删除重复日程 |
| 123 |
// info.getRepetitionRule().setRuleId(RepetitionRule::RRule_EVEDAY); |
| 124 |
// ScheduleTestBtnNum::button_num = 0; |
| 125 |
// operation.deleteSchedule(info); |
| 126 |
// ScheduleTestBtnNum::button_num = 1; |
| 127 |
// operation.deleteSchedule(info); |
| 128 |
// ScheduleTestBtnNum::button_num = 2; |
| 129 |
// operation.deleteSchedule(info); |
| 130 |
|
| 131 |
// info.setRecurID(2); |
| 132 |
// ScheduleTestBtnNum::button_num = 0; |
| 133 |
// operation.deleteSchedule(info); |
| 134 |
// ScheduleTestBtnNum::button_num = 1; |
| 135 |
// operation.deleteSchedule(info); |
| 136 |
// ScheduleTestBtnNum::button_num = 2; |
| 137 |
// operation.deleteSchedule(info); |
| 138 |
//} |
| 139 |
|
| 140 |
//TEST_F(test_cscheduleoperation, queryScheduleStr) |
| 141 |
//{ |
| 142 |
// QDateTime currenttime = QDateTime::currentDateTime(); |
| 143 |
// operation.queryScheduleStr("", currenttime, currenttime); |
| 144 |
//} |
| 145 |
|
| 146 |
//TEST_F(test_cscheduleoperation, deleteOnlyInfo_01) |
| 147 |
//{ |
| 148 |
// ScheduleDataInfo info; |
| 149 |
// operation.deleteOnlyInfo(info); |
| 150 |
//} |
| 151 |
|
| 152 |
//TEST_F(test_cscheduleoperation, deleteOnlyInfo_02) |
| 153 |
//{ |
| 154 |
// ScheduleDataInfo info; |
| 155 |
// info.m_ScheduleRRule.setRuleId(RepetitionRule::RRule_EVEDAY); |
| 156 |
// operation.deleteOnlyInfo(info); |
| 157 |
//} |
| 158 |
|
| 159 |
//TEST_F(test_cscheduleoperation, deleteOnlyInfo_03) |
| 160 |
//{ |
| 161 |
// ScheduleDataInfo info; |
| 162 |
// info.setType(4); |
| 163 |
// operation.deleteOnlyInfo(info); |
| 164 |
//} |
| 165 |
|
| 166 |
//TEST_F(test_cscheduleoperation, queryScheduleInfo_01) |
| 167 |
//{ |
| 168 |
// ScheduleDataInfo info; |
| 169 |
// QDateTime date; |
| 170 |
// QMap<QDate, QVector<ScheduleDataInfo>> map; |
| 171 |
// operation.queryScheduleInfo("", date, date, map); |
| 172 |
//} |
| 173 |
|
| 174 |
//TEST_F(test_cscheduleoperation, updateJobType_01) |
| 175 |
//{ |
| 176 |
// calendarDDialogExecStub(stub); |
| 177 |
// JobTypeInfo oldInfo(0); |
| 178 |
// JobTypeInfo newInfo; |
| 179 |
// operation.updateJobType(oldInfo, newInfo); |
| 180 |
//} |
| 181 |
|
| 182 |
//TEST_F(test_cscheduleoperation, updateJobType_02) |
| 183 |
//{ |
| 184 |
// calendarDDialogExecStub(stub); |
| 185 |
// JobTypeInfo oldInfo(1); |
| 186 |
// JobTypeInfo newInfo(1); |
| 187 |
// EXPECT_TRUE(operation.updateJobType(oldInfo, newInfo)); |
| 188 |
//} |
| 189 |
|
| 190 |
//TEST_F(test_cscheduleoperation, updateJobType_03) |
| 191 |
//{ |
| 192 |
// calendarDDialogExecStub(stub); |
| 193 |
// JobTypeInfo oldInfo(1, "", 10); |
| 194 |
// JobTypeInfo newInfo(0, "", 0); |
| 195 |
// operation.updateJobType(oldInfo, newInfo); |
| 196 |
// EXPECT_EQ(oldInfo.getColorTypeNo(), newInfo.getColorTypeNo()); |
| 197 |
//} |
| 198 |
|
| 199 |
//TEST_F(test_cscheduleoperation, updateJobType_04) |
| 200 |
//{ |
| 201 |
// calendarDDialogExecStub(stub); |
| 202 |
// JobTypeInfo oldInfo(1, "", 5); |
| 203 |
// JobTypeInfo newInfo(0, "", 0); |
| 204 |
// operation.updateJobType(oldInfo, newInfo); |
| 205 |
// EXPECT_TRUE(newInfo.getColorTypeNo() != 5); |
| 206 |
//} |
| 207 |
|
| 208 |
//TEST_F(test_cscheduleoperation, updateJobType_05) |
| 209 |
//{ |
| 210 |
// calendarDDialogExecStub(stub); |
| 211 |
// JobTypeInfo oldInfo(1, "", 5); |
| 212 |
// operation.updateJobType(oldInfo); |
| 213 |
//} |