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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 2654853002: Remove gfx::Canvas::DrawStringRectWithHalo. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | ui/gfx/canvas.h » ('j') | ui/gfx/render_text.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 9150bf55b9216013fb32ccb81e726127801c3e4c..2ce0e29ccc6fe1b4de5250ac36efb963011e9a2d 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -96,15 +96,13 @@ class ColoredLayer : public Layer, public LayerDelegate {
class DrawStringLayerDelegate : public LayerDelegate {
public:
enum DrawFunction {
msw 2017/01/25 18:09:07 Please remove this enum with only one value
Evan Stade 2017/01/26 00:43:10 Done.
- STRING_WITH_HALO,
STRING_FADED,
};
DrawStringLayerDelegate(
- SkColor back_color, SkColor halo_color,
+ SkColor back_color,
DrawFunction func, const gfx::Size& layer_size)
: background_color_(back_color),
- halo_color_(halo_color),
func_(func),
layer_size_(layer_size) {
}
@@ -118,10 +116,6 @@ class DrawStringLayerDelegate : public LayerDelegate {
recorder.canvas()->DrawColor(background_color_);
const base::string16 text = base::ASCIIToUTF16("Tests!");
switch (func_) {
- case STRING_WITH_HALO:
- recorder.canvas()->DrawStringRectWithHalo(
- text, font_list_, SK_ColorRED, halo_color_, bounds, 0);
- break;
case STRING_FADED:
recorder.canvas()->DrawFadedString(
text, font_list_, SK_ColorRED, bounds, 0);
@@ -137,7 +131,6 @@ class DrawStringLayerDelegate : public LayerDelegate {
private:
const SkColor background_color_;
- const SkColor halo_color_;
const DrawFunction func_;
const gfx::FontList font_list_;
const gfx::Size layer_size_;
@@ -1450,40 +1443,6 @@ TEST_F(LayerWithRealCompositorTest, ModifyHierarchy) {
// So we choose to check result only on Windows.
// See https://codereview.chromium.org/1634103003/#msg41
#if defined(OS_WIN)
-TEST_F(LayerWithRealCompositorTest, CanvasDrawStringRectWithHalo) {
- gfx::Size size(50, 50);
- GetCompositor()->SetScaleAndSize(1.0f, size);
- DrawStringLayerDelegate delegate(SK_ColorBLUE, SK_ColorWHITE,
- DrawStringLayerDelegate::STRING_WITH_HALO,
- size);
- std::unique_ptr<Layer> layer(
- CreateDrawStringLayer(gfx::Rect(size), &delegate));
- DrawTree(layer.get());
-
- SkBitmap bitmap;
- ReadPixels(&bitmap);
- ASSERT_FALSE(bitmap.empty());
-
- base::FilePath ref_img =
- test_data_directory().AppendASCII("string_with_halo.png");
- // WritePNGFile(bitmap, ref_img, true);
-
- float percentage_pixels_large_error = 1.0f;
- float percentage_pixels_small_error = 0.0f;
- float average_error_allowed_in_bad_pixels = 1.f;
- int large_error_allowed = 1;
- int small_error_allowed = 0;
-
- EXPECT_TRUE(MatchesPNGFile(bitmap, ref_img,
- cc::FuzzyPixelComparator(
- true,
- percentage_pixels_large_error,
- percentage_pixels_small_error,
- average_error_allowed_in_bad_pixels,
- large_error_allowed,
- small_error_allowed)));
-}
-
TEST_F(LayerWithRealCompositorTest, CanvasDrawFadedString) {
gfx::Size size(50, 50);
GetCompositor()->SetScaleAndSize(1.0f, size);
« no previous file with comments | « no previous file | ui/gfx/canvas.h » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698