Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 EXPECT_EQ(6, combobox_->selected_index()); | 424 EXPECT_EQ(6, combobox_->selected_index()); |
| 425 SendKeyEvent(ui::VKEY_PRIOR); | 425 SendKeyEvent(ui::VKEY_PRIOR); |
| 426 EXPECT_EQ(0, combobox_->selected_index()); | 426 EXPECT_EQ(0, combobox_->selected_index()); |
| 427 SendKeyEvent(ui::VKEY_END); | 427 SendKeyEvent(ui::VKEY_END); |
| 428 EXPECT_EQ(6, combobox_->selected_index()); | 428 EXPECT_EQ(6, combobox_->selected_index()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 TEST_F(ComboboxTest, GetTextForRowTest) { | 431 TEST_F(ComboboxTest, GetTextForRowTest) { |
| 432 InitCombobox(); | 432 InitCombobox(); |
| 433 std::set<int> separators; | 433 std::set<int> separators; |
| 434 separators.insert(0); | |
|
msw
2014/07/07 23:37:22
I think it was our intention here to ensure that a
| |
| 435 separators.insert(1); | 434 separators.insert(1); |
| 435 separators.insert(2); | |
| 436 separators.insert(9); | 436 separators.insert(9); |
| 437 model_->SetSeparators(separators); | 437 model_->SetSeparators(separators); |
| 438 for (int i = 0; i < combobox_->GetRowCount(); ++i) { | 438 for (int i = 0; i < combobox_->GetRowCount(); ++i) { |
| 439 if (separators.count(i) != 0) { | 439 if (separators.count(i) != 0) { |
| 440 EXPECT_TRUE(combobox_->GetTextForRow(i).empty()) << i; | 440 EXPECT_TRUE(combobox_->GetTextForRow(i).empty()) << i; |
| 441 } else { | 441 } else { |
| 442 EXPECT_EQ(ASCIIToUTF16(i % 2 == 0 ? "PEANUT BUTTER" : "JELLY"), | 442 EXPECT_EQ(ASCIIToUTF16(i % 2 == 0 ? "PEANUT BUTTER" : "JELLY"), |
| 443 combobox_->GetTextForRow(i)) << i; | 443 combobox_->GetTextForRow(i)) << i; |
| 444 } | 444 } |
| 445 } | 445 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 combobox_->OnBlur(); | 684 combobox_->OnBlur(); |
| 685 | 685 |
| 686 // Type the first character of "PEANUT BUTTER", which should change the | 686 // Type the first character of "PEANUT BUTTER", which should change the |
| 687 // selected index and perform an action. | 687 // selected index and perform an action. |
| 688 combobox_->GetTextInputClient()->InsertChar('P', ui::EF_NONE); | 688 combobox_->GetTextInputClient()->InsertChar('P', ui::EF_NONE); |
| 689 EXPECT_EQ(2, listener.actions_performed()); | 689 EXPECT_EQ(2, listener.actions_performed()); |
| 690 EXPECT_EQ(2, listener.perform_action_index()); | 690 EXPECT_EQ(2, listener.perform_action_index()); |
| 691 } | 691 } |
| 692 | 692 |
| 693 } // namespace views | 693 } // namespace views |
| OLD | NEW |