File: test_module_slideshow.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 (169 lines) | stat: -rw-r--r-- 5,335 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 * 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"
#define protected public
#define private public
//#include "module/slideshow/slideeffectplayer.h"
//#include "module/slideshow/slideeffect.h"
//#include "module/slideshow/slideshowbottombar.h"
#include "module/view/scen/imageview.h"
TEST_F(gtestview, Sslideshowpanel1)
{
    SlideShowPanel *panel = new SlideShowPanel();
    emit dApp->signalM->sigESCKeyStopSlide();
//     panel->backToLastPanel();
    DBImgInfoList list;
    DBImgInfo info;
    info.format = "png";
    info.fileName = QApplication::applicationDirPath() + "/test/jpg100.jpg";
    info.filePath = QApplication::applicationDirPath() + "/test/jpg100.jpg";
    list.push_back(info);
    //panel->Receiveslideshowpathlst(true,list);

    QMenu *m_menu = new QMenu();

    QAction *action = new QAction(m_menu);
    action->setProperty("MenuID", 5);
    action->trigger();

    QAction *action1 = new QAction(m_menu);
    action1->setProperty("MenuID", SlideShowPanel::IdPlayOrPause);
    action1->trigger();

    QAction *action2 = new QAction(m_menu);
    action2->setProperty("MenuID", SlideShowPanel::IdStopslideshow);
    action2->trigger();
    panel->onMenuItemClicked(action);
//    panel->onMenuItemClicked(action1);
//    panel->onMenuItemClicked(action2);
    delete m_menu;
    m_menu = nullptr;

//    panel->getFitImage(QApplication::applicationDirPath() + "/test/jpg33.jpg");
    panel->onThemeChanged(ViewerThemeManager::Dark);
    panel->onThemeChanged(ViewerThemeManager::Light);

    QTest::mouseMove(panel, QPoint(1000, 1075), 500);
    QTest::mouseMove(panel, QPoint(200, 500), 500);

    delete panel;
    panel = nullptr;
}

//TEST_F(gtestview, SlideEffectPlayer_1)
//{
//    SlideEffectPlayer *player = new SlideEffectPlayer();
//    emit dApp->signalM->sigStartTimer();
//    emit dApp->signalM->updateButton();
//    QStringList list;
//    player->setFrameSize(200, 200);
//    list.push_back(QApplication::applicationDirPath() + "/test/jpg100.jpg");
//    list.push_back(QApplication::applicationDirPath() + "/test/jpg101.jpg");
//    list.push_back(QApplication::applicationDirPath() + "/test/jpg102.jpg");
//    list.push_back(QApplication::applicationDirPath() + "/test/jpg103.jpg");
//    list.push_back(QApplication::applicationDirPath() + "/test/jpg104.jpg");
//    player->SetfirstlastThunbnailpath(QApplication::applicationDirPath() + "/test/jpg100.jpg", QApplication::applicationDirPath() + "/test/jpg101.jpg");
//    player->isRunning();
//    player->setImagePaths(QStringList(QApplication::applicationDirPath() + "/test/jpg100.jpg"));
//    player->start();
//    player->startNext();
//    player->cacheNext();
//    player->GetPathList();

//    player->cachePrevious();
//    player->startPrevious();
//    player->pause();
//    player->stop();
//    player->deleteLater();
//    player = nullptr;

//}

//TEST_F(gtestview, SlideEffect_Circle_1)
//{
//    SlideEffect *m_effect = SlideEffect::create("");

////    m_effect->prepare();

////    m_effect->resizeImages();

//    delete m_effect;
//    m_effect = nullptr;
//}


//SlideShowBottomBar


TEST_F(gtestview, SlideShowBottomBar1)
{

    SlideShowBottomBar *bottom = new SlideShowBottomBar();
    bottom->m_preButton->click();
    bottom->m_nextButton->click();
    bottom->m_playpauseButton->click();
    bottom->m_playpauseButton->click();
    bottom->m_cancelButton->click();

    emit bottom->showPrevious();
    emit bottom->showPause();
    emit bottom->showNext();
    emit bottom->showCancel();

    bottom->deleteLater();
    bottom = nullptr;

}
TEST_F(gtestview, ImageAnimation)
{
    ImageAnimation *animation = new ImageAnimation();
    QString path1 = QApplication::applicationDirPath() + "/test/jpg188.jpg";
    QString path2 = QApplication::applicationDirPath() + "/test/jpg189.jpg";

    QStringList list ;
    list << path1;
    list << path2;

    animation->startSlideShow(path1, list);
    animation->setPaintTarget(ImageAnimation::KeepStatic);
    QTest::qWait(1000);
    animation->playAndNext();

    animation->setPaintTarget(ImageAnimation::EffectPlay);
    QTest::qWait(1000);
    animation->playAndPre();
    animation->pauseAndNext();

    animation->setPaintTarget(ImageAnimation::SkipToNext);
    QTest::qWait(1000);
    animation->ifPauseAndContinue();
    animation->currentPath();

    animation->setPaintTarget(ImageAnimation::TurnBackPre);
    QTest::qWait(1000);
    animation->getCurScreenGeometry();
    animation->endSlider();

    animation->deleteLater();
    animation = nullptr;
}