Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
| index e14a4d87911106eea90fbbd86431bda745470f61..1e3bac08cadeb6f1604ee0c620fd3bb5eb825894 100644 |
| --- a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
| +++ b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp |
| @@ -504,4 +504,121 @@ TEST_F(TextAutosizerTest, DeviceScaleAdjustmentWithViewport) { |
| EXPECT_FLOAT_EQ(60.f, autosized->layoutObject()->style()->computedFontSize()); |
| } |
| +TEST_F(TextAutosizerTest, ChangingSuperClusterText) { |
|
pdr.
2016/11/20 06:38:13
Can you add a second test where shortText comes fi
cathiechentx
2016/11/22 08:14:48
Done.
|
| + setBodyInnerHTML( |
| + "<style>" |
| + " html { font-size: 16px; }" |
| + " body { width: 800px; margin: 0; overflow-y: hidden; }" |
| + " .supercluster { width:560px; }" |
| + "</style>" |
| + "<div class='supercluster'>" |
| + " <div id='longText'>short blah blah</div>" |
| + "</div>" |
| + "<div class='supercluster'>" |
| + " <div id='shortText'>short blah blah</div>" |
| + "</div>"); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
|
pdr.
2016/11/20 06:38:13
Can you check the computed font size here for both
cathiechentx
2016/11/22 08:14:48
Done.
|
| + LayoutObject* longText = |
|
pdr.
2016/11/20 06:38:13
Nit: these tests have some compile errors. I think
cathiechentx
2016/11/22 08:14:48
Done.
|
| + document().getElementById("longText")->layoutObject(); |
| + longText->setInnerHTML( |
| + " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " |
| + "eiusmod tempor" |
| + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " |
| + "veniam, quis nostrud" |
| + " exercitation ullamco laboris nisi ut aliquip ex ea commodo " |
| + "consequat. Duis aute irure" |
| + " dolor in reprehenderit in voluptate velit esse cillum dolore eu " |
| + "fugiat nulla pariatur." |
| + " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " |
| + "officia deserunt" |
| + " mollit anim id est laborum."); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutObject* shortText = |
| + document().getElementById("shortText")->layoutObject(); |
| + EXPECT_FLOAT_EQ(longText->style()->computedFontSize(), |
| + shortText->style()->computedFontSize()); |
| +} |
| + |
| +TEST_F(TextAutosizerTest, AddingSuperCluster) { |
| + setBodyInnerHTML( |
| + "<style>" |
| + " html { font-size: 16px; }" |
| + " body { width: 800px; margin: 0; overflow-y: hidden; }" |
| + " .supercluster { width:560px; }" |
| + "</style>" |
| + "<div>" |
| + " <div class='supercluster' id='shortText'>" |
| + " short blah blah" |
| + " </div>" |
| + "</div>" |
| + "<div id='container'></div>"); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutObject* supercluster = |
| + document().createElement("div", ASSERT_NO_EXCEPTION); |
| + LayoutObject* container = |
| + document().getElementById("container")->layoutObject(); |
| + container->setInnerHTML( |
| + "<div class='supercluster' id='longText'>" |
| + " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " |
| + "eiusmod tempor" |
| + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " |
| + "veniam, quis nostrud" |
| + " exercitation ullamco laboris nisi ut aliquip ex ea commodo " |
| + "consequat. Duis aute irure" |
| + " dolor in reprehenderit in voluptate velit esse cillum dolore eu " |
| + "fugiat nulla pariatur." |
| + " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " |
| + "officia deserunt" |
| + " mollit anim id est laborum." |
| + "</div>"); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutObject* longText = |
| + document().getElementById("longText")->layoutObject(); |
| + LayoutObject* shortText = |
| + document().getElementById("shortText")->layoutObject(); |
| + EXPECT_FLOAT_EQ(longText->style()->computedFontSize(), |
| + shortText->style()->computedFontSize()); |
| +} |
| + |
| +TEST_F(TextAutosizerTest, ChangingInheritedClusterTextInsideSuperCluster) { |
| + setBodyInnerHTML( |
| + "<style>" |
| + " html { font-size: 16px; }" |
| + " body { width: 800px; margin: 0; overflow-y: hidden; }" |
| + " .supercluster { width:560px; }" |
| + " .cluster{width:560px;}" |
| + "</style>" |
| + "<div class='supercluster'>" |
| + " <div class='cluster' id='longText'>short blah blah</div>" |
| + "</div>" |
| + "<div class='supercluster'>" |
| + " <div class='cluster' id='shortText'>short blah blah</div>" |
| + "</div>"); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutObject* longText = |
| + document().getElementById("longText")->layoutObject(); |
| + longText->setInnerHTML( |
| + " Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " |
| + "eiusmod tempor" |
| + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim " |
| + "veniam, quis nostrud" |
| + " exercitation ullamco laboris nisi ut aliquip ex ea commodo " |
| + "consequat. Duis aute irure" |
| + " dolor in reprehenderit in voluptate velit esse cillum dolore eu " |
| + "fugiat nulla pariatur." |
| + " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " |
| + "officia deserunt" |
| + " mollit anim id est laborum."); |
| + document().view()->updateAllLifecyclePhases(); |
| + |
| + LayoutObject* shortText = |
| + document().getElementById("shortText")->layoutObject(); |
| + EXPECT_FLOAT_EQ(longText->style()->computedFontSize(), |
| + shortText->style()->computedFontSize()); |
| +} |
| } // namespace blink |