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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 EXPECT_EQ(0, info.selectionStart); | 1402 EXPECT_EQ(0, info.selectionStart); |
1403 EXPECT_EQ(0, info.selectionEnd); | 1403 EXPECT_EQ(0, info.selectionEnd); |
1404 | 1404 |
1405 frame->deleteSurroundingText(10, 10); | 1405 frame->deleteSurroundingText(10, 10); |
1406 info = webView->textInputInfo(); | 1406 info = webView->textInputInfo(); |
1407 EXPECT_EQ("", std::string(info.value.utf8().data())); | 1407 EXPECT_EQ("", std::string(info.value.utf8().data())); |
1408 EXPECT_EQ(0, info.selectionStart); | 1408 EXPECT_EQ(0, info.selectionStart); |
1409 EXPECT_EQ(0, info.selectionEnd); | 1409 EXPECT_EQ(0, info.selectionEnd); |
1410 } | 1410 } |
1411 | 1411 |
1412 TEST_P(WebViewTest, DeleteSurroundingTextInCodePoints) { | |
1413 URLTestHelpers::registerMockedURLFromBaseURL( | |
1414 WebString::fromUTF8(m_baseURL.c_str()), | |
1415 WebString::fromUTF8("input_field_populated.html")); | |
1416 WebView* webView = m_webViewHelper.initializeAndLoad( | |
1417 m_baseURL + "input_field_populated.html"); | |
1418 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | |
1419 webView->setInitialFocus(false); | |
1420 | |
1421 frame->setEditableSelectionOffsets(10, 10); | |
1422 frame->deleteSurroundingTextInCodePoints(5, 8); | |
1423 WebTextInputInfo info = webView->textInputInfo(); | |
1424 EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); | |
Changwan Ryu
2017/01/11 02:00:27
how about deleting a surrounding pair in this test
yabinh
2017/01/24 11:39:56
Done.
| |
1425 EXPECT_EQ(5, info.selectionStart); | |
1426 EXPECT_EQ(5, info.selectionEnd); | |
1427 | |
1428 frame->setEditableSelectionOffsets(5, 10); | |
1429 frame->deleteSurroundingTextInCodePoints(3, 5); | |
1430 info = webView->textInputInfo(); | |
1431 EXPECT_EQ("01ijklmstuvwxyz", std::string(info.value.utf8().data())); | |
1432 EXPECT_EQ(2, info.selectionStart); | |
1433 EXPECT_EQ(7, info.selectionEnd); | |
1434 | |
1435 frame->setEditableSelectionOffsets(5, 5); | |
1436 frame->deleteSurroundingTextInCodePoints(10, 0); | |
1437 info = webView->textInputInfo(); | |
1438 EXPECT_EQ("lmstuvwxyz", std::string(info.value.utf8().data())); | |
1439 EXPECT_EQ(0, info.selectionStart); | |
1440 EXPECT_EQ(0, info.selectionEnd); | |
1441 | |
1442 frame->deleteSurroundingTextInCodePoints(0, 20); | |
1443 info = webView->textInputInfo(); | |
1444 EXPECT_EQ("", std::string(info.value.utf8().data())); | |
1445 EXPECT_EQ(0, info.selectionStart); | |
1446 EXPECT_EQ(0, info.selectionEnd); | |
1447 | |
1448 frame->deleteSurroundingTextInCodePoints(10, 10); | |
1449 info = webView->textInputInfo(); | |
1450 EXPECT_EQ("", std::string(info.value.utf8().data())); | |
1451 EXPECT_EQ(0, info.selectionStart); | |
1452 EXPECT_EQ(0, info.selectionEnd); | |
1453 } | |
1454 | |
1412 TEST_P(WebViewTest, SetCompositionFromExistingText) { | 1455 TEST_P(WebViewTest, SetCompositionFromExistingText) { |
1413 URLTestHelpers::registerMockedURLFromBaseURL( | 1456 URLTestHelpers::registerMockedURLFromBaseURL( |
1414 WebString::fromUTF8(m_baseURL.c_str()), | 1457 WebString::fromUTF8(m_baseURL.c_str()), |
1415 WebString::fromUTF8("input_field_populated.html")); | 1458 WebString::fromUTF8("input_field_populated.html")); |
1416 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( | 1459 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
1417 m_baseURL + "input_field_populated.html"); | 1460 m_baseURL + "input_field_populated.html"); |
1418 webView->setInitialFocus(false); | 1461 webView->setInitialFocus(false); |
1419 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 1462 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
1420 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); | 1463 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); |
1421 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1464 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4293 .translate(50, 55) | 4336 .translate(50, 55) |
4294 .scale(1. / 2.f); | 4337 .scale(1. / 2.f); |
4295 EXPECT_EQ(expectedMatrix, | 4338 EXPECT_EQ(expectedMatrix, |
4296 webViewImpl->getDeviceEmulationTransformForTesting()); | 4339 webViewImpl->getDeviceEmulationTransformForTesting()); |
4297 // visibleContentRect doesn't change. | 4340 // visibleContentRect doesn't change. |
4298 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4341 EXPECT_EQ(IntRect(50, 55, 50, 75), |
4299 *devToolsEmulator->visibleContentRectForPainting()); | 4342 *devToolsEmulator->visibleContentRectForPainting()); |
4300 } | 4343 } |
4301 | 4344 |
4302 } // namespace blink | 4345 } // namespace blink |
OLD | NEW |