-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add initFFmpegVideoThumbnailer unit test.
完善 initFFmpegVideoThumbnailer() ,添加备用的查找库方式 和提示信息。在 QLibrary 无法查找时尝试使用手动查找方式取得 其它版本的 libffmpegthumbnailer.so 动态库。 Log: 补充适配缩略图查找方式和UT Bug: https://pms.uniontech.com/bug-view-213565.html Bug: https://pms.uniontech.com/bug-view-221557.html Influence: VideoThumbnailer Change-Id: Id33c13f1c5d9b4c6ecaada2ae50e714f2d40a3d6
- Loading branch information
Showing
4 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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/abc-123.jpg"); | ||
image = runFFmpegVideoThumbnailer(QUrl::fromLocalFile(localFile)); | ||
bool exceptExists = QFile::exists(localFile) && foundLib; | ||
ASSERT_EQ(exceptExists, !image.isNull()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters