diff options
-rw-r--r-- | cc/layers/solid_color_layer_impl_unittest.cc | 2 | ||||
-rw-r--r-- | cc/layers/tiled_layer_impl_unittest.cc | 14 | ||||
-rw-r--r-- | cc/test/layer_test_common.cc | 56 | ||||
-rw-r--r-- | cc/test/layer_test_common.h | 21 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 6 |
5 files changed, 48 insertions, 51 deletions
diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc index 8943035..12796fa 100644 --- a/cc/layers/solid_color_layer_impl_unittest.cc +++ b/cc/layers/solid_color_layer_impl_unittest.cc @@ -38,7 +38,7 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) { AppendQuadsData data; layer->AppendQuads(&quad_culler, &data); - LayerTestCommon::verifyQuadsExactlyCoverRect(quad_culler.quadList(), + LayerTestCommon::VerifyQuadsExactlyCoverRect(quad_culler.quadList(), visible_content_rect); } diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc index 994e8b7..0d1b87f 100644 --- a/cc/layers/tiled_layer_impl_unittest.cc +++ b/cc/layers/tiled_layer_impl_unittest.cc @@ -192,7 +192,7 @@ class TiledLayerImplBorderTest : public TiledLayerImplTest { layer_size, borders, gfx::Rect(gfx::Point(), layer_size)); - LayerTestCommon::verifyQuadsExactlyCoverRect( + LayerTestCommon::VerifyQuadsExactlyCoverRect( quads, gfx::Rect(gfx::Point(), layer_size)); } @@ -212,7 +212,7 @@ class TiledLayerImplBorderTest : public TiledLayerImplTest { gfx::Size(250, 250), LayerTilingData::NO_BORDER_TEXELS, visible_content_rect); - LayerTestCommon::verifyQuadsExactlyCoverRect(quads, visible_content_rect); + LayerTestCommon::VerifyQuadsExactlyCoverRect(quads, visible_content_rect); } void CoverageVisibleRectIntersectsBounds( @@ -227,7 +227,7 @@ class TiledLayerImplBorderTest : public TiledLayerImplTest { layer_size, LayerTilingData::NO_BORDER_TEXELS, visible_content_rect); - LayerTestCommon::verifyQuadsExactlyCoverRect(quads, visible_content_rect); + LayerTestCommon::VerifyQuadsExactlyCoverRect(quads, visible_content_rect); } }; WITH_AND_WITHOUT_BORDER_TEST(CoverageVisibleRectOnTileBoundaries); @@ -251,13 +251,13 @@ TEST_F(TiledLayerImplTest, TextureInfoForLayerNoBorders) { for (size_t i = 0; i < quads.size(); ++i) { const TileDrawQuad* quad = TileDrawQuad::MaterialCast(quads[i]); - EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quadString << i; + EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quad_string << i; EXPECT_EQ(gfx::RectF(gfx::PointF(), tile_size), quad->tex_coord_rect) - << LayerTestCommon::quadString << i; - EXPECT_EQ(tile_size, quad->texture_size) << LayerTestCommon::quadString + << LayerTestCommon::quad_string << i; + EXPECT_EQ(tile_size, quad->texture_size) << LayerTestCommon::quad_string << i; EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect) - << LayerTestCommon::quadString << i; + << LayerTestCommon::quad_string << i; } } diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 997e08e..fcd09d4 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -15,45 +15,45 @@ #include "ui/gfx/size_conversions.h" namespace cc { -namespace LayerTestCommon { -// Align with expected and actual output -const char* quadString = " Quad: "; +// Align with expected and actual output. +const char* LayerTestCommon::quad_string = " Quad: "; -bool canRectFBeSafelyRoundedToRect(const gfx::RectF& r) -{ - // Ensure that range of float values is not beyond integer range. - if (!r.IsExpressibleAsRect()) - return false; +static bool CanRectFBeSafelyRoundedToRect(gfx::RectF r) { + // Ensure that range of float values is not beyond integer range. + if (!r.IsExpressibleAsRect()) + return false; - // Ensure that the values are actually integers. - if (gfx::ToFlooredPoint(r.origin()) == r.origin() && gfx::ToFlooredSize(r.size()) == r.size()) - return true; + // Ensure that the values are actually integers. + if (gfx::ToFlooredPoint(r.origin()) == r.origin() && + gfx::ToFlooredSize(r.size()) == r.size()) + return true; - return false; + return false; } -void verifyQuadsExactlyCoverRect(const cc::QuadList& quads, - const gfx::Rect& rect) { - cc::Region remaining = rect; +void LayerTestCommon::VerifyQuadsExactlyCoverRect(const cc::QuadList& quads, + gfx::Rect rect) { + cc::Region remaining = rect; - for (size_t i = 0; i < quads.size(); ++i) { - cc::DrawQuad* quad = quads[i]; - gfx::RectF quadRectF = cc::MathUtil::MapClippedRect(quad->quadTransform(), gfx::RectF(quad->rect)); + for (size_t i = 0; i < quads.size(); ++i) { + cc::DrawQuad* quad = quads[i]; + gfx::RectF quad_rectf = + cc::MathUtil::MapClippedRect(quad->quadTransform(), + gfx::RectF(quad->rect)); - // Before testing for exact coverage in the integer world, assert that rounding - // will not round the rect incorrectly. - ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF)); + // Before testing for exact coverage in the integer world, assert that + // rounding will not round the rect incorrectly. + ASSERT_TRUE(CanRectFBeSafelyRoundedToRect(quad_rectf)); - gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF); + gfx::Rect quad_rect = gfx::ToEnclosingRect(quad_rectf); - EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i; - EXPECT_TRUE(remaining.Contains(quadRect)) << quadString << i; - remaining.Subtract(quadRect); - } + EXPECT_TRUE(rect.Contains(quad_rect)) << quad_string << i; + EXPECT_TRUE(remaining.Contains(quad_rect)) << quad_string << i; + remaining.Subtract(quad_rect); + } - EXPECT_TRUE(remaining.IsEmpty()); + EXPECT_TRUE(remaining.IsEmpty()); } -} // namespace LayerTestCommon } // namespace cc diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 4b6ba83..5c0bb29 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -5,22 +5,19 @@ #ifndef CC_TEST_LAYER_TEST_COMMON_H_ #define CC_TEST_LAYER_TEST_COMMON_H_ -namespace cc { -class QuadList; -} - -namespace gfx { -class Rect; -} +namespace gfx { class Rect; } namespace cc { -namespace LayerTestCommon { +class QuadList; -extern const char* quadString; +class LayerTestCommon { + public: + static const char* quad_string; -void verifyQuadsExactlyCoverRect(const cc::QuadList&, const gfx::Rect&); + static void VerifyQuadsExactlyCoverRect(const cc::QuadList& quads, + gfx::Rect rect); +}; -} // namespace LayerTestCommon -} // namespace cc +} // namespace cc #endif // CC_TEST_LAYER_TEST_COMMON_H_ diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index ad27935..50bde5f 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -2022,7 +2022,7 @@ TEST_F(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(0u, numGutterQuads); EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); - LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); + LayerTestCommon::VerifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); m_hostImpl->DidDrawAllLayers(frame); } @@ -2045,7 +2045,7 @@ TEST_F(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(1u, numGutterQuads); EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); - LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); + LayerTestCommon::VerifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); m_hostImpl->DidDrawAllLayers(frame); } @@ -2068,7 +2068,7 @@ TEST_F(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(4u, numGutterQuads); EXPECT_EQ(5u, frame.render_passes[0]->quad_list.size()); - LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); + LayerTestCommon::VerifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize)); m_hostImpl->DidDrawAllLayers(frame); } |