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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 EXPECT_FLOAT_EQ(expectedRight, segment.logicalRight); \ | 58 EXPECT_FLOAT_EQ(expectedRight, segment.logicalRight); \ |
59 } \ | 59 } \ |
60 } | 60 } |
61 | 61 |
62 #define TEST_NO_EXCLUDED_INTERVAL(shapePtr, lineTop, lineHeight) \ | 62 #define TEST_NO_EXCLUDED_INTERVAL(shapePtr, lineTop, lineHeight) \ |
63 { \ | 63 { \ |
64 LineSegment segment = shapePtr->getExcludedInterval(lineTop, lineHeight); \ | 64 LineSegment segment = shapePtr->getExcludedInterval(lineTop, lineHeight); \ |
65 EXPECT_FALSE(segment.isValid); \ | 65 EXPECT_FALSE(segment.isValid); \ |
66 } | 66 } |
67 | 67 |
68 /* The BoxShape is based on a 100x50 rectangle at 0,0. The shape-margin value is
10, | 68 /* The BoxShape is based on a 100x50 rectangle at 0,0. The shape-margin value is |
69 * so the shapeMarginBoundingBox rectangle is 120x70 at -10,-10: | 69 * 10, so the shapeMarginBoundingBox rectangle is 120x70 at -10,-10: |
70 * | 70 * |
71 * -10,-10 110,-10 | 71 * -10,-10 110,-10 |
72 * +--------+ | 72 * +--------+ |
73 * | | | 73 * | | |
74 * +--------+ | 74 * +--------+ |
75 * -10,60 60,60 | 75 * -10,60 60,60 |
76 */ | 76 */ |
77 TEST_F(BoxShapeTest, zeroRadii) { | 77 TEST_F(BoxShapeTest, zeroRadii) { |
78 std::unique_ptr<Shape> shape = | 78 std::unique_ptr<Shape> shape = |
79 createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); | 79 createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); |
(...skipping 28 matching lines...) Expand all Loading... |
108 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(), -10, 110); | 108 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(), -10, 110); |
109 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(200), -10, 110); | 109 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(-10), LayoutUnit(200), -10, 110); |
110 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(10), -10, 110); | 110 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(10), -10, 110); |
111 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(59), LayoutUnit(1), -10, 110); | 111 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(59), LayoutUnit(1), -10, 110); |
112 | 112 |
113 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(-12), LayoutUnit(2)); | 113 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(-12), LayoutUnit(2)); |
114 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(60), LayoutUnit(1)); | 114 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(60), LayoutUnit(1)); |
115 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(100), LayoutUnit(200)); | 115 TEST_NO_EXCLUDED_INTERVAL(shape, LayoutUnit(100), LayoutUnit(200)); |
116 } | 116 } |
117 | 117 |
118 /* BoxShape geometry for this test. Corner radii are in parens, x and y intercep
ts | 118 /* BoxShape geometry for this test. Corner radii are in parens, x and y |
119 * for the elliptical corners are noted. The rectangle itself is at 0,0 with wid
th and height 100. | 119 * intercepts for the elliptical corners are noted. The rectangle itself is at |
| 120 * 0,0 with width and height 100. |
120 * | 121 * |
121 * (10, 15) x=10 x=90 (10, 20) | 122 * (10, 15) x=10 x=90 (10, 20) |
122 * (--+---------+--) | 123 * (--+---------+--) |
123 * y=15 +--| |-+ y=20 | 124 * y=15 +--| |-+ y=20 |
124 * | | | 125 * | | |
125 * | | | 126 * | | |
126 * y=85 + -| |- + y=70 | 127 * y=85 + -| |- + y=70 |
127 * (--+---------+--) | 128 * (--+---------+--) |
128 * (25, 15) x=25 x=80 (20, 30) | 129 * (25, 15) x=25 x=80 (20, 30) |
129 */ | 130 */ |
(...skipping 11 matching lines...) Expand all Loading... |
141 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(25), 0, 100); | 142 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(5), LayoutUnit(25), 0, 100); |
142 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(15), LayoutUnit(6), 0, 100); | 143 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(15), LayoutUnit(6), 0, 100); |
143 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(20), LayoutUnit(50), 0, 100); | 144 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(20), LayoutUnit(50), 0, 100); |
144 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(69), LayoutUnit(5), 0, 100); | 145 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(69), LayoutUnit(5), 0, 100); |
145 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(85), LayoutUnit(10), 0, 97.320511f); | 146 TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(85), LayoutUnit(10), 0, 97.320511f); |
146 } | 147 } |
147 | 148 |
148 } // anonymous namespace | 149 } // anonymous namespace |
149 | 150 |
150 } // namespace blink | 151 } // namespace blink |
OLD | NEW |