Debian Codegraph @

tests/dde-calendar-client-test/src/test_view/test_graphicsview.cpp

raw
1 // SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4
5 //#include "test_graphicsview.h"
6 //#include "graphicsItem/scheduleitem.h"
7 //#include "../third-party_stub/stub.h"
8 //#include "../dialog_stub.h"
9 //#include <QGraphicsView>
10
11 //test_graphicsview::test_graphicsview()
12 //{
13 // cGraphicsView = new CGraphicsView(nullptr, CGraphicsView::WeekPos);
14 //}
15
16 //test_graphicsview::~test_graphicsview()
17 //{
18 // delete cGraphicsView;
19 //}
20
21 ////void CGraphicsView::setMargins(int left, int top, int right, int bottom)
22 //TEST_F(test_graphicsview, setMargins)
23 //{
24 // int left = 50;
25 // int top = 50;
26 // int right = 50;
27 // int bottom = 50;
28 // cGraphicsView->setMargins(left, top, right, bottom);
29 // assert(cGraphicsView->m_margins.left() == 50);
30 //}
31
32 ////void CGraphicsView::setTheMe(int type)
33 //TEST_F(test_graphicsview, setTheMe)
34 //{
35 // int type = 0;
36 // cGraphicsView->setTheMe(type);
37
38 // type = 2;
39 // cGraphicsView->setTheMe(type);
40 //}
41
42 ////bool CGraphicsView::MeetCreationConditions(const QDateTime &date)
43 //TEST_F(test_graphicsview, MeetCreationConditions)
44 //{
45 // QString strDate = "2020-12-28 12:24:36";
46 // QDateTime date = QDateTime::fromString(strDate, "yyyy-MM-dd hh:mm:ss");
47
48 // cGraphicsView->MeetCreationConditions(date);
49 //}
50
51 //TEST_F(test_graphicsview, updateHeight_01)
52 //{
53 // cGraphicsView->updateHeight();
54 //}
55
56 ////void CGraphicsView::setRange(int w, int h, QDate begindate, QDate enddate, int rightMargin)
57 //TEST_F(test_graphicsview, setRange)
58 //{
59 // int w = 20;
60 // int h = 20;
61 // QDate begindate(2020, 11, 11);
62 // QDate enddate(2020, 11, 31);
63 // int rightMargin = 10;
64
65 // cGraphicsView->setRange(w, h, begindate, enddate, rightMargin);
66 // cGraphicsView->setRange(begindate, enddate);
67 //}
68
69 ////void CGraphicsView::setCurrentDate(const QDateTime &currentDate)
70 //TEST_F(test_graphicsview, setCurrentDate)
71 //{
72 // QDateTime date = QDateTime::currentDateTime();
73 // cGraphicsView->setCurrentDate(date);
74 //}
75
76 ////void CGraphicsView::setInfo(const QVector<ScheduleDataInfo> &info)
77 //TEST_F(test_graphicsview, setInfo)
78 //{
79 // QVector<ScheduleDataInfo> infos = QVector<ScheduleDataInfo> {};
80 // cGraphicsView->setInfo(infos);
81 //}
82
83 //bool MScheduleTimeThan(const ScheduleDataInfo &s1, const ScheduleDataInfo &s2);
84 //TEST_F(test_graphicsview, MScheduleTimeThan)
85 //{
86 // ScheduleDataInfo info1 = ScheduleDataInfo{};
87 // ScheduleDataInfo info2 = ScheduleDataInfo{};
88 // MScheduleTimeThan(info1, info2);
89 //}
90
91 ////void CGraphicsView::upDateInfoShow(const CGraphicsView::DragStatus &status, const ScheduleDataInfo &info)
92 //TEST_F(test_graphicsview, upDateInfoShow)
93 //{
94 // ScheduleDataInfo info = ScheduleDataInfo{};
95 // cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::IsCreate, info);
96 // cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeEnd, info);
97 // cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeBegin, info);
98 // cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::ChangeWhole, info);
99 // cGraphicsView->upDateInfoShow(CGraphicsView::DragStatus::NONE, info);
100 //}
101
102 ////QDateTime CGraphicsView::getPosDate(const QPoint &p)
103 //TEST_F(test_graphicsview, getPosDate)
104 //{
105 // QDateTime dateTime;
106 // QPoint point(50, 40);
107 // dateTime = cGraphicsView->getPosDate(point);
108 //}
109
110 ////void CGraphicsView::ShowSchedule(DragInfoItem *infoitem)
111 ////TEST_F(test_graphicsview, ShowSchedule)
112 ////{
113 //// QPoint point(50, 40);
114 //// QGraphicsItem *listItem = itemAt(point);
115 //// DragInfoItem *infoitem = dynamic_cast<DragInfoItem *>(listItem);
116 //// CScheduleItem *scheduleitem = dynamic_cast<CScheduleItem *>(infoitem);
117 //// qCInfo(CommonLogger) << scheduleitem->getType();
118 //// cGraphicsView->ShowSchedule(infoitem);
119 ////}
120
121 //TEST_F(test_graphicsview, MoveInfoProcess_01)
122 //{
123 // ScheduleDataInfo info = ScheduleDataInfo{};
124 // QPointF pos(1, 1);
125 // info.setAllDay(true);
126 // cGraphicsView->MoveInfoProcess(info, pos);
127 // EXPECT_FALSE(info.getAllDay());
128 //}
129
130 //TEST_F(test_graphicsview, MoveInfoProcess_02)
131 //{
132 // ScheduleDataInfo info = ScheduleDataInfo{};
133 // QPointF pos(1, 1);
134 // info.setAllDay(false);
135 // cGraphicsView->MoveInfoProcess(info, pos);
136 // EXPECT_FALSE(info.getAllDay());
137 //}
138
139 ////void CGraphicsView::addScheduleItem(const ScheduleDataInfo &info, QDate date, int index, int totalNum, int type, int viewtype, int maxnum)
140 //TEST_F(test_graphicsview, addScheduleItem_01)
141 //{
142 // ScheduleDataInfo info = ScheduleDataInfo{};
143 // QDate date(2020, 12, 28);
144 // int index = 1;
145 // int totalNum = 2;
146 // int type = 1;
147 // int viewtype = 1;
148 // int maxnum = 3;
149 // cGraphicsView->addScheduleItem(info, date, index, totalNum, type, viewtype, maxnum);
150 //}
151
152 //TEST_F(test_graphicsview, clearSchedule_01)
153 //{
154 // cGraphicsView->clearSchedule();
155
156 // EXPECT_TRUE(cGraphicsView->m_updateDflag);
157 // EXPECT_TRUE(cGraphicsView->m_vScheduleItem.isEmpty());
158 //}
159
160 ////void CGraphicsView::scheduleClassificationType(QVector<ScheduleDataInfo> &scheduleInfolist, QList<ScheduleclassificationInfo> &info)
161 //TEST_F(test_graphicsview, schedusleClassificationType)
162 //{
163 // QVector<ScheduleDataInfo> scheduleInfolist = QVector<ScheduleDataInfo> {};
164 // QList<ScheduleclassificationInfo> info = QList<ScheduleclassificationInfo> {};
165 // cGraphicsView->scheduleClassificationType(scheduleInfolist, info);
166 //}
167
168 ////void CGraphicsView::slotDoubleEvent(int type)
169 //TEST_F(test_graphicsview, slotDoubleEvent)
170 //{
171 // int type = 1;
172 // cGraphicsView->slotDoubleEvent(type);
173 //}
174
175 ////void CGraphicsView::slotScrollBar()
176 //TEST_F(test_graphicsview, slotScrollBar)
177 //{
178 // cGraphicsView->slotScrollBar();
179 //}
180
181 ////void CGraphicsView::slotUpdateScene()
182 //TEST_F(test_graphicsview, slotUpdateScene)
183 //{
184 // cGraphicsView->slotUpdateScene();
185 //}
186
187 ////void CGraphicsView::scrollBarValueChangedSlot()
188 //TEST_F(test_graphicsview, scrollBarValueChangedSlot_01)
189 //{
190 // cGraphicsView->scrollBarValueChangedSlot();
191 //}
192
193 ////ScheduleDataInfo CGraphicsView::getScheduleInfo(const QDateTime &beginDate, const QDateTime &endDate)
194 //TEST_F(test_graphicsview, getScheduleInfo_01)
195 //{
196 // QString begin = "2020-12-01 12:24:36";
197 // QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss");
198 // QString end = "2020-12-21 12:24:36";
199 // QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss");
200
201 // cGraphicsView->getScheduleInfo(begindate, enddate);
202 //}
203
204 //TEST_F(test_graphicsview, getScheduleInfo_02)
205 //{
206 // QString begin = "2020-12-01 12:24:36";
207 // QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss");
208 // QString end = "2020-12-21 12:24:36";
209 // QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss");
210
211 // cGraphicsView->getScheduleInfo(enddate, begindate);
212 //}
213
214 ////bool CGraphicsView::IsEqualtime(const QDateTime &timeFirst, const QDateTime &timeSecond)
215 //TEST_F(test_graphicsview, IsEqualtime)
216 //{
217 // QString begin = "2020-12-01 12:24:36";
218 // QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss");
219 // QString end = "2020-12-21 12:24:36";
220 // QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss");
221
222 // cGraphicsView->IsEqualtime(begindate, enddate);
223 //}
224
225 ////bool CGraphicsView::JudgeIsCreate(const QPointF &pos)
226 //TEST_F(test_graphicsview, JudgeIsCreate)
227 //{
228 // QPointF pos(20, 20);
229 // cGraphicsView->JudgeIsCreate(pos);
230 //}
231
232 ////void CGraphicsView::RightClickToCreate(QGraphicsItem *listItem, const QPoint &pos)
233 //TEST_F(test_graphicsview, RightClickToCreate)
234 //{
235 //// QGraphicsItem *listItem = nullptr;
236 //// QPoint pos(20, 20);
237 // //cGraphicsView->RightClickToCreate(listItem, pos);
238 //}
239
240 ////QDateTime CGraphicsView::getDragScheduleInfoBeginTime(const QDateTime &moveDateTime)
241 //TEST_F(test_graphicsview, getDragScheduleInfoBeginTime)
242 //{
243 // QString begin = "2020-12-01 12:24:36";
244 // QDateTime begindate = QDateTime::fromString(begin, "yyyy-MM-dd hh:mm:ss");
245
246 // cGraphicsView->getDragScheduleInfoBeginTime(begindate);
247 //}
248
249 ////QDateTime CGraphicsView::getDragScheduleInfoEndTime(const QDateTime &moveDateTime)
250 //TEST_F(test_graphicsview, getDragScheduleInfoEndTime)
251 //{
252 // QString end = "2020-12-21 12:24:36";
253 // QDateTime enddate = QDateTime::fromString(end, "yyyy-MM-dd hh:mm:ss");
254
255 // cGraphicsView->getDragScheduleInfoEndTime(enddate);
256 //}
257
258 ////void CGraphicsView::keepCenterOnScene()
259 //TEST_F(test_graphicsview, keepCenterOnScene)
260 //{
261 // cGraphicsView->keepCenterOnScene();
262 //}
263
264 ////void CGraphicsView::setTime(QTime time)
265 //TEST_F(test_graphicsview, setTime)
266 //{
267 // QTime time(7, 30, 5, 100);
268
269 // cGraphicsView->setTime(time);
270 //}
271
272 ////void CGraphicsView::updateInfo()
273 //TEST_F(test_graphicsview, updateInfo)
274 //{
275 // cGraphicsView->updateInfo();
276 //}
277
278 //TEST_F(test_graphicsview, mouseDoubleClickEvent_01)
279 //{
280 // Stub stub;
281 // calendarDDialogExecStub(stub);
282 // QMouseEvent event(QEvent::MouseButtonDblClick, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
283 // cGraphicsView->mouseDoubleClickEvent(&event);
284 //}
285
286 //TEST_F(test_graphicsview, mousePressEvent_01)
287 //{
288 // QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
289 // cGraphicsView->mousePressEvent(&event);
290 //}
291
292 //TEST_F(test_graphicsview, mouseMoveEvent_01)
293 //{
294 // QMouseEvent event(QEvent::MouseButtonPress, QPointF(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
295 // cGraphicsView->mouseMoveEvent(&event);
296 //}
297
298 //TEST_F(test_graphicsview, resizeEvent_01)
299 //{
300 // QResizeEvent event(QSize(50, 50), QSize(100, 100));
301 // cGraphicsView->resizeEvent(&event);
302 //}