OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 void CopyIsRef() { | 1799 void CopyIsRef() { |
1800 std::unique_ptr<T> source(new T); | 1800 std::unique_ptr<T> source(new T); |
1801 std::unique_ptr<const cricket::VideoFrame> target; | 1801 std::unique_ptr<const cricket::VideoFrame> target; |
1802 ASSERT_TRUE(LoadFrameNoRepeat(source.get())); | 1802 ASSERT_TRUE(LoadFrameNoRepeat(source.get())); |
1803 target.reset(source->Copy()); | 1803 target.reset(source->Copy()); |
1804 EXPECT_TRUE(IsEqual(*source, *target, 0)); | 1804 EXPECT_TRUE(IsEqual(*source, *target, 0)); |
1805 const T* const_source = source.get(); | 1805 const T* const_source = source.get(); |
1806 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer()); | 1806 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer()); |
1807 } | 1807 } |
1808 | 1808 |
1809 void StretchToFrame() { | |
1810 // Create the source frame as a black frame. | |
1811 T source; | |
1812 EXPECT_TRUE(source.InitToBlack(kWidth * 2, kHeight * 2, 0)); | |
1813 EXPECT_TRUE(IsSize(source, kWidth * 2, kHeight * 2)); | |
1814 | |
1815 // Create the target frame by loading from a file. | |
1816 T target1; | |
1817 ASSERT_TRUE(LoadFrameNoRepeat(&target1)); | |
1818 EXPECT_FALSE(IsBlack(target1)); | |
1819 | |
1820 // Stretch and check if the stretched target is black. | |
1821 source.StretchToFrame(&target1, true, false); | |
1822 EXPECT_TRUE(IsBlack(target1)); | |
1823 | |
1824 // Crop and stretch and check if the stretched target is black. | |
1825 T target2; | |
1826 ASSERT_TRUE(LoadFrameNoRepeat(&target2)); | |
1827 source.StretchToFrame(&target2, true, true); | |
1828 EXPECT_TRUE(IsBlack(target2)); | |
1829 EXPECT_EQ(source.GetTimeStamp(), target2.GetTimeStamp()); | |
1830 } | |
1831 | |
1832 int repeat_; | 1809 int repeat_; |
1833 }; | 1810 }; |
1834 | 1811 |
1835 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ | 1812 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ |
OLD | NEW |