forked from linuxdeepin/image-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ffmpegvideothumbnailer.cpp
More file actions
44 lines (34 loc) · 1.2 KB
/
test_ffmpegvideothumbnailer.cpp
File metadata and controls
44 lines (34 loc) · 1.2 KB
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
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include <QtTest/QtTest>
#include <gtest/gtest.h>
#include "service/ffmpegvideothumbnailer.h"
class ut_ffmpegvideothumbnailer : public testing::Test
{
public:
void SetUp() override;
void TearDown() override;
bool foundLib = false;
};
void ut_ffmpegvideothumbnailer::SetUp()
{
QString path = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
QStringList libList = QDir(path).entryList({"libffmpegthumbnailer.so*"}, QDir::NoDotAndDotDot | QDir::Files);
foundLib = !libList.isEmpty();
}
void ut_ffmpegvideothumbnailer::TearDown() {}
TEST_F(ut_ffmpegvideothumbnailer, initFFmpegVideoThumbnailer)
{
bool ret = initFFmpegVideoThumbnailer();
ASSERT_EQ(ret, foundLib);
}
TEST_F(ut_ffmpegvideothumbnailer, runFFmpegVideoThumbnailer)
{
QImage image = runFFmpegVideoThumbnailer(QUrl());
ASSERT_TRUE(image.isNull());
QString localFile("/usr/share/wallpapers/deepin/desktop.jpg");
image = runFFmpegVideoThumbnailer(QUrl::fromLocalFile(localFile));
bool exceptExists = QFile::exists(localFile) && foundLib;
ASSERT_EQ(exceptExists, !image.isNull());
}