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

Unified Diff: cc/test/layer_tree_pixel_test.cc

Issue 12571010: cc: Add a pixel test for background blur outsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/pixel_comparator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_pixel_test.cc
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 86e3f30dd69acc247fa4a614a456187ed5b8a4f2..6e7b137c03a63349f394a361b886ea9a031732de 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -6,6 +6,7 @@
#include "base/path_service.h"
#include "cc/test/paths.h"
+#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test_utils.h"
#include "cc/trees/layer_tree_impl.h"
#include "ui/gl/gl_implementation.h"
@@ -14,7 +15,8 @@
namespace cc {
-LayerTreePixelTest::LayerTreePixelTest() {}
+LayerTreePixelTest::LayerTreePixelTest()
+ : pixel_comparator_(new ExactPixelComparator(true)) {}
LayerTreePixelTest::~LayerTreePixelTest() {}
@@ -66,8 +68,9 @@ void LayerTreePixelTest::SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
// To rebaseline:
// EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_)));
- EXPECT_TRUE(MatchesPNGFile(bitmap, test_data_dir.Append(ref_file_),
- ExactPixelComparator(true)));
+ EXPECT_TRUE(MatchesPNGFile(bitmap,
+ test_data_dir.Append(ref_file_),
+ *pixel_comparator_));
EndTest();
}
@@ -89,6 +92,34 @@ scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer(
return layer;
}
+scoped_refptr<SolidColorLayer> LayerTreePixelTest::
+ CreateSolidColorLayerWithBorder(
+ gfx::Rect rect, SkColor color, int border_width, SkColor border_color) {
+ scoped_refptr<SolidColorLayer> layer = CreateSolidColorLayer(rect, color);
+ scoped_refptr<SolidColorLayer> border_top = CreateSolidColorLayer(
+ gfx::Rect(0, 0, rect.width(), border_width), border_color);
+ scoped_refptr<SolidColorLayer> border_left = CreateSolidColorLayer(
+ gfx::Rect(0,
+ border_width,
+ border_width,
+ rect.height() - border_width * 2),
+ border_color);
+ scoped_refptr<SolidColorLayer> border_right = CreateSolidColorLayer(
+ gfx::Rect(rect.width() - border_width,
+ border_width,
+ border_width,
+ rect.height() - border_width * 2),
+ border_color);
+ scoped_refptr<SolidColorLayer> border_bottom = CreateSolidColorLayer(
+ gfx::Rect(0, rect.height() - border_width, rect.width(), border_width),
+ border_color);
+ layer->AddChild(border_top);
+ layer->AddChild(border_left);
+ layer->AddChild(border_right);
+ layer->AddChild(border_bottom);
+ return layer;
+}
+
void LayerTreePixelTest::RunPixelTest(
scoped_refptr<Layer> content_root,
base::FilePath file_name) {
« no previous file with comments | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/pixel_comparator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698