File: test_f_controller.cpp

package info (click to toggle)
deepin-image-viewer 5.8.2-4.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 28,124 kB
  • sloc: cpp: 17,842; sh: 27; makefile: 11
file content (107 lines) | stat: -rw-r--r-- 4,060 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd.
 *
 * Author:     LiuMingHang <liuminghang@uniontech.com>
 *
 * Maintainer: ZhangYong <ZhangYong@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include "gtestview.h"
#include "accessibility/ac-desktop-define.h"
#include "src/src/controller/dbusclient.h"
#include "src/src/controller/divdbuscontroller.h"
#define private public
#include "src/src/controller/wallpapersetter.h"

TEST_F(gtestview, Dbusclient1)
{

    Dbusclient *client = new  Dbusclient();
    QImage imgQImage(QApplication::applicationDirPath() + "/test/jpg102.jpg");
    QList<QString> list;
    list.push_back(QApplication::applicationDirPath() + "/test/jpg102.jpg");
    QList<QImage> listimg;
    listimg.push_back(imgQImage);
    client->openFiles(list);
    client->openImages(listimg);
    client->openDrawingBoard(list);
//    client->propertyChanged(QDBusMessage());
    client->deleteLater();
    client = nullptr;
}

TEST_F(gtestview, DIVDBusController)
{
    DIVDBusController *control = new DIVDBusController();
    control->activeWindow();
    control->editImage(QApplication::applicationDirPath() + "/test/jpg102.jpg");
    control->enterAlbum(QApplication::applicationDirPath() + "/test/jpg102.jpg");
    control->searchImage(QApplication::applicationDirPath() + "/test/jpg102.jpg");
    control->backToMainWindow();
    control->deleteLater();
    control = nullptr;
}
TEST_F(gtestview, setWallPaper)
{
    QString TriangleItemPath = QApplication::applicationDirPath() + "/test/jpg1.jpg";

    dApp->wpSetter->setWallpaper(TriangleItemPath);

}

TEST_F(gtestview, WallPaperSetting1)
{
    QString path = QApplication::applicationDirPath() + "/test/jpg102.jpg";
//    WallpaperSetter::instance()->setDeepinWallpaper(path);
    WallpaperSetter::instance()->setWallpaper(QImage(QApplication::applicationDirPath() + "/test/jpg120.jpg"));
//    WallpaperSetter::instance()->setKDEWallpaper(path);
//    WallpaperSetter::instance()->setGNOMEShellWallpaper(path);
//    WallpaperSetter::instance()->setGNOMEWallpaper(path);
//    WallpaperSetter::instance()->setLXDEWallpaper(path);
//    WallpaperSetter::instance()->setXfaceWallpaper(path);
//    WallpaperSetter::instance()->testDE(path);
//    WallpaperSetter::instance()->getDE();

    if (!m_frameMainWindow) {
        m_frameMainWindow = CommandLine::instance()->getMainWindow();
    }
    m_frameMainWindow->activateWindow();
}
/*TEST_F(gtestview, collectSubDirs)
{
    DirCollectThread tt(QApplication::applicationDirPath(),"test");
    Importer::instance()->stopDirCollect(QApplication::applicationDirPath());
    tt.setStop(false);
    tt.dir();
//    tt.start();
    FilesCollectThread ct(QStringList(QApplication::applicationDirPath() + "/test/jpg133.jpg"),"");

    ct.currentImport(QApplication::applicationDirPath() + "/test/jpg133.jpg");
    ct.resultReady(DBImgInfoList());
    ct.insertAlbumRequest("",QStringList(QApplication::applicationDirPath() + "/test/jpg133.jpg"));
//    ct.start();
//    tt.wait(2000);
//    ct.wait(2000);
}*/

//CommandLine
TEST_F(gtestview, CommandLine_createOpenImageInfo)
{
    QString str = QApplication::applicationDirPath() + "/test/jpg113.jpg";
    QString jsonStr = CommandLine::instance()->createOpenImageInfo(str, QStringList(str), QDateTime::currentDateTime());
    QStringList list(str);
    CommandLine::instance()->paraOpenImageInfo(jsonStr, str, list);
    CommandLine::instance()->showHelp();
}