OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 namespace { | 37 namespace { |
38 | 38 |
39 LayoutRect InitialLayoutOverflow() { | 39 LayoutRect InitialLayoutOverflow() { |
40 return LayoutRect(10, 10, 80, 80); | 40 return LayoutRect(10, 10, 80, 80); |
41 } | 41 } |
42 | 42 |
43 LayoutRect InitialVisualOverflow() { | 43 LayoutRect InitialVisualOverflow() { |
44 return LayoutRect(0, 0, 100, 100); | 44 return LayoutRect(0, 0, 100, 100); |
45 } | 45 } |
46 | 46 |
47 class SimpleOverflowModelTest : public testing::Test { | 47 class SimpleOverflowModelTest : public ::testing::Test { |
48 protected: | 48 protected: |
49 SimpleOverflowModelTest() | 49 SimpleOverflowModelTest() |
50 : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {} | 50 : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {} |
51 SimpleOverflowModel overflow_; | 51 SimpleOverflowModel overflow_; |
52 }; | 52 }; |
53 | 53 |
54 TEST_F(SimpleOverflowModelTest, InitialOverflowRects) { | 54 TEST_F(SimpleOverflowModelTest, InitialOverflowRects) { |
55 EXPECT_EQ(InitialLayoutOverflow(), overflow_.LayoutOverflowRect()); | 55 EXPECT_EQ(InitialLayoutOverflow(), overflow_.LayoutOverflowRect()); |
56 EXPECT_EQ(InitialVisualOverflow(), overflow_.VisualOverflowRect()); | 56 EXPECT_EQ(InitialVisualOverflow(), overflow_.VisualOverflowRect()); |
57 } | 57 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 TEST_F(SimpleOverflowModelTest, MoveAffectsLayoutOverflow) { | 104 TEST_F(SimpleOverflowModelTest, MoveAffectsLayoutOverflow) { |
105 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); | 105 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); |
106 EXPECT_EQ(LayoutRect(510, 110, 80, 80), overflow_.LayoutOverflowRect()); | 106 EXPECT_EQ(LayoutRect(510, 110, 80, 80), overflow_.LayoutOverflowRect()); |
107 } | 107 } |
108 | 108 |
109 TEST_F(SimpleOverflowModelTest, MoveAffectsVisualOverflow) { | 109 TEST_F(SimpleOverflowModelTest, MoveAffectsVisualOverflow) { |
110 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); | 110 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); |
111 EXPECT_EQ(LayoutRect(500, 100, 100, 100), overflow_.VisualOverflowRect()); | 111 EXPECT_EQ(LayoutRect(500, 100, 100, 100), overflow_.VisualOverflowRect()); |
112 } | 112 } |
113 | 113 |
114 class BoxOverflowModelTest : public testing::Test { | 114 class BoxOverflowModelTest : public ::testing::Test { |
115 protected: | 115 protected: |
116 BoxOverflowModelTest() | 116 BoxOverflowModelTest() |
117 : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {} | 117 : overflow_(InitialLayoutOverflow(), InitialVisualOverflow()) {} |
118 BoxOverflowModel overflow_; | 118 BoxOverflowModel overflow_; |
119 }; | 119 }; |
120 | 120 |
121 TEST_F(BoxOverflowModelTest, InitialOverflowRects) { | 121 TEST_F(BoxOverflowModelTest, InitialOverflowRects) { |
122 EXPECT_EQ(InitialLayoutOverflow(), overflow_.LayoutOverflowRect()); | 122 EXPECT_EQ(InitialLayoutOverflow(), overflow_.LayoutOverflowRect()); |
123 EXPECT_EQ(InitialVisualOverflow(), overflow_.SelfVisualOverflowRect()); | 123 EXPECT_EQ(InitialVisualOverflow(), overflow_.SelfVisualOverflowRect()); |
124 EXPECT_TRUE(overflow_.ContentsVisualOverflowRect().IsEmpty()); | 124 EXPECT_TRUE(overflow_.ContentsVisualOverflowRect().IsEmpty()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 TEST_F(BoxOverflowModelTest, MoveAffectsContentsVisualOverflow) { | 217 TEST_F(BoxOverflowModelTest, MoveAffectsContentsVisualOverflow) { |
218 overflow_.AddContentsVisualOverflow(LayoutRect(0, 0, 10, 10)); | 218 overflow_.AddContentsVisualOverflow(LayoutRect(0, 0, 10, 10)); |
219 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); | 219 overflow_.Move(LayoutUnit(500), LayoutUnit(100)); |
220 EXPECT_EQ(LayoutRect(500, 100, 10, 10), | 220 EXPECT_EQ(LayoutRect(500, 100, 10, 10), |
221 overflow_.ContentsVisualOverflowRect()); | 221 overflow_.ContentsVisualOverflowRect()); |
222 } | 222 } |
223 | 223 |
224 } // anonymous namespace | 224 } // anonymous namespace |
225 } // namespace blink | 225 } // namespace blink |
OLD | NEW |