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
3 // found in the LICENSE file.
5 #include "base/basictypes.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gfx/geometry/insets.h"
8 #include "ui/gfx/shadow_value.h"
12 TEST(ShadowValueTest
, GetMargin
) {
13 const struct TestCase
{
14 Insets expected_margin
;
16 ShadowValue shadows
[2];
22 Insets(-2, -2, -2, -2),
24 { ShadowValue(gfx::Point(0, 0), 4, 0), },
27 Insets(0, -1, -4, -3),
29 { ShadowValue(gfx::Point(1, 2), 4, 0), },
32 Insets(-4, -3, 0, -1),
34 { ShadowValue(gfx::Point(-1, -2), 4, 0), },
37 Insets(0, -1, -5, -4),
40 ShadowValue(gfx::Point(1, 2), 4, 0),
41 ShadowValue(gfx::Point(2, 3), 4, 0),
45 Insets(-4, -3, -5, -4),
48 ShadowValue(gfx::Point(-1, -2), 4, 0),
49 ShadowValue(gfx::Point(2, 3), 4, 0),
54 for (size_t i
= 0; i
< arraysize(kTestCases
); ++i
) {
55 Insets margin
= ShadowValue::GetMargin(
56 ShadowValues(kTestCases
[i
].shadows
,
57 kTestCases
[i
].shadows
+ kTestCases
[i
].shadow_count
));
59 EXPECT_EQ(kTestCases
[i
].expected_margin
, margin
) << " i=" << i
;