Chromium Code Reviews| Index: ui/views/controls/label_unittest.cc |
| diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc |
| index 42cc0cda47da2728e158f4baedfe1207b54ddc4b..db60b4321b4eb61891850db90438ee36fc7eaea2 100644 |
| --- a/ui/views/controls/label_unittest.cc |
| +++ b/ui/views/controls/label_unittest.cc |
| @@ -98,6 +98,26 @@ TEST(LabelTest, MultiLineProperty) { |
| EXPECT_FALSE(label.is_multi_line()); |
| } |
| +TEST(LabelTest, ObscuredProperty) { |
| + Label label; |
| + base::string16 test_text(ASCIIToUTF16("Password!")); |
| + label.SetText(test_text); |
| + |
| + // Should be false by default... |
| + EXPECT_FALSE(label.is_obscured()); |
| + EXPECT_EQ(ASCIIToUTF16("Password!"), label.display_text()); |
|
msw
2014/04/03 01:38:48
nit: re-use test_text here and below.
|
| + |
| + label.SetObscured(true); |
| + EXPECT_TRUE(label.is_obscured()); |
| + EXPECT_EQ(base::WideToUTF16( |
| + L"\x2022\x2022\x2022\x2022\x2022\x2022\x2022\x2022\x2022"), |
| + label.display_text()); |
| + |
|
msw
2014/04/03 01:38:48
nit: test that a SetText call while the Label is o
|
| + label.SetObscured(false); |
| + EXPECT_FALSE(label.is_obscured()); |
| + EXPECT_EQ(ASCIIToUTF16("Password!"), label.display_text()); |
| +} |
| + |
| TEST(LabelTest, TooltipProperty) { |
| Label label; |
| base::string16 test_text(ASCIIToUTF16("My cool string.")); |
| @@ -133,7 +153,12 @@ TEST(LabelTest, TooltipProperty) { |
| label.SetBounds(0, 0, 1, 1); |
| EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); |
| - // Make the label multiline and there is no tooltip again. |
| + // Make the label obscured and there is no tooltip. |
| + label.SetObscured(true); |
| + EXPECT_FALSE(label.GetTooltipText(gfx::Point(), &tooltip)); |
| + label.SetObscured(false); |
|
msw
2014/04/03 01:38:48
nit: after this call, EXPECT_TRUE(label.GetTooltip
msw
2014/04/03 18:27:48
ping.
Mike West
2014/04/04 07:05:15
Done.
|
| + |
| + // Make the label multiline and there is no tooltip. |
| label.SetMultiLine(true); |
| EXPECT_FALSE(label.GetTooltipText(gfx::Point(), &tooltip)); |