Bug 1893388 - add gtest. r=media-playback-reviewers,chunmin

Differential Revision: https://phabricator.services.mozilla.com/D209440
This commit is contained in:
alwu 2024-05-22 18:52:03 +00:00
Родитель 06b2b290e3
Коммит 24dfc84747
2 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,36 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaInfo.h"
#include "gtest/gtest.h"
using namespace mozilla;
TEST(TestMediaInfo, CloneVideoInfo)
{
VideoInfo info;
info.mDisplay = info.mImage = gfx::IntSize{640, 360};
info.mStereoMode = StereoMode::BOTTOM_TOP;
info.mRotation = VideoRotation::kDegree_270;
info.mColorDepth = gfx::ColorDepth::COLOR_16;
info.mColorRange = gfx::ColorRange::FULL;
UniquePtr<TrackInfo> clone1 = info.Clone();
UniquePtr<TrackInfo> clone2 = info.Clone();
auto* info1 = clone1->GetAsVideoInfo();
auto* info2 = clone2->GetAsVideoInfo();
EXPECT_EQ(info1->mDisplay, info2->mDisplay);
EXPECT_EQ(info1->mImage, info2->mImage);
EXPECT_EQ(info1->mStereoMode, info2->mStereoMode);
EXPECT_EQ(info1->mRotation, info2->mRotation);
EXPECT_EQ(info1->mColorDepth, info2->mColorDepth);
EXPECT_EQ(info1->mColorRange, info2->mColorRange);
// They should have their own media byte buffers which have different address
EXPECT_NE(info1->mExtraData.get(), info2->mExtraData.get());
EXPECT_NE(info1->mCodecSpecificConfig.get(),
info2->mCodecSpecificConfig.get());
}

Просмотреть файл

@ -53,6 +53,7 @@ UNIFIED_SOURCES += [
"TestMediaDataDecoder.cpp",
"TestMediaDataEncoder.cpp",
"TestMediaEventSource.cpp",
"TestMediaInfo.cpp",
"TestMediaMIMETypes.cpp",
"TestMediaQueue.cpp",
"TestMediaSpan.cpp",