[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / gfx / geometry / insets_unittest.cc
blobb20a9d36f48bf7402237629fa639d338d4c67ed4
1 // Copyright (c) 2009 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 "ui/gfx/geometry/insets.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 TEST(InsetsTest, InsetsDefault) {
10 gfx::Insets insets;
11 EXPECT_EQ(0, insets.top());
12 EXPECT_EQ(0, insets.left());
13 EXPECT_EQ(0, insets.bottom());
14 EXPECT_EQ(0, insets.right());
15 EXPECT_EQ(0, insets.width());
16 EXPECT_EQ(0, insets.height());
17 EXPECT_TRUE(insets.empty());
20 TEST(InsetsTest, Insets) {
21 gfx::Insets insets(1, 2, 3, 4);
22 EXPECT_EQ(1, insets.top());
23 EXPECT_EQ(2, insets.left());
24 EXPECT_EQ(3, insets.bottom());
25 EXPECT_EQ(4, insets.right());
26 EXPECT_EQ(6, insets.width()); // Left + right.
27 EXPECT_EQ(4, insets.height()); // Top + bottom.
28 EXPECT_FALSE(insets.empty());
31 TEST(InsetsTest, Set) {
32 gfx::Insets insets;
33 insets.Set(1, 2, 3, 4);
34 EXPECT_EQ(1, insets.top());
35 EXPECT_EQ(2, insets.left());
36 EXPECT_EQ(3, insets.bottom());
37 EXPECT_EQ(4, insets.right());
40 TEST(InsetsTest, Add) {
41 gfx::Insets insets;
42 insets.Set(1, 2, 3, 4);
43 insets += gfx::Insets(5, 6, 7, 8);
44 EXPECT_EQ(6, insets.top());
45 EXPECT_EQ(8, insets.left());
46 EXPECT_EQ(10, insets.bottom());
47 EXPECT_EQ(12, insets.right());
50 TEST(InsetsTest, Equality) {
51 gfx::Insets insets1;
52 insets1.Set(1, 2, 3, 4);
53 gfx::Insets insets2;
54 // Test operator== and operator!=.
55 EXPECT_FALSE(insets1 == insets2);
56 EXPECT_TRUE(insets1 != insets2);
58 insets2.Set(1, 2, 3, 4);
59 EXPECT_TRUE(insets1 == insets2);
60 EXPECT_FALSE(insets1 != insets2);
63 TEST(InsetsTest, ToString) {
64 gfx::Insets insets(1, 2, 3, 4);
65 EXPECT_EQ("1,2,3,4", insets.ToString());