OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Incorporated. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-9), LayoutUnit(
1))); | 85 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-9), LayoutUnit(
1))); |
86 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-10), LayoutUnit
())); | 86 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-10), LayoutUnit
())); |
87 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-10), LayoutUnit
(200))); | 87 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-10), LayoutUnit
(200))); |
88 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(5), LayoutUnit(1
0))); | 88 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(5), LayoutUnit(1
0))); |
89 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(59), LayoutUnit(
1))); | 89 EXPECT_TRUE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(59), LayoutUnit(
1))); |
90 | 90 |
91 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-12), LayoutUni
t(2))); | 91 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(-12), LayoutUni
t(2))); |
92 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(60), LayoutUnit
(1))); | 92 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(60), LayoutUnit
(1))); |
93 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(100), LayoutUni
t(200))); | 93 EXPECT_FALSE(shape->lineOverlapsShapeMarginBounds(LayoutUnit(100), LayoutUni
t(200))); |
94 | 94 |
95 TEST_EXCLUDED_INTERVAL(shape, -9, 1, -10, 110); | 95 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-9), LayoutUnit(1), -10, 110); |
96 TEST_EXCLUDED_INTERVAL(shape, -10, 0, -10, 110); | 96 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(0), -10, 110); |
97 TEST_EXCLUDED_INTERVAL(shape, -10, 200, -10, 110); | 97 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(200), -10, 110); |
98 TEST_EXCLUDED_INTERVAL(shape, 5, 10, -10, 110); | 98 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(10), -10, 110); |
99 TEST_EXCLUDED_INTERVAL(shape, 59, 1, -10, 110); | 99 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(59), LayoutUnit(1), -10, 110); |
100 | 100 |
101 TEST_NO_EXCLUDED_INTERVAL(shape, -12, 2); | 101 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(-12), LayoutUnit(2)); |
102 TEST_NO_EXCLUDED_INTERVAL(shape, 60, 1); | 102 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(60), LayoutUnit(1)); |
103 TEST_NO_EXCLUDED_INTERVAL(shape, 100, 200); | 103 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(100), LayoutUnit(200)); |
104 } | 104 } |
105 | 105 |
106 /* BoxShape geometry for this test. Corner radii are in parens, x and y intercep
ts | 106 /* BoxShape geometry for this test. Corner radii are in parens, x and y intercep
ts |
107 * for the elliptical corners are noted. The rectangle itself is at 0,0 with wid
th and height 100. | 107 * for the elliptical corners are noted. The rectangle itself is at 0,0 with wid
th and height 100. |
108 * | 108 * |
109 * (10, 15) x=10 x=90 (10, 20) | 109 * (10, 15) x=10 x=90 (10, 20) |
110 * (--+---------+--) | 110 * (--+---------+--) |
111 * y=15 +--| |-+ y=20 | 111 * y=15 +--| |-+ y=20 |
112 * | | | 112 * | | |
113 * | | | 113 * | | |
114 * y=85 + -| |- + y=70 | 114 * y=85 + -| |- + y=70 |
115 * (--+---------+--) | 115 * (--+---------+--) |
116 * (25, 15) x=25 x=80 (20, 30) | 116 * (25, 15) x=25 x=80 (20, 30) |
117 */ | 117 */ |
118 TEST_F(BoxShapeTest, getIntervals) | 118 TEST_F(BoxShapeTest, getIntervals) |
119 { | 119 { |
120 const FloatRoundedRect::Radii cornerRadii(FloatSize(10, 15), FloatSize(10, 2
0), FloatSize(25, 15), FloatSize(20, 30)); | 120 const FloatRoundedRect::Radii cornerRadii(FloatSize(10, 15), FloatSize(10, 2
0), FloatSize(25, 15), FloatSize(20, 30)); |
121 OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100
), cornerRadii), 0); | 121 OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100
), cornerRadii), 0); |
122 EXPECT_FALSE(shape->isEmpty()); | 122 EXPECT_FALSE(shape->isEmpty()); |
123 | 123 |
124 EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox()
); | 124 EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox()
); |
125 | 125 |
126 TEST_EXCLUDED_INTERVAL(shape, 10, 95, 0, 100); | 126 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(10), LayoutUnit(95), 0, 100); |
127 TEST_EXCLUDED_INTERVAL(shape, 5, 25, 0, 100); | 127 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(25), 0, 100); |
128 TEST_EXCLUDED_INTERVAL(shape, 15, 6, 0, 100); | 128 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(15), LayoutUnit(6), 0, 100); |
129 TEST_EXCLUDED_INTERVAL(shape, 20, 50, 0, 100); | 129 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(20), LayoutUnit(50), 0, 100); |
130 TEST_EXCLUDED_INTERVAL(shape, 69, 5, 0, 100); | 130 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(69), LayoutUnit(5), 0, 100); |
131 TEST_EXCLUDED_INTERVAL(shape, 85, 10, 0, 97.320511f); | 131 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(85), LayoutUnit(10), 0, 97.320511f)
; |
132 } | 132 } |
133 | 133 |
134 } // anonymous namespace | 134 } // anonymous namespace |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
OLD | NEW |