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 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3084 TEST_P(WebViewTest, SmartClipData) { | 3084 TEST_P(WebViewTest, SmartClipData) { |
3085 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3085 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
3086 static const char kExpectedClipHtml[] = | 3086 static const char kExpectedClipHtml[] = |
3087 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3087 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
3088 "solid skyblue; float: left; width: 190px; height: 30px; " | 3088 "solid skyblue; float: left; width: 190px; height: 30px; " |
3089 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3089 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3090 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3090 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3091 "font-weight: normal; letter-spacing: " | 3091 "font-weight: normal; letter-spacing: " |
3092 "normal; orphans: 2; text-align: start; " | 3092 "normal; orphans: 2; text-align: start; " |
3093 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3093 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
3094 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 3094 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " |
3095 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 3095 "auto; text-decoration-style: initial; text-decoration-color: initial;" |
3096 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3096 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
3097 "10px; border: 2px solid skyblue; float: left; width: " | 3097 "10px; border: 2px solid skyblue; float: left; width: " |
3098 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3098 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
3099 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3099 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
3100 "font-variant-caps: normal; font-weight: normal; " | 3100 "font-variant-caps: normal; font-weight: normal; " |
3101 "letter-spacing: normal; orphans: 2; " | 3101 "letter-spacing: normal; orphans: 2; " |
3102 "text-align: start; text-indent: 0px; text-transform: " | 3102 "text-align: start; text-indent: 0px; text-transform: " |
3103 "none; white-space: normal; widows: 2; word-spacing: 0px; " | 3103 "none; white-space: normal; widows: 2; word-spacing: 0px; " |
3104 "-webkit-text-stroke-width: 0px; text-decoration-style: initial; " | 3104 "-webkit-text-stroke-width: 0px; caret-color: auto; " |
3105 "text-decoration-color: initial;\">Price 10,000,000won</div>"; | 3105 "text-decoration-style: initial; text-decoration-color: initial;\">" |
| 3106 "Price 10,000,000won</div>"; |
3106 WebString clipText; | 3107 WebString clipText; |
3107 WebString clipHtml; | 3108 WebString clipHtml; |
3108 WebRect clipRect; | 3109 WebRect clipRect; |
3109 URLTestHelpers::registerMockedURLFromBaseURL( | 3110 URLTestHelpers::registerMockedURLFromBaseURL( |
3110 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3111 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
3111 URLTestHelpers::registerMockedURLFromBaseURL( | 3112 URLTestHelpers::registerMockedURLFromBaseURL( |
3112 WebString::fromUTF8(m_baseURL.c_str()), | 3113 WebString::fromUTF8(m_baseURL.c_str()), |
3113 WebString::fromUTF8("smartclip.html")); | 3114 WebString::fromUTF8("smartclip.html")); |
3114 WebView* webView = | 3115 WebView* webView = |
3115 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); | 3116 m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.html"); |
3116 webView->resize(WebSize(500, 500)); | 3117 webView->resize(WebSize(500, 500)); |
3117 webView->updateAllLifecyclePhases(); | 3118 webView->updateAllLifecyclePhases(); |
3118 WebRect cropRect(300, 125, 152, 50); | 3119 WebRect cropRect(300, 125, 152, 50); |
3119 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); | 3120 webView->extractSmartClipData(cropRect, clipText, clipHtml, clipRect); |
3120 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); | 3121 EXPECT_STREQ(kExpectedClipText, clipText.utf8().c_str()); |
3121 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); | 3122 EXPECT_STREQ(kExpectedClipHtml, clipHtml.utf8().c_str()); |
3122 } | 3123 } |
3123 | 3124 |
3124 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { | 3125 TEST_P(WebViewTest, SmartClipDataWithPinchZoom) { |
3125 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; | 3126 static const char kExpectedClipText[] = "\nPrice 10,000,000won"; |
3126 static const char kExpectedClipHtml[] = | 3127 static const char kExpectedClipHtml[] = |
3127 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " | 3128 "<div id=\"div4\" style=\"padding: 10px; margin: 10px; border: 2px " |
3128 "solid skyblue; float: left; width: 190px; height: 30px; " | 3129 "solid skyblue; float: left; width: 190px; height: 30px; " |
3129 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " | 3130 "color: rgb(0, 0, 0); font-family: myahem; font-size: 8px; font-style: " |
3130 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " | 3131 "normal; font-variant-ligatures: normal; font-variant-caps: normal; " |
3131 "font-weight: normal; letter-spacing: " | 3132 "font-weight: normal; letter-spacing: " |
3132 "normal; orphans: 2; text-align: start; " | 3133 "normal; orphans: 2; text-align: start; " |
3133 "text-indent: 0px; text-transform: none; white-space: normal; widows: " | 3134 "text-indent: 0px; text-transform: none; white-space: normal; widows: " |
3134 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; " | 3135 "2; word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: " |
3135 "text-decoration-style: initial; text-decoration-color: initial;\">Air " | 3136 "auto; text-decoration-style: initial; text-decoration-color: initial;" |
3136 "conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " | 3137 "\">Air conditioner</div><div id=\"div5\" style=\"padding: 10px; margin: " |
3137 "10px; border: 2px solid skyblue; float: left; width: " | 3138 "10px; border: 2px solid skyblue; float: left; width: " |
3138 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " | 3139 "190px; height: 30px; color: rgb(0, 0, 0); font-family: myahem; " |
3139 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " | 3140 "font-size: 8px; font-style: normal; font-variant-ligatures: normal; " |
3140 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal; " | 3141 "font-variant-caps: normal; font-weight: normal; letter-spacing: normal; " |
3141 "orphans: 2; text-align: start; text-indent: 0px; " | 3142 "orphans: 2; text-align: start; text-indent: 0px; " |
3142 "text-transform: none; white-space: normal; widows: 2; " | 3143 "text-transform: none; white-space: normal; widows: 2; " |
3143 "word-spacing: 0px; -webkit-text-stroke-width: 0px;" | 3144 "word-spacing: 0px; -webkit-text-stroke-width: 0px; caret-color: auto; " |
3144 " text-decoration-style: initial; text-decoration-color: initial;\">" | 3145 "text-decoration-style: initial; text-decoration-color: initial;\">" |
3145 "Price 10,000,000won</div>"; | 3146 "Price 10,000,000won</div>"; |
3146 WebString clipText; | 3147 WebString clipText; |
3147 WebString clipHtml; | 3148 WebString clipHtml; |
3148 WebRect clipRect; | 3149 WebRect clipRect; |
3149 URLTestHelpers::registerMockedURLFromBaseURL( | 3150 URLTestHelpers::registerMockedURLFromBaseURL( |
3150 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); | 3151 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("Ahem.ttf")); |
3151 URLTestHelpers::registerMockedURLFromBaseURL( | 3152 URLTestHelpers::registerMockedURLFromBaseURL( |
3152 WebString::fromUTF8(m_baseURL.c_str()), | 3153 WebString::fromUTF8(m_baseURL.c_str()), |
3153 WebString::fromUTF8("smartclip.html")); | 3154 WebString::fromUTF8("smartclip.html")); |
3154 WebView* webView = | 3155 WebView* webView = |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 .translate(50, 55) | 4356 .translate(50, 55) |
4356 .scale(1. / 2.f); | 4357 .scale(1. / 2.f); |
4357 EXPECT_EQ(expectedMatrix, | 4358 EXPECT_EQ(expectedMatrix, |
4358 webViewImpl->getDeviceEmulationTransformForTesting()); | 4359 webViewImpl->getDeviceEmulationTransformForTesting()); |
4359 // visibleContentRect doesn't change. | 4360 // visibleContentRect doesn't change. |
4360 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4361 EXPECT_EQ(IntRect(50, 55, 50, 75), |
4361 *devToolsEmulator->visibleContentRectForPainting()); | 4362 *devToolsEmulator->visibleContentRectForPainting()); |
4362 } | 4363 } |
4363 | 4364 |
4364 } // namespace blink | 4365 } // namespace blink |
OLD | NEW |