| 1 |
// SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
//#include "testmainwindowgui.h" |
| 6 |
//#include "configsettings.h" |
| 7 |
//#include "view/monthgraphiview.h" |
| 8 |
//#include "yearWidget/yearwindow.h" |
| 9 |
//#include "monthWidget/monthwindow.h" |
| 10 |
//#include "dialog_stub.h" |
| 11 |
//#include "testscheduledata.h" |
| 12 |
|
| 13 |
//#include <QProcess> |
| 14 |
|
| 15 |
//testMainWindowGUI::testMainWindowGUI() |
| 16 |
//{ |
| 17 |
//} |
| 18 |
|
| 19 |
//QVariant getSetView(const QString &str) |
| 20 |
//{ |
| 21 |
// QVariant variant; |
| 22 |
// if (str == "base.geometry") { |
| 23 |
// QByteArray byteArray("\x01\xD9\xD0\xCB\x00\x02\x00\x00\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x02\x12\x00\x00\x00\xF3\x00\x00\x05m\x00\x00\x03l\x00\x00\x00\x00\x00\x00\x00\x00\x07\x80"); |
| 24 |
// variant.setValue(byteArray); |
| 25 |
// } else if (str == "base.state") { |
| 26 |
// variant.setValue(1); |
| 27 |
|
| 28 |
// } else if (str == "base.view") { |
| 29 |
// variant.setValue(2); |
| 30 |
// } |
| 31 |
// return variant; |
| 32 |
//} |
| 33 |
|
| 34 |
//void testMainWindowGUI::SetUp() |
| 35 |
//{ |
| 36 |
// Stub stub; |
| 37 |
// stub.set(ADDR(CConfigSettings, value), getSetView); |
| 38 |
//} |
| 39 |
|
| 40 |
//void testMainWindowGUI::TearDown() |
| 41 |
//{ |
| 42 |
//} |
| 43 |
|
| 44 |
//TEST_F(testMainWindowGUI, yearGUITest) |
| 45 |
//{ |
| 46 |
// Calendarmainwindow mainWindow(0); |
| 47 |
|
| 48 |
// CYearWindow *myYearWindow = mainWindow.findChild<CYearWindow *>("yearwindow"); |
| 49 |
// if (myYearWindow != nullptr) { |
| 50 |
// DIconButton *m_prevButton = myYearWindow->findChild<DIconButton *>("PrevButton"); |
| 51 |
// DIconButton *m_nextButton = myYearWindow->findChild<DIconButton *>("NextButton"); |
| 52 |
// LabelWidget *m_today = myYearWindow->findChild<LabelWidget *>("yearToDay"); |
| 53 |
|
| 54 |
// if (m_prevButton != nullptr) { |
| 55 |
// QTest::mouseClick(m_prevButton, Qt::LeftButton); |
| 56 |
// } |
| 57 |
|
| 58 |
// if (m_today != nullptr) { |
| 59 |
// QTest::mouseClick(m_today, Qt::LeftButton); |
| 60 |
// } |
| 61 |
|
| 62 |
// if (m_nextButton != nullptr) { |
| 63 |
// QTest::mouseClick(m_nextButton, Qt::LeftButton); |
| 64 |
// } |
| 65 |
// //获取QStackedWidget |
| 66 |
// QStackedWidget *stackedWidget = myYearWindow->findChild<QStackedWidget *>(); |
| 67 |
// if (stackedWidget) { |
| 68 |
// QWidget *currentWidget = stackedWidget->currentWidget(); |
| 69 |
// if (currentWidget) { |
| 70 |
// currentWidget->setFocus(); |
| 71 |
// QTest::keyPress(currentWidget, Qt::Key_Up); |
| 72 |
// } |
| 73 |
// currentWidget = stackedWidget->currentWidget(); |
| 74 |
// if (currentWidget) { |
| 75 |
// currentWidget->setFocus(); |
| 76 |
// QTest::keyPress(currentWidget, Qt::Key_Down); |
| 77 |
// } |
| 78 |
// } |
| 79 |
// //year_resizeEvent |
| 80 |
// myYearWindow->setSearchWFlag(true); |
| 81 |
// mainWindow.resize(1000, 400); |
| 82 |
// myYearWindow->setSearchWFlag(false); |
| 83 |
// mainWindow.resize(700, 400); |
| 84 |
// } |
| 85 |
//} |
| 86 |
|
| 87 |
//TEST_F(testMainWindowGUI, monthGUITest) |
| 88 |
//{ |
| 89 |
// Calendarmainwindow mainWindow(1); |
| 90 |
// CMonthWindow *mymonthWindow = mainWindow.findChild<CMonthWindow *>("monthWindow"); |
| 91 |
// if (mymonthWindow != nullptr) { |
| 92 |
// } |
| 93 |
//} |
| 94 |
//TEST_F(testMainWindowGUI, weekGUIKeyTest) |
| 95 |
//{ |
| 96 |
// Calendarmainwindow mainWindow(2); |
| 97 |
//} |
| 98 |
|
| 99 |
//TEST_F(testMainWindowGUI, dayGUIKeyTest) |
| 100 |
//{ |
| 101 |
// Calendarmainwindow mainWindow(3); |
| 102 |
//} |
| 103 |
|
| 104 |
//TEST_F(testMainWindowGUI, slotCurrentDateUpdate) |
| 105 |
//{ |
| 106 |
// Calendarmainwindow mainWindow(1); |
| 107 |
// mainWindow.slotCurrentDateUpdate(); |
| 108 |
//} |
| 109 |
|
| 110 |
////slotSetSearchFocus |
| 111 |
//TEST_F(testMainWindowGUI, slotSetSearchFocus) |
| 112 |
//{ |
| 113 |
// Calendarmainwindow mainWindow(1); |
| 114 |
// mainWindow.slotSetSearchFocus(); |
| 115 |
//} |
| 116 |
|
| 117 |
////viewWindow |
| 118 |
//TEST_F(testMainWindowGUI, viewWindow) |
| 119 |
//{ |
| 120 |
// Calendarmainwindow mainWindow(1); |
| 121 |
// mainWindow.viewWindow(3, false); |
| 122 |
// mainWindow.viewWindow(0, true); |
| 123 |
//} |
| 124 |
|
| 125 |
////setSearchWidth |
| 126 |
//TEST_F(testMainWindowGUI, setSearchWidth) |
| 127 |
//{ |
| 128 |
// Calendarmainwindow mainWindow(1); |
| 129 |
// mainWindow.setSearchWidth(500); |
| 130 |
//} |
| 131 |
|
| 132 |
////slotTheme |
| 133 |
//TEST_F(testMainWindowGUI, slotTheme) |
| 134 |
//{ |
| 135 |
// Calendarmainwindow mainWindow(1); |
| 136 |
// mainWindow.slotTheme(0); |
| 137 |
// mainWindow.slotTheme(1); |
| 138 |
// mainWindow.slotTheme(2); |
| 139 |
//} |
| 140 |
|
| 141 |
////slotOpenSchedule |
| 142 |
//TEST_F(testMainWindowGUI, slotOpenSchedule) |
| 143 |
//{ |
| 144 |
// Stub stub; |
| 145 |
// calendarDDialogExecStub(stub); |
| 146 |
// Calendarmainwindow mainWindow(1); |
| 147 |
// QString job = ScheduleDataInfo::ScheduleToJsonStr(TestDataInfo::getScheduleItemDInfo().first()); |
| 148 |
// mainWindow.slotOpenSchedule(job); |
| 149 |
//} |
| 150 |
|
| 151 |
////slotWUpdateSchedule |
| 152 |
//TEST_F(testMainWindowGUI, slotWUpdateSchedule) |
| 153 |
//{ |
| 154 |
// Calendarmainwindow mainWindow(1); |
| 155 |
// mainWindow.slotWUpdateSchedule(); |
| 156 |
//} |
| 157 |
|
| 158 |
////slotStextChanged |
| 159 |
//TEST_F(testMainWindowGUI, slotStextChanged) |
| 160 |
//{ |
| 161 |
// Calendarmainwindow mainWindow(1); |
| 162 |
// mainWindow.slotStextChanged(); |
| 163 |
//} |
| 164 |
|
| 165 |
////slotStextfocusChanged |
| 166 |
//TEST_F(testMainWindowGUI, slotStextfocusChanged) |
| 167 |
//{ |
| 168 |
// Calendarmainwindow mainWindow(1); |
| 169 |
// mainWindow.slotStextfocusChanged(true); |
| 170 |
//} |
| 171 |
|
| 172 |
////slotDeleteitem |
| 173 |
//TEST_F(testMainWindowGUI, slotDeleteitem) |
| 174 |
//{ |
| 175 |
// Stub stub; |
| 176 |
// calendarDDialogExecStub(stub); |
| 177 |
// Calendarmainwindow mainWindow(1); |
| 178 |
// mainWindow.slotDeleteitem(); |
| 179 |
//} |
| 180 |
|
| 181 |
////slotNewSchedule |
| 182 |
//TEST_F(testMainWindowGUI, slotNewSchedule) |
| 183 |
//{ |
| 184 |
// Stub stub; |
| 185 |
// calendarDDialogExecStub(stub); |
| 186 |
// Calendarmainwindow mainWindow(1); |
| 187 |
// mainWindow.slotNewSchedule(); |
| 188 |
//} |
| 189 |
|
| 190 |
////slotSwitchView |
| 191 |
//TEST_F(testMainWindowGUI, slotSwitchView) |
| 192 |
//{ |
| 193 |
// Stub stub; |
| 194 |
// calendarDDialogExecStub(stub); |
| 195 |
// Calendarmainwindow mainWindow(1); |
| 196 |
// mainWindow.slotSwitchView(0); |
| 197 |
// mainWindow.slotSwitchView(1); |
| 198 |
// mainWindow.slotSwitchView(2); |
| 199 |
// mainWindow.slotSwitchView(3); |
| 200 |
//} |
| 201 |
|
| 202 |
////slotViewtransparentFrame |
| 203 |
//TEST_F(testMainWindowGUI, slotViewtransparentFrame) |
| 204 |
//{ |
| 205 |
// Calendarmainwindow mainWindow(1); |
| 206 |
// mainWindow.slotViewtransparentFrame(true); |
| 207 |
// mainWindow.slotViewtransparentFrame(false); |
| 208 |
//} |
| 209 |
|
| 210 |
//bool stub_startDetached(const QString &program, const QStringList &arguments) |
| 211 |
//{ |
| 212 |
// Q_UNUSED(program) |
| 213 |
// Q_UNUSED(arguments) |
| 214 |
// return true; |
| 215 |
//} |
| 216 |
|
| 217 |
////slotViewShortcut |
| 218 |
//TEST_F(testMainWindowGUI, slotViewShortcut) |
| 219 |
//{ |
| 220 |
// Stub stub; |
| 221 |
// stub.set((bool (*)(const QString &, const QStringList &))ADDR(QProcess, startDetached), |
| 222 |
// stub_startDetached); |
| 223 |
// Calendarmainwindow mainWindow(1); |
| 224 |
// mainWindow.slotViewShortcut(); |
| 225 |
//} |
| 226 |
|
| 227 |
//TEST_F(testMainWindowGUI, resizeEvent_01) |
| 228 |
//{ |
| 229 |
// QResizeEvent event(QSize(10, 10), QSize(100, 100)); |
| 230 |
// Calendarmainwindow mainWindow(1); |
| 231 |
// mainWindow.resizeEvent(&event); |
| 232 |
//} |
| 233 |
|
| 234 |
//TEST_F(testMainWindowGUI, resizeEvent_02) |
| 235 |
//{ |
| 236 |
// QResizeEvent event(QSize(10, 10), QSize(1000, 1000)); |
| 237 |
// Calendarmainwindow mainWindow(1); |
| 238 |
// mainWindow.resize(1000, 1000); |
| 239 |
// mainWindow.resizeEvent(&event); |
| 240 |
//} |
| 241 |
|
| 242 |
//TEST_F(testMainWindowGUI, slotstackWClicked_01) |
| 243 |
//{ |
| 244 |
// Calendarmainwindow mainWindow(1); |
| 245 |
// QPushButton btn; |
| 246 |
// mainWindow.m_buttonBox->setId(&btn, 0); |
| 247 |
// mainWindow.slotstackWClicked(&btn); |
| 248 |
//} |
| 249 |
|
| 250 |
//TEST_F(testMainWindowGUI, slotWUpdateSchedule_01) |
| 251 |
//{ |
| 252 |
// Calendarmainwindow mainWindow(1); |
| 253 |
// mainWindow.m_opensearchflag = true; |
| 254 |
// mainWindow.m_searchEdit->setText("123"); |
| 255 |
// mainWindow.slotWUpdateSchedule(); |
| 256 |
//} |
| 257 |
|
| 258 |
//TEST_F(testMainWindowGUI, slotSreturnPressed_01) |
| 259 |
//{ |
| 260 |
// Calendarmainwindow mainWindow(1); |
| 261 |
// mainWindow.m_opensearchflag = true; |
| 262 |
// mainWindow.m_searchEdit->setText("123"); |
| 263 |
// mainWindow.slotSreturnPressed(); |
| 264 |
//} |
| 265 |
|
| 266 |
//TEST_F(testMainWindowGUI, slotStextChanged_01) |
| 267 |
//{ |
| 268 |
// Calendarmainwindow mainWindow(1); |
| 269 |
// mainWindow.m_searchEdit->setText("123"); |
| 270 |
// mainWindow.slotStextChanged(); |
| 271 |
//} |
| 272 |
|
| 273 |
//TEST_F(testMainWindowGUI, slotStextChanged_02) |
| 274 |
//{ |
| 275 |
// Calendarmainwindow mainWindow(1); |
| 276 |
// mainWindow.m_searchEdit->setText(""); |
| 277 |
// mainWindow.slotStextChanged(); |
| 278 |
//} |
| 279 |
|
| 280 |
//TEST_F(testMainWindowGUI, slotSearchSelectSchedule_02) |
| 281 |
//{ |
| 282 |
// Calendarmainwindow mainWindow(1); |
| 283 |
// ScheduleDataInfo info; |
| 284 |
// mainWindow.slotSearchSelectSchedule(info); |
| 285 |
//} |
| 286 |
|
| 287 |
//TEST_F(testMainWindowGUI, mouseMoveEvent_01) |
| 288 |
//{ |
| 289 |
// Calendarmainwindow mainWindow(1); |
| 290 |
// QMouseEvent event(QMouseEvent::MouseMove, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); |
| 291 |
// mainWindow.mouseMoveEvent(&event); |
| 292 |
//} |
| 293 |
|
| 294 |
//TEST_F(testMainWindowGUI, changeEvent_01) |
| 295 |
//{ |
| 296 |
// Calendarmainwindow mainWindow(1); |
| 297 |
// QEvent event(QEvent::ActivationChange); |
| 298 |
// mainWindow.changeEvent(&event); |
| 299 |
//} |
| 300 |
|
| 301 |
//TEST_F(testMainWindowGUI, slotOpenSettingDialog_01) |
| 302 |
//{ |
| 303 |
// Stub stub; |
| 304 |
// calendarDDialogExecStub(stub); |
| 305 |
// Calendarmainwindow mainWindow(1); |
| 306 |
// mainWindow.slotOpenSettingDialog(); |
| 307 |
//} |