OLD | NEW |
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 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 TEST_P(WebViewTest, SmartClipData) { | 3097 TEST_P(WebViewTest, SmartClipData) { |
3098 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3098 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
3099 static const char kExpectedClipHtml[] = | 3099 static const char kExpectedClipHtml[] = |
3100 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3100 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
3101 "solid skyblue; float: left; width: 190px; height: 30px; " | 3101 "solid skyblue; float: left; width: 190px; height: 30px; " |
3102 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3102 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3103 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3103 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3104 "font-weight: normal; letter-spacing: " | 3104 "font-weight: normal; letter-spacing: " |
3105 "normal; orphans: 2; text-align: start; " | 3105 "normal; orphans: 2; text-align: start; " |
3106 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3106 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
3107 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " | 3107 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
3108 "auto; text-decoration-style: initial; text-decoration-color: initial;" | 3108 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
3109 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3109 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: 10px; " |
3110 "10px; border: 2px solid skyblue; float: left; width: " | 3110 "border: 2px solid skyblue; float: left; width: 190px; height: 30px; " |
3111 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3111 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3112 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3112 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3113 "font-variant-caps: normal; font-weight: normal; " | 3113 "font-weight: normal; letter-spacing: normal; orphans: 2; text-align: " |
3114 "letter-spacing: normal; orphans: 2; " | 3114 "start; text-indent: 0px; text-transform: none; white-space: normal; " |
3115 "text-align: start; text-indent: 0px; text-transform: " | 3115 "widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
3116 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 3116 "text-decoration-style: initial; text-decoration-color: initial;\">Price " |
3117 "-webkit-text-stroke-width: 0px; caret-color: auto; " | 3117 "10,000,000won</div>"; |
3118 "text-decoration-style: initial; text-decoration-color: initial;\">" | |
3119 "Price 10,000,000won</div>"; | |
3120 WebString clipText; | 3118 WebString clipText; |
3121 WebString clipHtml; | 3119 WebString clipHtml; |
3122 WebRect clipRect; | 3120 WebRect clipRect; |
3123 URLTestHelpers::registerMockedURLFromBaseURL( | 3121 URLTestHelpers::registerMockedURLFromBaseURL( |
3124 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3122 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
3125 URLTestHelpers::registerMockedURLFromBaseURL( | 3123 URLTestHelpers::registerMockedURLFromBaseURL( |
3126 WebString::fromUTF8(m_baseURL.c_str()), | 3124 WebString::fromUTF8(m_baseURL.c_str()), |
3127 WebString::fromUTF8("smartclip.html")); | 3125 WebString::fromUTF8("smartclip.html")); |
3128 WebView* webView = | 3126 WebView* webView = |
3129 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); | 3127 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); |
3130 webView->resize(WebSize(500, 500)); | 3128 webView->resize(WebSize(500, 500)); |
3131 webView->updateAllLifecyclePhases(); | 3129 webView->updateAllLifecyclePhases(); |
3132 WebRect cropRect(300, 125, 152, 50); | 3130 WebRect cropRect(300, 125, 152, 50); |
3133 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 3131 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
3134 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 3132 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
3135 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 3133 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
3136 } | 3134 } |
3137 | 3135 |
3138 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { | 3136 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { |
3139 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3137 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
3140 static const char kExpectedClipHtml[] = | 3138 static const char kExpectedClipHtml[] = |
3141 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3139 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
3142 "solid skyblue; float: left; width: 190px; height: 30px; " | 3140 "solid skyblue; float: left; width: 190px; height: 30px; " |
3143 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3141 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3144 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3142 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3145 "font-weight: normal; letter-spacing: " | 3143 "font-weight: normal; letter-spacing: " |
3146 "normal; orphans: 2; text-align: start; " | 3144 "normal; orphans: 2; text-align: start; " |
3147 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3145 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
3148 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " | 3146 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
3149 "auto; text-decoration-style: initial; text-decoration-color: initial;" | 3147 "text-decoration-style: initial; text-decoration-color: initial;\">Air " |
3150 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3148 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: 10px; " |
3151 "10px; border: 2px solid skyblue; float: left; width: " | 3149 "border: 2px solid skyblue; float: left; width: 190px; height: 30px; " |
3152 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3150 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3153 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3151 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3154 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal; " | 3152 "font-weight: normal; letter-spacing: normal; orphans: 2; text-align: " |
3155 "orphans: 2; text-align: start; text-indent: 0px; " | 3153 "start; text-indent: 0px; text-transform: none; white-space: normal; " |
3156 "text-transform: none; white-space: normal; widows: 2; " | 3154 "widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " |
3157 "word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: auto; " | 3155 "text-decoration-style: initial; text-decoration-color: initial;\">Price " |
3158 "text-decoration-style: initial; text-decoration-color: initial;\">" | 3156 "10,000,000won</div>"; |
3159 "Price 10,000,000won</div>"; | |
3160 WebString clipText; | 3157 WebString clipText; |
3161 WebString clipHtml; | 3158 WebString clipHtml; |
3162 WebRect clipRect; | 3159 WebRect clipRect; |
3163 URLTestHelpers::registerMockedURLFromBaseURL( | 3160 URLTestHelpers::registerMockedURLFromBaseURL( |
3164 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3161 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
3165 URLTestHelpers::registerMockedURLFromBaseURL( | 3162 URLTestHelpers::registerMockedURLFromBaseURL( |
3166 WebString::fromUTF8(m_baseURL.c_str()), | 3163 WebString::fromUTF8(m_baseURL.c_str()), |
3167 WebString::fromUTF8("smartclip.html")); | 3164 WebString::fromUTF8("smartclip.html")); |
3168 WebView* webView = | 3165 WebView* webView = |
3169 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); | 3166 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4277 .translate(50, 55) | 4274 .translate(50, 55) |
4278 .scale(1. / 2.f); | 4275 .scale(1. / 2.f); |
4279 EXPECT_EQ(expectedMatrix, | 4276 EXPECT_EQ(expectedMatrix, |
4280 webViewImpl->getDeviceEmulationTransformForTesting()); | 4277 webViewImpl->getDeviceEmulationTransformForTesting()); |
4281 // visibleContentRect doesn't change. | 4278 // visibleContentRect doesn't change. |
4282 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4279 EXPECT_EQ(IntRect(50, 55, 50, 75), |
4283 *devToolsEmulator->visibleContentRectForPainting()); | 4280 *devToolsEmulator->visibleContentRectForPainting()); |
4284 } | 4281 } |
4285 | 4282 |
4286 } // namespace blink | 4283 } // namespace blink |
OLD | NEW |