OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
10 #include "cc/layers/painted_scrollbar_layer.h" | 10 #include "cc/layers/painted_scrollbar_layer.h" |
11 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
12 #include "cc/test/layer_tree_pixel_test.h" | 12 #include "cc/test/layer_tree_pixel_test.h" |
13 #include "cc/test/pixel_comparator.h" | |
14 #include "cc/test/test_in_process_context_provider.h" | 13 #include "cc/test/test_in_process_context_provider.h" |
15 #include "gpu/command_buffer/client/gles2_interface.h" | 14 #include "gpu/command_buffer/client/gles2_interface.h" |
16 | 15 |
17 #if !defined(OS_ANDROID) | 16 #if !defined(OS_ANDROID) |
18 | 17 |
19 namespace cc { | 18 namespace cc { |
20 namespace { | 19 namespace { |
21 | 20 |
22 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest { | 21 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest { |
23 protected: | 22 protected: |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 156 |
158 // Let's show the bottom right of the layer, so we know the texture wasn't | 157 // Let's show the bottom right of the layer, so we know the texture wasn't |
159 // just cut off. | 158 // just cut off. |
160 layer->SetPosition( | 159 layer->SetPosition( |
161 gfx::PointF(-10.f * scale + 400.f, -400.f * scale + 400.f)); | 160 gfx::PointF(-10.f * scale + 400.f, -400.f * scale + 400.f)); |
162 | 161 |
163 gfx::Transform scale_transform; | 162 gfx::Transform scale_transform; |
164 scale_transform.Scale(scale, scale); | 163 scale_transform.Scale(scale, scale); |
165 layer->SetTransform(scale_transform); | 164 layer->SetTransform(scale_transform); |
166 | 165 |
167 // The edges are antialiased and get off-by-one differences. | |
168 float percentage_pixels_large_error = 0.80125f; | |
169 float percentage_pixels_small_error = 0.f; | |
170 float average_error_allowed_in_bad_pixels = 1.f; | |
171 int large_error_allowed = 1; | |
172 int small_error_allowed = 0; | |
173 pixel_comparator_.reset(new FuzzyPixelComparator( | |
174 true, // discard_alpha | |
175 percentage_pixels_large_error, percentage_pixels_small_error, | |
176 average_error_allowed_in_bad_pixels, large_error_allowed, | |
177 small_error_allowed)); | |
178 | |
179 RunPixelTest(PIXEL_TEST_GL, background, | 166 RunPixelTest(PIXEL_TEST_GL, background, |
180 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); | 167 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); |
181 } | 168 } |
182 | 169 |
183 } // namespace | 170 } // namespace |
184 } // namespace cc | 171 } // namespace cc |
185 | 172 |
186 #endif // OS_ANDROID | 173 #endif // OS_ANDROID |
OLD | NEW |