Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 1999773002: views::Textfield: Implement transpose editing command. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield_model_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 const int command = ui::EF_COMMAND_DOWN; 756 const int command = ui::EF_COMMAND_DOWN;
757 const int altgr = ui::EF_ALTGR_DOWN; 757 const int altgr = ui::EF_ALTGR_DOWN;
758 const int shift = ui::EF_SHIFT_DOWN; 758 const int shift = ui::EF_SHIFT_DOWN;
759 759
760 SendKeyPress(ui::VKEY_T, shift | alt | altgr); 760 SendKeyPress(ui::VKEY_T, shift | alt | altgr);
761 SendKeyPress(ui::VKEY_H, alt); 761 SendKeyPress(ui::VKEY_H, alt);
762 SendKeyPress(ui::VKEY_E, altgr); 762 SendKeyPress(ui::VKEY_E, altgr);
763 SendKeyPress(ui::VKEY_T, shift); 763 SendKeyPress(ui::VKEY_T, shift);
764 SendKeyPress(ui::VKEY_E, shift | altgr); 764 SendKeyPress(ui::VKEY_E, shift | altgr);
765 SendKeyPress(ui::VKEY_X, 0); 765 SendKeyPress(ui::VKEY_X, 0);
766 SendKeyPress(ui::VKEY_T, ctrl); 766 SendKeyPress(ui::VKEY_T, ctrl); // This causes transpose on Mac.
767 SendKeyPress(ui::VKEY_1, alt); 767 SendKeyPress(ui::VKEY_1, alt);
768 SendKeyPress(ui::VKEY_2, command); 768 SendKeyPress(ui::VKEY_2, command);
769 SendKeyPress(ui::VKEY_3, 0); 769 SendKeyPress(ui::VKEY_3, 0);
770 SendKeyPress(ui::VKEY_4, 0); 770 SendKeyPress(ui::VKEY_4, 0);
771 SendKeyPress(ui::VKEY_OEM_PLUS, ctrl); 771 SendKeyPress(ui::VKEY_OEM_PLUS, ctrl);
772 SendKeyPress(ui::VKEY_OEM_PLUS, ctrl | shift); 772 SendKeyPress(ui::VKEY_OEM_PLUS, ctrl | shift);
773 SendKeyPress(ui::VKEY_OEM_MINUS, ctrl); 773 SendKeyPress(ui::VKEY_OEM_MINUS, ctrl);
774 SendKeyPress(ui::VKEY_OEM_MINUS, ctrl | shift); 774 SendKeyPress(ui::VKEY_OEM_MINUS, ctrl | shift);
775 775
776 if (TestingNativeCrOs()) 776 if (TestingNativeCrOs())
777 EXPECT_STR_EQ("TeTEx34", textfield_->text()); 777 EXPECT_STR_EQ("TeTEx34", textfield_->text());
778 else if (TestingNativeMac()) 778 else if (TestingNativeMac())
779 EXPECT_STR_EQ("TheTEx134", textfield_->text()); 779 EXPECT_STR_EQ("TheTxE134", textfield_->text());
780 else 780 else
781 EXPECT_STR_EQ("TeTEx234", textfield_->text()); 781 EXPECT_STR_EQ("TeTEx234", textfield_->text());
782 } 782 }
783 783
784 TEST_F(TextfieldTest, ControlAndSelectTest) { 784 TEST_F(TextfieldTest, ControlAndSelectTest) {
785 // Insert a test string in a textfield. 785 // Insert a test string in a textfield.
786 InitTextfield(); 786 InitTextfield();
787 textfield_->SetText(ASCIIToUTF16("one two three")); 787 textfield_->SetText(ASCIIToUTF16("one two three"));
788 SendHomeEvent(false); 788 SendHomeEvent(false);
789 SendKeyEvent(ui::VKEY_RIGHT, true, false); 789 SendKeyEvent(ui::VKEY_RIGHT, true, false);
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 2658
2659 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2659 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2660 ui::AXViewState state_protected; 2660 ui::AXViewState state_protected;
2661 textfield_->GetAccessibleState(&state_protected); 2661 textfield_->GetAccessibleState(&state_protected);
2662 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2662 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2663 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 2663 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2664 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 2664 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2665 } 2665 }
2666 2666
2667 } // namespace views 2667 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield_model_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698