| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 TEST_INTERCEPTS(r, 2, r.rect().x(), r.rect().maxX()); | 65 TEST_INTERCEPTS(r, 2, r.rect().x(), r.rect().maxX()); |
| 66 TEST_INTERCEPTS(r, 4, r.rect().x(), r.rect().maxX()); | 66 TEST_INTERCEPTS(r, 4, r.rect().x(), r.rect().maxX()); |
| 67 TEST_INTERCEPTS(r, 6, r.rect().x(), r.rect().maxX()); | 67 TEST_INTERCEPTS(r, 6, r.rect().x(), r.rect().maxX()); |
| 68 | 68 |
| 69 float minXIntercept; | 69 float minXIntercept; |
| 70 float maxXIntercept; | 70 float maxXIntercept; |
| 71 | 71 |
| 72 EXPECT_FALSE(r.xInterceptsAtY(1, minXIntercept, maxXIntercept)); | 72 EXPECT_FALSE(r.xInterceptsAtY(1, minXIntercept, maxXIntercept)); |
| 73 EXPECT_FALSE(r.xInterceptsAtY(7, minXIntercept, maxXIntercept)); | 73 EXPECT_FALSE(r.xInterceptsAtY(7, minXIntercept, maxXIntercept)); |
| 74 | 74 |
| 75 // The FloatRoundedRect::expandRadii() function doesn't change radii FloatSize
s that | 75 // The FloatRoundedRect::expandRadii() function doesn't change radii |
| 76 // are <= zero. Same as RoundedRect::expandRadii(). | 76 // FloatSizes that are <= zero. Same as RoundedRect::expandRadii(). |
| 77 r.expandRadii(20); | 77 r.expandRadii(20); |
| 78 r.shrinkRadii(10); | 78 r.shrinkRadii(10); |
| 79 EXPECT_TRUE(r.getRadii().isZero()); | 79 EXPECT_TRUE(r.getRadii().isZero()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST(FloatRoundedRectTest, circle) { | 82 TEST(FloatRoundedRectTest, circle) { |
| 83 FloatSize cornerRadii(50, 50); | 83 FloatSize cornerRadii(50, 50); |
| 84 FloatRoundedRect r(FloatRect(0, 0, 100, 100), cornerRadii, cornerRadii, | 84 FloatRoundedRect r(FloatRect(0, 0, 100, 100), cornerRadii, cornerRadii, |
| 85 cornerRadii, cornerRadii); | 85 cornerRadii, cornerRadii); |
| 86 | 86 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 105 TEST_INTERCEPTS(r, 100, 50, 50); | 105 TEST_INTERCEPTS(r, 100, 50, 50); |
| 106 | 106 |
| 107 float minXIntercept; | 107 float minXIntercept; |
| 108 float maxXIntercept; | 108 float maxXIntercept; |
| 109 | 109 |
| 110 EXPECT_FALSE(r.xInterceptsAtY(-1, minXIntercept, maxXIntercept)); | 110 EXPECT_FALSE(r.xInterceptsAtY(-1, minXIntercept, maxXIntercept)); |
| 111 EXPECT_FALSE(r.xInterceptsAtY(101, minXIntercept, maxXIntercept)); | 111 EXPECT_FALSE(r.xInterceptsAtY(101, minXIntercept, maxXIntercept)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 /* | 114 /* |
| 115 * FloatRoundedRect geometry for this test. Corner radii are in parens, x and y
intercepts | 115 * FloatRoundedRect geometry for this test. Corner radii are in parens, x and y |
| 116 * for the elliptical corners are noted. The rectangle itself is at 0,0 with wid
th and height 100. | 116 * intercepts for the elliptical corners are noted. The rectangle itself is at |
| 117 * 0,0 with width and height 100. |
| 117 * | 118 * |
| 118 * (10, 15) x=10 x=90 (10, 20) | 119 * (10, 15) x=10 x=90 (10, 20) |
| 119 * (--+---------+--) | 120 * (--+---------+--) |
| 120 * y=15 +--| |-+ y=20 | 121 * y=15 +--| |-+ y=20 |
| 121 * | | | 122 * | | |
| 122 * | | | 123 * | | |
| 123 * y=85 + -| |- + y=70 | 124 * y=85 + -| |- + y=70 |
| 124 * (--+---------+--) | 125 * (--+---------+--) |
| 125 * (25, 15) x=25 x=80 (20, 30) | 126 * (25, 15) x=25 x=80 (20, 30) |
| 126 */ | 127 */ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 TEST(FloatRoundedRectTest, ToString) { | 182 TEST(FloatRoundedRectTest, ToString) { |
| 182 FloatSize cornerRect(1, 2); | 183 FloatSize cornerRect(1, 2); |
| 183 FloatRoundedRect roundedRect( | 184 FloatRoundedRect roundedRect( |
| 184 FloatRect(3, 5, 7, 11), | 185 FloatRect(3, 5, 7, 11), |
| 185 FloatRoundedRect::Radii(cornerRect, cornerRect, cornerRect, cornerRect)); | 186 FloatRoundedRect::Radii(cornerRect, cornerRect, cornerRect, cornerRect)); |
| 186 EXPECT_EQ("3,5 7x11 radii:(tl:1x2; tr:1x2; bl:1x2; br:1x2)", | 187 EXPECT_EQ("3,5 7x11 radii:(tl:1x2; tr:1x2; bl:1x2; br:1x2)", |
| 187 roundedRect.toString()); | 188 roundedRect.toString()); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |