| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 model.SetText(WideToUTF16(L"\x05d5\x05b7\x05D9\x05B0\x05D4\x05B4\x05D9")); | 232 model.SetText(WideToUTF16(L"\x05d5\x05b7\x05D9\x05B0\x05D4\x05B4\x05D9")); |
| 233 MoveCursorTo(model, 0); | 233 MoveCursorTo(model, 0); |
| 234 EXPECT_TRUE(model.Delete()); | 234 EXPECT_TRUE(model.Delete()); |
| 235 EXPECT_TRUE(model.Delete()); | 235 EXPECT_TRUE(model.Delete()); |
| 236 EXPECT_TRUE(model.Delete()); | 236 EXPECT_TRUE(model.Delete()); |
| 237 EXPECT_TRUE(model.Delete()); | 237 EXPECT_TRUE(model.Delete()); |
| 238 EXPECT_EQ(WideToUTF16(L""), model.GetText()); | 238 EXPECT_EQ(WideToUTF16(L""), model.GetText()); |
| 239 | 239 |
| 240 // The first 2 characters are not strong directionality characters. | 240 // The first 2 characters are not strong directionality characters. |
| 241 model.SetText(WideToUTF16(L"\x002C\x0020\x05D1\x05BC\x05B7\x05E9\x05BC")); | 241 model.SetText(WideToUTF16(L"\x002C\x0020\x05D1\x05BC\x05B7\x05E9\x05BC")); |
| 242 #if defined(OS_WIN) | |
| 243 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, false); | |
| 244 #else | |
| 245 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_LEFT, false); | 242 model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_LEFT, false); |
| 246 #endif | |
| 247 EXPECT_TRUE(model.Backspace()); | 243 EXPECT_TRUE(model.Backspace()); |
| 248 EXPECT_EQ(WideToUTF16(L"\x002C\x0020\x05D1\x05BC\x05B7\x05E9"), | 244 EXPECT_EQ(WideToUTF16(L"\x002C\x0020\x05D1\x05BC\x05B7\x05E9"), |
| 249 model.GetText()); | 245 model.GetText()); |
| 250 } | 246 } |
| 251 | 247 |
| 252 TEST_F(TextfieldViewsModelTest, EmptyString) { | 248 TEST_F(TextfieldViewsModelTest, EmptyString) { |
| 253 TextfieldViewsModel model(NULL); | 249 TextfieldViewsModel model(NULL); |
| 254 EXPECT_EQ(string16(), model.GetText()); | 250 EXPECT_EQ(string16(), model.GetText()); |
| 255 EXPECT_EQ(string16(), model.GetSelectedText()); | 251 EXPECT_EQ(string16(), model.GetSelectedText()); |
| 256 | 252 |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 EXPECT_TRUE(model.Undo()); | 1520 EXPECT_TRUE(model.Undo()); |
| 1525 EXPECT_STR_EQ("ABCDE", model.GetText()); | 1521 EXPECT_STR_EQ("ABCDE", model.GetText()); |
| 1526 EXPECT_TRUE(model.Redo()); | 1522 EXPECT_TRUE(model.Redo()); |
| 1527 EXPECT_STR_EQ("1234", model.GetText()); | 1523 EXPECT_STR_EQ("1234", model.GetText()); |
| 1528 EXPECT_FALSE(model.Redo()); | 1524 EXPECT_FALSE(model.Redo()); |
| 1529 | 1525 |
| 1530 // TODO(oshima): We need MockInputMethod to test the behavior with IME. | 1526 // TODO(oshima): We need MockInputMethod to test the behavior with IME. |
| 1531 } | 1527 } |
| 1532 | 1528 |
| 1533 } // namespace views | 1529 } // namespace views |
| OLD | NEW |