Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: Source/core/layout/shapes/BoxShapeTest.cpp

Issue 1164413003: Fix unit test style in core/{animation,css,fetch,frame,layout,style,timing}/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: anonymous Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/OverflowModelTest.cpp ('k') | Source/core/style/ComputedStyleTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
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 "config.h" 30 #include "config.h"
31
32 #include "core/layout/shapes/BoxShape.h" 31 #include "core/layout/shapes/BoxShape.h"
33 32
34 #include "platform/geometry/FloatRoundedRect.h" 33 #include "platform/geometry/FloatRoundedRect.h"
35
36 #include <gtest/gtest.h> 34 #include <gtest/gtest.h>
37 35
38 namespace blink { 36 namespace blink {
39 37
40 class BoxShapeTest : public ::testing::Test { 38 class BoxShapeTest : public ::testing::Test {
41 protected: 39 protected:
42 BoxShapeTest() { } 40 BoxShapeTest() { }
43 41
44 PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shape Margin) 42 PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shape Margin)
45 { 43 {
46 return Shape::createLayoutBoxShape(bounds, TopToBottomWritingMode, shape Margin); 44 return Shape::createLayoutBoxShape(bounds, TopToBottomWritingMode, shape Margin);
47 } 45 }
48 }; 46 };
49 47
50 } // namespace blink
51
52 namespace { 48 namespace {
53 49
54 using namespace blink;
55
56 #define TEST_EXCLUDED_INTERVAL(shapePtr, lineTop, lineHeight, expectedLeft, expe ctedRight) \ 50 #define TEST_EXCLUDED_INTERVAL(shapePtr, lineTop, lineHeight, expectedLeft, expe ctedRight) \
57 { \ 51 { \
58 LineSegment segment = shapePtr->getExcludedInterval(lineTop, lineHeight); \ 52 LineSegment segment = shapePtr->getExcludedInterval(lineTop, lineHeight); \
59 EXPECT_TRUE(segment.isValid); \ 53 EXPECT_TRUE(segment.isValid); \
60 if (segment.isValid) { \ 54 if (segment.isValid) { \
61 EXPECT_FLOAT_EQ(expectedLeft, segment.logicalLeft); \ 55 EXPECT_FLOAT_EQ(expectedLeft, segment.logicalLeft); \
62 EXPECT_FLOAT_EQ(expectedRight, segment.logicalRight); \ 56 EXPECT_FLOAT_EQ(expectedRight, segment.logicalRight); \
63 } \ 57 } \
64 } 58 }
65 59
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox() ); 125 EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox() );
132 126
133 TEST_EXCLUDED_INTERVAL(shape, 10, 95, 0, 100); 127 TEST_EXCLUDED_INTERVAL(shape, 10, 95, 0, 100);
134 TEST_EXCLUDED_INTERVAL(shape, 5, 25, 0, 100); 128 TEST_EXCLUDED_INTERVAL(shape, 5, 25, 0, 100);
135 TEST_EXCLUDED_INTERVAL(shape, 15, 6, 0, 100); 129 TEST_EXCLUDED_INTERVAL(shape, 15, 6, 0, 100);
136 TEST_EXCLUDED_INTERVAL(shape, 20, 50, 0, 100); 130 TEST_EXCLUDED_INTERVAL(shape, 20, 50, 0, 100);
137 TEST_EXCLUDED_INTERVAL(shape, 69, 5, 0, 100); 131 TEST_EXCLUDED_INTERVAL(shape, 69, 5, 0, 100);
138 TEST_EXCLUDED_INTERVAL(shape, 85, 10, 0, 97.320511f); 132 TEST_EXCLUDED_INTERVAL(shape, 85, 10, 0, 97.320511f);
139 } 133 }
140 134
141 } // namespace 135 } // anonymous namespace
136
137 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/OverflowModelTest.cpp ('k') | Source/core/style/ComputedStyleTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698