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

Side by Side Diff: app/gfx/insets_unittest.cc

Issue 497004: Add gfx::Insets::ToString(). (Closed)
Patch Set: fix a line break Created 11 years 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 | « app/gfx/insets.cc ('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 // 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.
4
5 #include "app/gfx/insets.h"
6
7 #include <iostream>
8
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 TEST(InsetsTest, InsetsDefault) {
12 gfx::Insets insets;
13 EXPECT_EQ(0, insets.top());
14 EXPECT_EQ(0, insets.left());
15 EXPECT_EQ(0, insets.bottom());
16 EXPECT_EQ(0, insets.right());
17 EXPECT_EQ(0, insets.width());
18 EXPECT_EQ(0, insets.height());
19 EXPECT_TRUE(insets.empty());
20 }
21
22 TEST(InsetsTest, Insets) {
23 gfx::Insets insets(1, 2, 3, 4);
24 EXPECT_EQ(1, insets.top());
25 EXPECT_EQ(2, insets.left());
26 EXPECT_EQ(3, insets.bottom());
27 EXPECT_EQ(4, insets.right());
28 EXPECT_EQ(6, insets.width()); // Left + right.
29 EXPECT_EQ(4, insets.height()); // Top + bottom.
30 EXPECT_FALSE(insets.empty());
31 }
32
33 TEST(InsetsTest, Set) {
34 gfx::Insets insets;
35 insets.Set(1, 2, 3, 4);
36 EXPECT_EQ(1, insets.top());
37 EXPECT_EQ(2, insets.left());
38 EXPECT_EQ(3, insets.bottom());
39 EXPECT_EQ(4, insets.right());
40 }
41
42 TEST(InsetsTest, Add) {
43 gfx::Insets insets;
44 insets.Set(1, 2, 3, 4);
45 insets += gfx::Insets(5, 6, 7, 8);
46 EXPECT_EQ(6, insets.top());
47 EXPECT_EQ(8, insets.left());
48 EXPECT_EQ(10, insets.bottom());
49 EXPECT_EQ(12, insets.right());
50 }
51
52 TEST(InsetsTest, Equality) {
53 gfx::Insets insets1;
54 insets1.Set(1, 2, 3, 4);
55 gfx::Insets insets2;
56 // Test operator== and operator!=.
57 EXPECT_FALSE(insets1 == insets2);
58 EXPECT_TRUE(insets1 != insets2);
59
60 insets2.Set(1, 2, 3, 4);
61 EXPECT_TRUE(insets1 == insets2);
62 EXPECT_FALSE(insets1 != insets2);
63 }
64
65 TEST(InsetsTest, ToString) {
66 gfx::Insets insets(1, 2, 3, 4);
67 EXPECT_EQ("1,2,3,4", insets.ToString());
68 }
OLDNEW
« no previous file with comments | « app/gfx/insets.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698