| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/style/StyleDifference.h" | 5 #include "core/style/StyleDifference.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 TEST(StyleDifferenceTest, StreamOutputDefault) { | 12 TEST(StyleDifferenceTest, StreamOutputDefault) { |
| 13 std::stringstream stringStream; | 13 std::stringstream stringStream; |
| 14 StyleDifference diff; | 14 StyleDifference diff; |
| 15 stringStream << diff; | 15 stringStream << diff; |
| 16 EXPECT_EQ( | 16 EXPECT_EQ( |
| 17 "StyleDifference{layoutType=NoLayout, " | 17 "StyleDifference{layoutType=NoLayout, " |
| 18 "paintInvalidationType=NoPaintInvalidation, recomputeOverflow=0, " | 18 "paintInvalidationType=NoPaintInvalidation, recomputeOverflow=0, " |
| 19 "propertySpecificDifferences=, scrollAnchorDisablingPropertyChanged=0}", | 19 "visualRectUpdate=0, propertySpecificDifferences=, " |
| 20 "scrollAnchorDisablingPropertyChanged=0}", |
| 20 stringStream.str()); | 21 stringStream.str()); |
| 21 } | 22 } |
| 22 | 23 |
| 23 TEST(StyleDifferenceTest, StreamOutputAllFieldsMutated) { | 24 TEST(StyleDifferenceTest, StreamOutputAllFieldsMutated) { |
| 24 std::stringstream stringStream; | 25 std::stringstream stringStream; |
| 25 StyleDifference diff; | 26 StyleDifference diff; |
| 26 diff.setNeedsPaintInvalidationObject(); | 27 diff.setNeedsPaintInvalidationObject(); |
| 27 diff.setNeedsPositionedMovementLayout(); | 28 diff.setNeedsPositionedMovementLayout(); |
| 28 diff.setNeedsRecomputeOverflow(); | 29 diff.setNeedsRecomputeOverflow(); |
| 30 diff.setNeedsVisualRectUpdate(); |
| 29 diff.setTransformChanged(); | 31 diff.setTransformChanged(); |
| 30 diff.setScrollAnchorDisablingPropertyChanged(); | 32 diff.setScrollAnchorDisablingPropertyChanged(); |
| 31 stringStream << diff; | 33 stringStream << diff; |
| 32 EXPECT_EQ( | 34 EXPECT_EQ( |
| 33 "StyleDifference{layoutType=PositionedMovement, " | 35 "StyleDifference{layoutType=PositionedMovement, " |
| 34 "paintInvalidationType=PaintInvalidationObject, recomputeOverflow=1, " | 36 "paintInvalidationType=PaintInvalidationObject, recomputeOverflow=1, " |
| 35 "propertySpecificDifferences=TransformChanged, " | 37 "visualRectUpdate=1, propertySpecificDifferences=TransformChanged, " |
| 36 "scrollAnchorDisablingPropertyChanged=1}", | 38 "scrollAnchorDisablingPropertyChanged=1}", |
| 37 stringStream.str()); | 39 stringStream.str()); |
| 38 } | 40 } |
| 39 | 41 |
| 40 TEST(StyleDifferenceTest, StreamOutputSetAllProperties) { | 42 TEST(StyleDifferenceTest, StreamOutputSetAllProperties) { |
| 41 std::stringstream stringStream; | 43 std::stringstream stringStream; |
| 42 StyleDifference diff; | 44 StyleDifference diff; |
| 43 diff.setTransformChanged(); | 45 diff.setTransformChanged(); |
| 44 diff.setOpacityChanged(); | 46 diff.setOpacityChanged(); |
| 45 diff.setZIndexChanged(); | 47 diff.setZIndexChanged(); |
| 46 diff.setFilterChanged(); | 48 diff.setFilterChanged(); |
| 47 diff.setBackdropFilterChanged(); | 49 diff.setBackdropFilterChanged(); |
| 48 diff.setCSSClipChanged(); | 50 diff.setCSSClipChanged(); |
| 49 diff.setTextDecorationOrColorChanged(); | 51 diff.setTextDecorationOrColorChanged(); |
| 50 stringStream << diff; | 52 stringStream << diff; |
| 51 EXPECT_EQ( | 53 EXPECT_EQ( |
| 52 "StyleDifference{layoutType=NoLayout, " | 54 "StyleDifference{layoutType=NoLayout, " |
| 53 "paintInvalidationType=NoPaintInvalidation, recomputeOverflow=0, " | 55 "paintInvalidationType=NoPaintInvalidation, recomputeOverflow=0, " |
| 56 "visualRectUpdate=0, " |
| 54 "propertySpecificDifferences=TransformChanged|OpacityChanged|" | 57 "propertySpecificDifferences=TransformChanged|OpacityChanged|" |
| 55 "ZIndexChanged|FilterChanged|BackdropFilterChanged|CSSClipChanged|" | 58 "ZIndexChanged|FilterChanged|BackdropFilterChanged|CSSClipChanged|" |
| 56 "TextDecorationOrColorChanged, scrollAnchorDisablingPropertyChanged=0}", | 59 "TextDecorationOrColorChanged, scrollAnchorDisablingPropertyChanged=0}", |
| 57 stringStream.str()); | 60 stringStream.str()); |
| 58 } | 61 } |
| 59 | 62 |
| 60 } // namespace blink | 63 } // namespace blink |
| OLD | NEW |