TestMediaInfo.cpp (1409B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "MediaInfo.h" 8 #include "gtest/gtest.h" 9 10 using namespace mozilla; 11 12 TEST(TestMediaInfo, CloneVideoInfo) 13 { 14 VideoInfo info; 15 info.mDisplay = info.mImage = gfx::IntSize{640, 360}; 16 info.mStereoMode = StereoMode::BOTTOM_TOP; 17 info.mRotation = VideoRotation::kDegree_270; 18 info.mColorDepth = gfx::ColorDepth::COLOR_16; 19 info.mColorRange = gfx::ColorRange::FULL; 20 21 UniquePtr<TrackInfo> clone1 = info.Clone(); 22 UniquePtr<TrackInfo> clone2 = info.Clone(); 23 24 auto* info1 = clone1->GetAsVideoInfo(); 25 auto* info2 = clone2->GetAsVideoInfo(); 26 27 EXPECT_EQ(info1->mDisplay, info2->mDisplay); 28 EXPECT_EQ(info1->mImage, info2->mImage); 29 EXPECT_EQ(info1->mStereoMode, info2->mStereoMode); 30 EXPECT_EQ(info1->mRotation, info2->mRotation); 31 EXPECT_EQ(info1->mColorDepth, info2->mColorDepth); 32 EXPECT_EQ(info1->mColorRange, info2->mColorRange); 33 // They should have their own media byte buffers which have different address 34 EXPECT_NE(info1->mExtraData.get(), info2->mExtraData.get()); 35 EXPECT_NE(info1->mCodecSpecificConfig.get(), 36 info2->mCodecSpecificConfig.get()); 37 }