Debian Codegraph @

tests/allpicview/test_searchview.cpp

raw symbols SCIP
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 <QTestEventList>
25
26 #include "application.h"
27 #include "mainwindow.h"
28 #include "allpicview.h"
29 #include "searchview.h"
30 #include "../test_qtestDefine.h"
31 #include "ac-desktop-define.h"
32
33
34 TEST(searchview, test_ini)
35 {
36 TEST_CASE_NAME("test_ini")
37 QTest::qWait(200);
38 MainWindow *w = dApp->getMainWindow();
39 w->showEvent(nullptr);
40 QTestEventList event;
41 QPoint p = w->getButG()->button(0)->pos();
42 event.addMouseMove(p);
43 event.addMouseClick(Qt::MouseButton::LeftButton);
44 event.addKeyClick(Qt::Key_A);
45 event.addMouseMove(p - QPoint(10, 10));
46 event.simulate(w->getButG()->button(0));
47 event.clear();
48
49 ASSERT_TRUE(w->m_pSearchView);
50 }
51
52 TEST(SlideShowButton, slidebtn)
53 {
54 TEST_CASE_NAME("slidebtn")
55 // SlideShowButton *btn = new SlideShowButton;
56 // QPoint point = btn->pos();
57 // int width = btn->width();
58 // QTestEventList e;
59 // e.addMouseMove(point, 10);
60 // e.addMouseMove(point + QPoint(1, 1), 10);
61 // e.addMousePress(Qt::MouseButton::LeftButton, Qt::NoModifier, point + QPoint(1, 1), 10);
62 // e.addMouseRelease(Qt::MouseButton::LeftButton, Qt::NoModifier, point + QPoint(1, 1), 10);
63 // e.addMouseMove(point + QPoint(width + 5, 0), 10);
64 // e.simulate(btn);
65 // e.clear();
66 // btn->deleteLater();
67 }
68
69 TEST(searchview, search)
70 {
71 TEST_CASE_NAME("search")
72 MainWindow *w = dApp->getMainWindow();
73 w->showEvent(nullptr);
74 SearchView *s = w->m_pSearchView;
75 s->onSlideShowBtnClicked();
76 }