| 1 | // SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #include "logiconbutton.h" |
| 6 | |
| 7 | #include <gtest/gtest.h> |
| 8 | #include <stub.h> |
| 9 | |
| 10 | #include <QDebug> |
| 11 | #include <QEvent> |
| 12 | TEST(LogCombox_Constructor_UT, LogCombox_Constructor_UT_001) |
| 13 | { |
| 14 | LogIconButton *p = new LogIconButton(nullptr); |
| 15 | EXPECT_NE(p, nullptr); |
| 16 | p->deleteLater(); |
| 17 | } |
| 18 | |
| 19 | TEST(LogCombox_Constructor_UT, LogCombox_Constructor_UT_002) |
| 20 | { |
| 21 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 22 | EXPECT_NE(p, nullptr); |
| 23 | p->deleteLater(); |
| 24 | } |
| 25 | |
| 26 | TEST(LogCombox_sizeHint_UT, LogCombox_sizeHint_UT) |
| 27 | { |
| 28 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 29 | EXPECT_NE(p, nullptr); |
| 30 | p->sizeHint(); |
| 31 | p->deleteLater(); |
| 32 | } |
| 33 | |
| 34 | TEST(LogCombox_mousePressEvent_UT, LogCombox_mousePressEvent_UT) |
| 35 | { |
| 36 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 37 | EXPECT_NE(p, nullptr); |
| 38 | p->mousePressEvent(nullptr); |
| 39 | p->deleteLater(); |
| 40 | } |
| 41 | |
| 42 | TEST(LogCombox_mousePressEvent_UT, LogCombox_mousePressEvent_UT_001) |
| 43 | { |
| 44 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 45 | EXPECT_NE(p, nullptr); |
| 46 | QEvent *e = new QEvent(QEvent::QueryWhatsThis); |
| 47 | p->event(e); |
| 48 | delete e; |
| 49 | p->deleteLater(); |
| 50 | } |
| 51 | |
| 52 | TEST(LogCombox_mousePressEvent_UT, LogCombox_mousePressEvent_UT_002) |
| 53 | { |
| 54 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 55 | EXPECT_NE(p, nullptr); |
| 56 | QEvent *e = new QEvent(QEvent::HoverEnter); |
| 57 | p->event(e); |
| 58 | delete e; |
| 59 | p->deleteLater(); |
| 60 | } |
| 61 | |
| 62 | TEST(LogCombox_resizeEvent_UT, LogCombox_resizeEvent_UT) |
| 63 | { |
| 64 | LogIconButton *p = new LogIconButton("aa", nullptr); |
| 65 | EXPECT_NE(p, nullptr); |
| 66 | p->resizeEvent(nullptr); |
| 67 | p->deleteLater(); |
| 68 | } |