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

Side by Side Diff: ui/gfx/shadow_value_unittest.cc

Issue 884653003: gfx::ShadowValue: offset is a Vector2d, not Point. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile on Windows. Created 5 years, 10 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 | « ui/gfx/shadow_value.cc ('k') | ui/message_center/views/message_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/geometry/insets.h" 7 #include "ui/gfx/geometry/insets.h"
8 #include "ui/gfx/geometry/vector2d.h"
8 #include "ui/gfx/shadow_value.h" 9 #include "ui/gfx/shadow_value.h"
9 10
10 namespace gfx { 11 namespace gfx {
11 12
12 TEST(ShadowValueTest, GetMargin) { 13 TEST(ShadowValueTest, GetMargin) {
13 const struct TestCase { 14 const struct TestCase {
14 Insets expected_margin; 15 Insets expected_margin;
15 size_t shadow_count; 16 size_t shadow_count;
16 ShadowValue shadows[2]; 17 ShadowValue shadows[2];
17 } kTestCases[] = { 18 } kTestCases[] = {
18 {
19 Insets(), 0, {},
20 },
21 {
22 Insets(-2, -2, -2, -2),
23 1,
24 { ShadowValue(gfx::Point(0, 0), 4, 0), },
25 },
26 {
27 Insets(0, -1, -4, -3),
28 1,
29 { ShadowValue(gfx::Point(1, 2), 4, 0), },
30 },
31 {
32 Insets(-4, -3, 0, -1),
33 1,
34 { ShadowValue(gfx::Point(-1, -2), 4, 0), },
35 },
36 {
37 Insets(0, -1, -5, -4),
38 2,
39 { 19 {
40 ShadowValue(gfx::Point(1, 2), 4, 0), 20 Insets(), 0, {},
danakj 2015/02/24 17:26:55 This indenting looks weird, did git cl format do t
Matt Giuca 2015/02/24 23:04:21 It did. I don't know why it likes 1-space indents
danakj 2015/02/24 23:07:17 Accept it and file a bug please.
Matt Giuca 2015/02/25 04:34:41 Done. (b/19503635) I'm not sure why you want me t
danakj 2015/02/25 19:04:24 Well, because otherwise other people who touch the
Matt Giuca 2015/02/26 03:19:19 OK done. (I think it's especially good to not be d
41 ShadowValue(gfx::Point(2, 3), 4, 0),
42 }, 21 },
43 },
44 {
45 Insets(-4, -3, -5, -4),
46 2,
47 { 22 {
48 ShadowValue(gfx::Point(-1, -2), 4, 0), 23 Insets(-2, -2, -2, -2),
49 ShadowValue(gfx::Point(2, 3), 4, 0), 24 1,
25 {
26 ShadowValue(gfx::Vector2d(0, 0), 4, 0),
27 },
50 }, 28 },
51 }, 29 {
30 Insets(0, -1, -4, -3),
31 1,
32 {
33 ShadowValue(gfx::Vector2d(1, 2), 4, 0),
34 },
35 },
36 {
37 Insets(-4, -3, 0, -1),
38 1,
39 {
40 ShadowValue(gfx::Vector2d(-1, -2), 4, 0),
41 },
42 },
43 {
44 Insets(0, -1, -5, -4),
45 2,
46 {
47 ShadowValue(gfx::Vector2d(1, 2), 4, 0),
48 ShadowValue(gfx::Vector2d(2, 3), 4, 0),
49 },
50 },
51 {
52 Insets(-4, -3, -5, -4),
53 2,
54 {
55 ShadowValue(gfx::Vector2d(-1, -2), 4, 0),
56 ShadowValue(gfx::Vector2d(2, 3), 4, 0),
57 },
58 },
52 }; 59 };
53 60
54 for (size_t i = 0; i < arraysize(kTestCases); ++i) { 61 for (size_t i = 0; i < arraysize(kTestCases); ++i) {
55 Insets margin = ShadowValue::GetMargin( 62 Insets margin = ShadowValue::GetMargin(
56 ShadowValues(kTestCases[i].shadows, 63 ShadowValues(kTestCases[i].shadows,
57 kTestCases[i].shadows + kTestCases[i].shadow_count)); 64 kTestCases[i].shadows + kTestCases[i].shadow_count));
58 65
59 EXPECT_EQ(kTestCases[i].expected_margin, margin) << " i=" << i; 66 EXPECT_EQ(kTestCases[i].expected_margin, margin) << " i=" << i;
60 } 67 }
61 } 68 }
62 69
63 } // namespace gfx 70 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/shadow_value.cc ('k') | ui/message_center/views/message_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698