Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: webrtc/modules/desktop_capture/desktop_geometry_unittest.cc

Issue 2891593003: Add DesktopRectTest for UnionWith() function (Closed)
Patch Set: Resolve review comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/desktop_capture/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
12
13 #include "webrtc/test/gtest.h"
14
15 namespace webrtc {
16
17 TEST(DesktopRectTest, UnionBetweenTwoNonEmptyRects) {
18 DesktopRect rect = DesktopRect::MakeLTRB(1, 1, 2, 2);
19 rect.UnionWith(DesktopRect::MakeLTRB(-2, -2, -1, -1));
20 ASSERT_TRUE(rect.equals(DesktopRect::MakeLTRB(-2, -2, 2, 2)));
21 }
22
23 TEST(DesktopRectTest, UnionWithEmptyRect) {
24 DesktopRect rect = DesktopRect::MakeWH(1, 1);
25 rect.UnionWith(DesktopRect());
26 ASSERT_TRUE(rect.equals(DesktopRect::MakeWH(1, 1)));
27
28 rect = DesktopRect::MakeXYWH(1, 1, 2, 2);
29 rect.UnionWith(DesktopRect());
30 ASSERT_TRUE(rect.equals(DesktopRect::MakeXYWH(1, 1, 2, 2)));
31
32 rect = DesktopRect::MakeXYWH(1, 1, 2, 2);
33 rect.UnionWith(DesktopRect::MakeXYWH(3, 3, 0, 0));
34 ASSERT_TRUE(rect.equals(DesktopRect::MakeXYWH(1, 1, 2, 2)));
35 }
36
37 TEST(DesktopRectTest, EmptyRectUnionWithNonEmptyOne) {
38 DesktopRect rect;
39 rect.UnionWith(DesktopRect::MakeWH(1, 1));
40 ASSERT_TRUE(rect.equals(DesktopRect::MakeWH(1, 1)));
41
42 rect = DesktopRect();
43 rect.UnionWith(DesktopRect::MakeXYWH(1, 1, 2, 2));
44 ASSERT_TRUE(rect.equals(DesktopRect::MakeXYWH(1, 1, 2, 2)));
45
46 rect = DesktopRect::MakeXYWH(3, 3, 0, 0);
47 rect.UnionWith(DesktopRect::MakeXYWH(1, 1, 2, 2));
48 ASSERT_TRUE(rect.equals(DesktopRect::MakeXYWH(1, 1, 2, 2)));
49 }
50
51 TEST(DesktopRectTest, EmptyRectUnionWithEmptyOne) {
52 DesktopRect rect;
53 rect.UnionWith(DesktopRect());
54 ASSERT_TRUE(rect.is_empty());
55
56 rect = DesktopRect::MakeXYWH(1, 1, 0, 0);
57 rect.UnionWith(DesktopRect());
58 ASSERT_TRUE(rect.is_empty());
59
60 rect = DesktopRect();
61 rect.UnionWith(DesktopRect::MakeXYWH(1, 1, 0, 0));
62 ASSERT_TRUE(rect.is_empty());
63
64 rect = DesktopRect::MakeXYWH(1, 1, 0, 0);
65 rect.UnionWith(DesktopRect::MakeXYWH(-1, -1, 0, 0));
66 ASSERT_TRUE(rect.is_empty());
67 }
68
69 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698