Debian Codegraph @

tests/controller/test_wallpapersetter.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 <QMap>
25 #include <QTestEventList>
26 #include <QObject>
27 #include <QDialog>
28 #include <QStringList>
29
30 #include <DSearchEdit>
31 #include <DFileDialog>
32
33 #define private public
34 #define protected public
35
36 #include "wallpapersetter.h"
37 #include "mainwindow.h"
38 #include "albumcreatedialog.h"
39 #include "test_qtestDefine.h"
40 #include "imginfodialog.h"
41 #include "ac-desktop-define.h"
42
43 #include <stub-tool/cpp-stub/stub.h>
44 #include <stub-tool/stub-ext/stubext.h>
45
46
47 // 从菜单导入照片
48 TEST(WallpaperSetter, test_WallpaperSetter)
49 {
50 TEST_CASE_NAME("test_WallpaperSetter")
51 MainWindow *w = dApp->getMainWindow();
52 w->allPicBtnClicked();
53 QTest::qWait(500);
54
55 WallpaperSetter::instance();
56 QTest::qWait(500);
57 }
58
59 // 从菜单导入照片
60 TEST(WallpaperSetter, setBackground_test)
61 {
62 TEST_CASE_NAME("setBackground_test")
63 MainWindow *w = dApp->getMainWindow();
64 w->allPicBtnClicked();
65 QTest::qWait(500);
66 QString path;
67 if (DBManager::instance()->getAllPaths().length() > 0)
68 path = DBManager::instance()->getAllPaths().first();
69 else
70 path = testPath_test + "/2e5y8y.jpg";
71 WallpaperSetter::instance()->setBackground(path);
72 QTest::qWait(500);
73 }
74