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 12 matching lines...) Expand all Loading... | |
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "platform/geometry/FloatRoundedRect.h" | 30 #include "platform/geometry/FloatRoundedRect.h" |
31 | 31 |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 #include "wtf/text/WTFString.h" | |
wkorman
2016/08/19 22:18:44
Same re: Forward.h
| |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 #define TEST_INTERCEPTS(roundedRect, yCoordinate, expectedMinXIntercept, expecte dMaxXIntercept) \ | 37 #define TEST_INTERCEPTS(roundedRect, yCoordinate, expectedMinXIntercept, expecte dMaxXIntercept) \ |
37 { \ | 38 { \ |
38 float minXIntercept; \ | 39 float minXIntercept; \ |
39 float maxXIntercept; \ | 40 float maxXIntercept; \ |
40 EXPECT_TRUE(roundedRect.xInterceptsAtY(yCoordinate, minXIntercept, maxXInter cept)); \ | 41 EXPECT_TRUE(roundedRect.xInterceptsAtY(yCoordinate, minXIntercept, maxXInter cept)); \ |
41 EXPECT_FLOAT_EQ(expectedMinXIntercept, minXIntercept); \ | 42 EXPECT_FLOAT_EQ(expectedMinXIntercept, minXIntercept); \ |
42 EXPECT_FLOAT_EQ(expectedMaxXIntercept, maxXIntercept); \ | 43 EXPECT_FLOAT_EQ(expectedMaxXIntercept, maxXIntercept); \ |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 FloatRect collapsedRect(0, 0, 100, 50); | 167 FloatRect collapsedRect(0, 0, 100, 50); |
167 collapsedRect.expand(FloatRectOutsets(-200, -200, -200, -200)); | 168 collapsedRect.expand(FloatRectOutsets(-200, -200, -200, -200)); |
168 FloatRoundedRect r1(collapsedRect); | 169 FloatRoundedRect r1(collapsedRect); |
169 EXPECT_TRUE(r1.radiusCenterRect().isEmpty()); | 170 EXPECT_TRUE(r1.radiusCenterRect().isEmpty()); |
170 | 171 |
171 FloatRoundedRect::Radii radiiWithTooLargeCorner(FloatSize(55, 55), FloatSize (), FloatSize(), FloatSize()); | 172 FloatRoundedRect::Radii radiiWithTooLargeCorner(FloatSize(55, 55), FloatSize (), FloatSize(), FloatSize()); |
172 FloatRoundedRect r2(FloatRect(0, 0, 100, 50), radiiWithTooLargeCorner); | 173 FloatRoundedRect r2(FloatRect(0, 0, 100, 50), radiiWithTooLargeCorner); |
173 EXPECT_TRUE(r2.radiusCenterRect().isEmpty()); | 174 EXPECT_TRUE(r2.radiusCenterRect().isEmpty()); |
174 } | 175 } |
175 | 176 |
177 TEST(FloatRoundedRectTest, ToString) | |
178 { | |
179 FloatSize cornerRect(1, 2); | |
180 FloatRoundedRect roundedRect(FloatRect(3, 5, 7, 11), FloatRoundedRect::Radii (cornerRect, cornerRect, cornerRect, cornerRect)); | |
181 EXPECT_EQ(String("3,5 7x11 radii:(tl:1x2; tr:1x2; bl:1x2; br:1x2)"), rounded Rect.toString()); | |
182 } | |
183 | |
176 } // namespace blink | 184 } // namespace blink |
177 | 185 |
OLD | NEW |