| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // All text sizing measurements (width and height) should be greater than this. | 45 // All text sizing measurements (width and height) should be greater than this. |
| 46 const int kMinTextDimension = 4; | 46 const int kMinTextDimension = 4; |
| 47 | 47 |
| 48 class TestLabel : public Label { | 48 class TestLabel : public Label { |
| 49 public: | 49 public: |
| 50 TestLabel() : Label(ASCIIToUTF16("TestLabel")) { SizeToPreferredSize(); } | 50 TestLabel() : Label(ASCIIToUTF16("TestLabel")) { SizeToPreferredSize(); } |
| 51 | 51 |
| 52 int schedule_paint_count() const { return schedule_paint_count_; } | 52 int schedule_paint_count() const { return schedule_paint_count_; } |
| 53 | 53 |
| 54 void SimulatePaint() { | 54 void SimulatePaint() { |
| 55 gfx::Canvas canvas(bounds().size(), 1.0, false /* is_opaque */); | 55 SkBitmap bitmap; |
| 56 Paint(ui::CanvasPainter(&canvas, 1.f).context()); | 56 SkColor color = SK_ColorTRANSPARENT; |
| 57 Paint(ui::CanvasPainter(&bitmap, bounds().size(), 1.f, color).context()); |
| 57 } | 58 } |
| 58 | 59 |
| 59 // View: | 60 // View: |
| 60 void SchedulePaintInRect(const gfx::Rect& r) override { | 61 void SchedulePaintInRect(const gfx::Rect& r) override { |
| 61 ++schedule_paint_count_; | 62 ++schedule_paint_count_; |
| 62 Label::SchedulePaintInRect(r); | 63 Label::SchedulePaintInRect(r); |
| 63 } | 64 } |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 int schedule_paint_count_ = 0; | 67 int schedule_paint_count_ = 0; |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 label()->SetObscured(false); | 1113 label()->SetObscured(false); |
| 1113 | 1114 |
| 1114 // For an empty label, both COPY and SELECT_ALL should be disabled. | 1115 // For an empty label, both COPY and SELECT_ALL should be disabled. |
| 1115 label()->SetText(base::string16()); | 1116 label()->SetText(base::string16()); |
| 1116 ASSERT_TRUE(label()->SetSelectable(true)); | 1117 ASSERT_TRUE(label()->SetSelectable(true)); |
| 1117 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_COPY)); | 1118 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_COPY)); |
| 1118 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_SELECT_ALL)); | 1119 EXPECT_FALSE(IsMenuCommandEnabled(IDS_APP_SELECT_ALL)); |
| 1119 } | 1120 } |
| 1120 | 1121 |
| 1121 } // namespace views | 1122 } // namespace views |
| OLD | NEW |