| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Tests expanding selection on text "abcdef ghij kl mno^p|>qr stuvwi inm mnii,
" | 308 // Tests expanding selection on text "abcdef ghij kl mno^p|>qr stuvwi inm mnii,
" |
| 309 // (^ means base, | means extent, < means start, and > means end). | 309 // (^ means base, | means extent, < means start, and > means end). |
| 310 // Text needs to be laid out on a single line with no rotation. | 310 // Text needs to be laid out on a single line with no rotation. |
| 311 void GranularityStrategyTest::testDirectionExpand() | 311 void GranularityStrategyTest::testDirectionExpand() |
| 312 { | 312 { |
| 313 // Expand selection using character granularity until the end of the word | 313 // Expand selection using character granularity until the end of the word |
| 314 // is reached. | 314 // is reached. |
| 315 // "abcdef ghij kl mno^pq|>r stuvwi inm mnii," | 315 // "abcdef ghij kl mno^pq|>r stuvwi inm mnii," |
| 316 selection().moveRangeSelectionExtent(m_letterPos[20]); | 316 selection().moveRangeSelectionExtent(m_letterPos[20]); |
| 317 EXPECT_EQ_SELECTED_TEXT("pq"); | 317 EXPECT_EQ_SELECTED_TEXT("pq"); |
| 318 // Move to the same postion shouldn't change anything. | 318 // Move to the same position shouldn't change anything. |
| 319 selection().moveRangeSelectionExtent(m_letterPos[20]); | 319 selection().moveRangeSelectionExtent(m_letterPos[20]); |
| 320 EXPECT_EQ_SELECTED_TEXT("pq"); | 320 EXPECT_EQ_SELECTED_TEXT("pq"); |
| 321 // "abcdef ghij kl mno^pqr|> stuvwi inm mnii," | 321 // "abcdef ghij kl mno^pqr|> stuvwi inm mnii," |
| 322 selection().moveRangeSelectionExtent(m_letterPos[21]); | 322 selection().moveRangeSelectionExtent(m_letterPos[21]); |
| 323 EXPECT_EQ_SELECTED_TEXT("pqr"); | 323 EXPECT_EQ_SELECTED_TEXT("pqr"); |
| 324 // Selection should stay the same until the middle of the word is passed. | 324 // Selection should stay the same until the middle of the word is passed. |
| 325 // "abcdef ghij kl mno^pqr |>stuvwi inm mnii," - | 325 // "abcdef ghij kl mno^pqr |>stuvwi inm mnii," - |
| 326 selection().moveRangeSelectionExtent(m_letterPos[22]); | 326 selection().moveRangeSelectionExtent(m_letterPos[22]); |
| 327 EXPECT_EQ_SELECTED_TEXT("pqr "); | 327 EXPECT_EQ_SELECTED_TEXT("pqr "); |
| 328 // "abcdef ghij kl mno^pqr >st|uvwi inm mnii," | 328 // "abcdef ghij kl mno^pqr >st|uvwi inm mnii," |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 655 |
| 656 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent, | 656 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent, |
| 657 // > means end). | 657 // > means end). |
| 658 selection().setSelection(VisibleSelection(Position(text, 15), Position(text,
22))); | 658 selection().setSelection(VisibleSelection(Position(text, 15), Position(text,
22))); |
| 659 EXPECT_EQ_SELECTED_TEXT("mnopqr "); | 659 EXPECT_EQ_SELECTED_TEXT("mnopqr "); |
| 660 selection().moveRangeSelectionExtent(m_wordMiddles[4]); | 660 selection().moveRangeSelectionExtent(m_wordMiddles[4]); |
| 661 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); | 661 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |