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

Unified Diff: ui/views/controls/label_unittest.cc

Issue 1161933007: ui: Introduce CanvasPainter, remove PaintContext(gfx::Canvas*). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvaspainter: . Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label_unittest.cc
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc
index 32fabd783a5968587a403bdd5259a2890813286f..47cb37ae44a3dc0b65852b6dd462d5e4b09beeb6 100644
--- a/ui/views/controls/label_unittest.cc
+++ b/ui/views/controls/label_unittest.cc
@@ -9,7 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/compositor/paint_context.h"
+#include "ui/compositor/canvas_painter.h"
#include "ui/gfx/canvas.h"
#include "ui/views/border.h"
#include "ui/views/test/focus_manager_test.h"
@@ -305,14 +305,14 @@ TEST_F(LabelTest, TextChangeWithoutLayout) {
label.SetBounds(0, 0, 200, 200);
gfx::Canvas canvas(gfx::Size(200, 200), 1.0f, true);
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(1u, label.lines_.size());
EXPECT_EQ(ASCIIToUTF16("Example"), label.lines_[0]->GetDisplayText());
label.SetText(ASCIIToUTF16("Altered"));
// The altered text should be painted even though Layout() or SetBounds() are
// not called.
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(1u, label.lines_.size());
EXPECT_EQ(ASCIIToUTF16("Altered"), label.lines_[0]->GetDisplayText());
}
@@ -482,7 +482,7 @@ TEST_F(LabelTest, MultiLineSizingWithElide) {
// Paint() doesn't change the preferred size.
gfx::Canvas canvas;
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(narrow_size.ToString(), label.GetPreferredSize().ToString());
}
@@ -555,7 +555,7 @@ TEST_F(LabelTest, ResetRenderTextData) {
EXPECT_EQ(0u, label.lines_.size());
gfx::Canvas canvas(preferred_size, 1.0f, true);
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(1u, label.lines_.size());
// Label should recreate its RenderText object when it's invisible, to release
@@ -575,14 +575,14 @@ TEST_F(LabelTest, ResetRenderTextData) {
label.SetVisible(true);
EXPECT_EQ(0u, label.lines_.size());
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(1u, label.lines_.size());
// Changing layout just resets |lines_|. It'll recover next time it's drawn.
label.SetBounds(0, 0, 10, 10);
EXPECT_EQ(0u, label.lines_.size());
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
EXPECT_EQ(1u, label.lines_.size());
}
@@ -597,7 +597,7 @@ TEST_F(LabelTest, MultilineSupportedRenderText) {
label.SizeToPreferredSize();
gfx::Canvas canvas(label.GetPreferredSize(), 1.0f, true);
- label.Paint(ui::PaintContext(&canvas));
+ label.Paint(ui::CanvasPainter(&canvas, 1.f).context());
// There's only one 'line', RenderText itself supports multiple lines.
EXPECT_EQ(1u, label.lines_.size());
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698