| 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 "ui/views/controls/label.h" | 5 #include "ui/views/controls/label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 PerformMouseDragTo(gfx::Point()); | 916 PerformMouseDragTo(gfx::Point()); |
| 917 EXPECT_STR_EQ("Label drag", GetSelectedText()); | 917 EXPECT_STR_EQ("Label drag", GetSelectedText()); |
| 918 | 918 |
| 919 PerformMouseDragTo(gfx::Point(200, 0)); | 919 PerformMouseDragTo(gfx::Point(200, 0)); |
| 920 PerformMouseRelease(gfx::Point(200, 0)); | 920 PerformMouseRelease(gfx::Point(200, 0)); |
| 921 EXPECT_STR_EQ("drag word", GetSelectedText()); | 921 EXPECT_STR_EQ("drag word", GetSelectedText()); |
| 922 } | 922 } |
| 923 | 923 |
| 924 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 924 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 925 // Verify selection clipboard behavior on text selection. Disabled due to | 925 // Verify selection clipboard behavior on text selection. |
| 926 // http://crbug.com/396477. | 926 TEST_F(LabelSelectionTest, SelectionClipboard) { |
| 927 TEST_F(LabelSelectionTest, DISABLED_SelectionClipboard) { | |
| 928 label()->SetText(ASCIIToUTF16("Label selection clipboard")); | 927 label()->SetText(ASCIIToUTF16("Label selection clipboard")); |
| 929 label()->SizeToPreferredSize(); | 928 label()->SizeToPreferredSize(); |
| 930 ASSERT_TRUE(label()->SetSelectable(true)); | 929 ASSERT_TRUE(label()->SetSelectable(true)); |
| 931 | 930 |
| 932 // Verify programmatic modification of selection, does not modify the | 931 // Verify programmatic modification of selection, does not modify the |
| 933 // selection clipboard. | 932 // selection clipboard. |
| 934 label()->SelectRange(gfx::Range(2, 5)); | 933 label()->SelectRange(gfx::Range(2, 5)); |
| 935 EXPECT_STR_EQ("bel", GetSelectedText()); | 934 EXPECT_STR_EQ("bel", GetSelectedText()); |
| 936 EXPECT_TRUE(GetSelectionClipboardText().empty()); | 935 EXPECT_TRUE(GetSelectionClipboardText().empty()); |
| 937 | 936 |
| 938 // Verify text selection using the mouse updates the selection clipboard. | 937 // Verify text selection using the mouse updates the selection clipboard. |
| 939 PerformMousePress(GetCursorPoint(5)); | 938 PerformMousePress(GetCursorPoint(5)); |
| 940 PerformMouseDragTo(gfx::Point()); | 939 PerformMouseDragTo(gfx::Point()); |
| 941 PerformMouseRelease(gfx::Point()); | 940 PerformMouseRelease(gfx::Point()); |
| 942 EXPECT_STR_EQ("Label", GetSelectedText()); | 941 EXPECT_STR_EQ("Label", GetSelectedText()); |
| 943 EXPECT_STR_EQ("Label", GetSelectionClipboardText()); | 942 EXPECT_STR_EQ("Label", GetSelectionClipboardText()); |
| 944 } | 943 } |
| 945 #endif | 944 #endif |
| 946 | 945 |
| 947 } // namespace views | 946 } // namespace views |
| OLD | NEW |