| 1 | /* |
| 2 | * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 | * |
| 4 | * Author: ZhangYong <[email protected]> |
| 5 | * |
| 6 | * Maintainer: ZhangYong <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation, either version 3 of the License, or |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | #include <gtest/gtest.h> |
| 22 | #include <gmock/gmock-matchers.h> |
| 23 | |
| 24 | #include <QMap> |
| 25 | #include <QTestEventList> |
| 26 | #include <QObject> |
| 27 | #include <QDialog> |
| 28 | #include <QStringList> |
| 29 | #include <QFileInfo> |
| 30 | |
| 31 | #include <DSearchEdit> |
| 32 | #include <DFileDialog> |
| 33 | |
| 34 | #define private public |
| 35 | #define protected public |
| 36 | |
| 37 | #include "mainwindow.h" |
| 38 | #include "albumcreatedialog.h" |
| 39 | #include "imagebutton.h" |
| 40 | #include "test_qtestDefine.h" |
| 41 | #include "imginfodialog.h" |
| 42 | #include "ac-desktop-define.h" |
| 43 | |
| 44 | #include <stub-tool/cpp-stub/stub.h> |
| 45 | #include <stub-tool/stub-ext/stubext.h> |
| 46 | |
| 47 | TEST(imagebutton, showTooltip_test) |
| 48 | { |
| 49 | TEST_CASE_NAME("showTooltip_test") |
| 50 | MainWindow *w = dApp->getMainWindow(); |
| 51 | w->allPicBtnClicked(); |
| 52 | QTest::qWait(500); |
| 53 | |
| 54 | stub_ext::StubExt stu; |
| 55 | stu.set_lamda(ADDR(QFrame, show), []() { |
| 56 | return; |
| 57 | }); |
| 58 | |
| 59 | QPoint point(10, 10); |
| 60 | ImageButton *imgbtn = new ImageButton(); |
| 61 | imgbtn->showTooltip(point); |
| 62 | QTest::qWait(500); |
| 63 | } |