Skip to content

Commit

Permalink
Make top and left a multiple of 2 for testing clip.
Browse files Browse the repository at this point in the history
BUG=327872,306876
TEST=valgrind out/Debug/remoting_unittests --single-process-tests --gtest_filter=*Rgb*
R=sergeyu@chromium.org

Review URL: https://codereview.chromium.org/103533005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240269 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
fbarchard@chromium.org committed Dec 12, 2013
1 parent de5763f commit 1b8ab39
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions remoting/base/util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ TEST(YuvToRgbTest, Clipping) {
webrtc::DesktopSize dest_size = webrtc::DesktopSize(kWidth, kHeight);
webrtc::DesktopRect rect =
webrtc::DesktopRect::MakeLTRB(0, 0, kWidth - 1, kHeight - 1);
// TODO(fbarchard): Allow top/left clipping to odd boundary.
for (int i = 0; i < 16; ++i) {
webrtc::DesktopRect dest_rect = webrtc::DesktopRect::MakeLTRB(
rect.left() + ((i & 1) ? 1 : 0),
rect.top() + ((i & 2) ? 1 : 0),
rect.right() + ((i & 4) ? 1 : 0),
rect.bottom() + ((i & 8) ? 1 : 0));
rect.left() + ((i & 1) ? 2 : 0),
rect.top() + ((i & 2) ? 2 : 0),
rect.right() - ((i & 4) ? 1 : 0),
rect.bottom() - ((i & 8) ? 1 : 0));

tester.RunTest(dest_size, dest_rect);
}
Expand All @@ -169,13 +170,13 @@ TEST(YuvToRgbTest, ClippingAndScaling) {
webrtc::DesktopSize dest_size =
webrtc::DesktopSize(kWidth - 10, kHeight - 10);
webrtc::DesktopRect rect =
webrtc::DesktopRect::MakeLTRB(5, 5, kWidth - 11, kHeight - 11);
webrtc::DesktopRect::MakeLTRB(6, 6, kWidth - 11, kHeight - 11);
for (int i = 0; i < 16; ++i) {
webrtc::DesktopRect dest_rect = webrtc::DesktopRect::MakeLTRB(
rect.left() + ((i & 1) ? 1 : 0),
rect.top() + ((i & 2) ? 1 : 0),
rect.right() + ((i & 4) ? 1 : 0),
rect.bottom() + ((i & 8) ? 1 : 0));
rect.left() + ((i & 1) ? 2 : 0),
rect.top() + ((i & 2) ? 2 : 0),
rect.right() - ((i & 4) ? 1 : 0),
rect.bottom() - ((i & 8) ? 1 : 0));

tester.RunTest(dest_size, dest_rect);
}
Expand Down

0 comments on commit 1b8ab39

Please sign in to comment.