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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 1909233002: Spec-compliant parsing and initial values for 'orphans' and 'widows'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some unit tests had non-conformant widphans assumptions too. Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleRareInheritedData.cpp ('k') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 } 2159 }
2160 2160
2161 TEST_F(WebViewTest, SmartClipData) 2161 TEST_F(WebViewTest, SmartClipData)
2162 { 2162 {
2163 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; 2163 static const char kExpectedClipText[] = "\nPrice 10,000,000won";
2164 static const char kExpectedClipHtml[] = 2164 static const char kExpectedClipHtml[] =
2165 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " 2165 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px "
2166 "solid skyblue; float: left; width: 190px; height: 30px; " 2166 "solid skyblue; float: left; width: 190px; height: 30px; "
2167 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " 2167 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: "
2168 "normal; font-variant: normal; font-weight: normal; letter-spacing: " 2168 "normal; font-variant: normal; font-weight: normal; letter-spacing: "
2169 "normal; line-height: normal; orphans: auto; text-align: start; " 2169 "normal; line-height: normal; orphans: 2; text-align: start; "
2170 "text-indent: 0px; text-transform: none; white-space: normal; widows: " 2170 "text-indent: 0px; text-transform: none; white-space: normal; widows: "
2171 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " 2171 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air "
2172 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " 2172 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: "
2173 "10px; border: 2px solid skyblue; float: left; width: " 2173 "10px; border: 2px solid skyblue; float: left; width: "
2174 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " 2174 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; "
2175 "font-size: 8px; font-style: normal; font-variant: normal; " 2175 "font-size: 8px; font-style: normal; font-variant: normal; "
2176 "font-weight: normal; letter-spacing: normal; line-height: normal; " 2176 "font-weight: normal; letter-spacing: normal; line-height: normal; "
2177 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " 2177 "orphans: 2; text-align: start; text-indent: 0px; text-transform: "
2178 "none; white-space: normal; widows: 1; word-spacing: 0px; " 2178 "none; white-space: normal; widows: 2; word-spacing: 0px; "
2179 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; 2179 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>";
2180 WebString clipText; 2180 WebString clipText;
2181 WebString clipHtml; 2181 WebString clipHtml;
2182 WebRect clipRect; 2182 WebRect clipRect;
2183 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("Ahem.ttf")); 2183 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("Ahem.ttf"));
2184 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("smartclip.html")); 2184 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("smartclip.html"));
2185 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip. html"); 2185 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip. html");
2186 webView->resize(WebSize(500, 500)); 2186 webView->resize(WebSize(500, 500));
2187 webView->updateAllLifecyclePhases(); 2187 webView->updateAllLifecyclePhases();
2188 WebRect cropRect(300, 125, 152, 50); 2188 WebRect cropRect(300, 125, 152, 50);
2189 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); 2189 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect);
2190 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); 2190 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str());
2191 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); 2191 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str());
2192 } 2192 }
2193 2193
2194 TEST_F(WebViewTest, SmartClipDataWithPinchZoom) 2194 TEST_F(WebViewTest, SmartClipDataWithPinchZoom)
2195 { 2195 {
2196 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; 2196 static const char kExpectedClipText[] = "\nPrice 10,000,000won";
2197 static const char kExpectedClipHtml[] = 2197 static const char kExpectedClipHtml[] =
2198 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " 2198 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px "
2199 "solid skyblue; float: left; width: 190px; height: 30px; " 2199 "solid skyblue; float: left; width: 190px; height: 30px; "
2200 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " 2200 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: "
2201 "normal; font-variant: normal; font-weight: normal; letter-spacing: " 2201 "normal; font-variant: normal; font-weight: normal; letter-spacing: "
2202 "normal; line-height: normal; orphans: auto; text-align: start; " 2202 "normal; line-height: normal; orphans: 2; text-align: start; "
2203 "text-indent: 0px; text-transform: none; white-space: normal; widows: " 2203 "text-indent: 0px; text-transform: none; white-space: normal; widows: "
2204 "1; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air " 2204 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Air "
2205 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " 2205 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: "
2206 "10px; border: 2px solid skyblue; float: left; width: " 2206 "10px; border: 2px solid skyblue; float: left; width: "
2207 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " 2207 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; "
2208 "font-size: 8px; font-style: normal; font-variant: normal; " 2208 "font-size: 8px; font-style: normal; font-variant: normal; "
2209 "font-weight: normal; letter-spacing: normal; line-height: normal; " 2209 "font-weight: normal; letter-spacing: normal; line-height: normal; "
2210 "orphans: auto; text-align: start; text-indent: 0px; text-transform: " 2210 "orphans: 2; text-align: start; text-indent: 0px; text-transform: "
2211 "none; white-space: normal; widows: 1; word-spacing: 0px; " 2211 "none; white-space: normal; widows: 2; word-spacing: 0px; "
2212 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>"; 2212 "-webkit-text-stroke-width: 0px;\">Price 10,000,000won</div>";
2213 WebString clipText; 2213 WebString clipText;
2214 WebString clipHtml; 2214 WebString clipHtml;
2215 WebRect clipRect; 2215 WebRect clipRect;
2216 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("Ahem.ttf")); 2216 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("Ahem.ttf"));
2217 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("smartclip.html")); 2217 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("smartclip.html"));
2218 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip. html"); 2218 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip. html");
2219 webView->resize(WebSize(500, 500)); 2219 webView->resize(WebSize(500, 500));
2220 webView->updateAllLifecyclePhases(); 2220 webView->updateAllLifecyclePhases();
2221 webView->setPageScaleFactor(1.5); 2221 webView->setPageScaleFactor(1.5);
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
3053 frame->setAutofillClient(&client); 3053 frame->setAutofillClient(&client);
3054 webView->setInitialFocus(false); 3054 webView->setInitialFocus(false);
3055 3055
3056 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3056 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3057 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3057 EXPECT_EQ(1, client.textChangesFromUserGesture());
3058 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3058 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3059 frame->setAutofillClient(0); 3059 frame->setAutofillClient(0);
3060 } 3060 }
3061 3061
3062 } // namespace blink 3062 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleRareInheritedData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698