| 1 |
// SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#include "test_timeedit.h" |
| 6 |
|
| 7 |
#include <QPixmap> |
| 8 |
#include <QFocusEvent> |
| 9 |
#include <QApplication> |
| 10 |
|
| 11 |
test_timeedit::test_timeedit() |
| 12 |
{ |
| 13 |
mTimeEdit = new CTimeEdit(); |
| 14 |
} |
| 15 |
|
| 16 |
test_timeedit::~test_timeedit() |
| 17 |
{ |
| 18 |
delete mTimeEdit; |
| 19 |
mTimeEdit = nullptr; |
| 20 |
} |
| 21 |
|
| 22 |
//void CTimeEdit::setTime(QTime time) |
| 23 |
TEST_F(test_timeedit, setTime) |
| 24 |
{ |
| 25 |
mTimeEdit->setTime(QTime(23, 59, 59)); |
| 26 |
} |
| 27 |
|
| 28 |
//QTime CTimeEdit::getTime() |
| 29 |
TEST_F(test_timeedit, getTime) |
| 30 |
{ |
| 31 |
mTimeEdit->getTime(); |
| 32 |
} |
| 33 |
|
| 34 |
//setTimeFormat |
| 35 |
TEST_F(test_timeedit, setTimeFormat) |
| 36 |
{ |
| 37 |
mTimeEdit->setTimeFormat(1); |
| 38 |
mTimeEdit->setTimeFormat(0); |
| 39 |
} |
| 40 |
|
| 41 |
//slotFocusDraw |
| 42 |
TEST_F(test_timeedit, slotFocusDraw) |
| 43 |
{ |
| 44 |
mTimeEdit->slotFocusDraw(false); |
| 45 |
} |
| 46 |
|
| 47 |
//getPixmap |
| 48 |
TEST_F(test_timeedit, getPixmap) |
| 49 |
{ |
| 50 |
mTimeEdit->slotFocusDraw(true); |
| 51 |
mTimeEdit->setFixedSize(200, 50); |
| 52 |
QPixmap pixmap(mTimeEdit->size()); |
| 53 |
mTimeEdit->render(&pixmap); |
| 54 |
} |
| 55 |
|
| 56 |
TEST_F(test_timeedit,focusInEvent) |
| 57 |
{ |
| 58 |
QFocusEvent focusEvent_in( QEvent::FocusIn,Qt::FocusReason::TabFocusReason); |
| 59 |
QApplication::sendEvent(mTimeEdit,&focusEvent_in); |
| 60 |
} |
| 61 |
|
| 62 |
TEST_F(test_timeedit, slotActivated_01) |
| 63 |
{ |
| 64 |
mTimeEdit->slotActivated(""); |
| 65 |
} |
| 66 |
|
| 67 |
TEST_F(test_timeedit, slotEditingFinished_01) |
| 68 |
{ |
| 69 |
mTimeEdit->slotEditingFinished(); |
| 70 |
} |
| 71 |
|
| 72 |
TEST_F(test_timeedit, initUI_01) |
| 73 |
{ |
| 74 |
mTimeEdit->initUI(); |
| 75 |
} |
| 76 |
|
| 77 |
TEST_F(test_timeedit, initConnection_01) |
| 78 |
{ |
| 79 |
mTimeEdit->initConnection(); |
| 80 |
} |
| 81 |
|
| 82 |
TEST_F(test_timeedit, showPopup_01) |
| 83 |
{ |
| 84 |
mTimeEdit->showPopup(); |
| 85 |
} |