| Index: third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| index 38be4a4e2c804612d0a7c9e67f5c6d0b1b98715b..bdc49ba36fe33ae93a1fd51075b1710fc92e3aec 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
|
| @@ -14,7 +14,7 @@ using testing::ElementsAre;
|
| namespace blink {
|
| namespace {
|
|
|
| -static PaintProperties samplePaintProperties() { return PaintProperties(); }
|
| +static PaintProperties rootPaintProperties() { return PaintProperties(); }
|
|
|
| class PaintChunkerTest : public testing::Test {
|
| protected:
|
| @@ -41,33 +41,33 @@ TEST_F(PaintChunkerTest, Empty)
|
| TEST_F(PaintChunkerTest, SingleNonEmptyRange)
|
| {
|
| PaintChunker chunker;
|
| - chunker.updateCurrentPaintProperties(samplePaintProperties());
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| chunker.incrementDisplayItemIndex();
|
| chunker.incrementDisplayItemIndex();
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(
|
| - PaintChunk(0, 2, samplePaintProperties())));
|
| + PaintChunk(0, 2, rootPaintProperties())));
|
| }
|
|
|
| TEST_F(PaintChunkerTest, SamePropertiesTwiceCombineIntoOneChunk)
|
| {
|
| PaintChunker chunker;
|
| - chunker.updateCurrentPaintProperties(samplePaintProperties());
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| chunker.incrementDisplayItemIndex();
|
| chunker.incrementDisplayItemIndex();
|
| - chunker.updateCurrentPaintProperties(samplePaintProperties());
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| chunker.incrementDisplayItemIndex();
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(
|
| - PaintChunk(0, 3, samplePaintProperties())));
|
| + PaintChunk(0, 3, rootPaintProperties())));
|
| }
|
|
|
| TEST_F(PaintChunkerTest, CanRewindDisplayItemIndex)
|
| {
|
| PaintChunker chunker;
|
| - chunker.updateCurrentPaintProperties(samplePaintProperties());
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| chunker.incrementDisplayItemIndex();
|
| chunker.incrementDisplayItemIndex();
|
| chunker.decrementDisplayItemIndex();
|
| @@ -75,11 +75,61 @@ TEST_F(PaintChunkerTest, CanRewindDisplayItemIndex)
|
| Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
|
|
| EXPECT_THAT(chunks, ElementsAre(
|
| - PaintChunk(0, 2, samplePaintProperties())));
|
| + PaintChunk(0, 2, rootPaintProperties())));
|
| }
|
|
|
| -// TODO(jbroman): Add more tests one it is possible for there to be two distinct
|
| -// PaintProperties.
|
| +TEST_F(PaintChunkerTest, BuildMultipleChunksWithSinglePropertyChanging)
|
| +{
|
| + PaintChunker chunker;
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| + chunker.incrementDisplayItemIndex();
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + PaintProperties aTransform;
|
| + aTransform.transformIndex = 1;
|
| + chunker.updateCurrentPaintProperties(aTransform);
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + PaintProperties bTransform;
|
| + bTransform.transformIndex = 2;
|
| + chunker.updateCurrentPaintProperties(bTransform);
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
| +
|
| + EXPECT_THAT(chunks, ElementsAre(
|
| + PaintChunk(0, 2, rootPaintProperties()),
|
| + PaintChunk(2, 3, aTransform),
|
| + PaintChunk(3, 4, bTransform)));
|
| +}
|
| +
|
| +TEST_F(PaintChunkerTest, BuildLinearChunksFromNestedTransforms)
|
| +{
|
| + // Test that "nested" transforms linearize using the following
|
| + // sequence of transforms and display items:
|
| + // <root xform>, <paint>, <a xform>, <paint>, <paint>, </a xform>, <paint>, </root xform>
|
| + PaintChunker chunker;
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + PaintProperties aTransform;
|
| + aTransform.transformIndex = 1;
|
| + chunker.updateCurrentPaintProperties(aTransform);
|
| + chunker.incrementDisplayItemIndex();
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + chunker.updateCurrentPaintProperties(rootPaintProperties());
|
| + chunker.incrementDisplayItemIndex();
|
| +
|
| + Vector<PaintChunk> chunks = chunker.releasePaintChunks();
|
| +
|
| + EXPECT_THAT(chunks, ElementsAre(
|
| + PaintChunk(0, 1, rootPaintProperties()),
|
| + PaintChunk(1, 3, aTransform),
|
| + PaintChunk(3, 4, rootPaintProperties())));
|
| +}
|
| +
|
| +// TODO(pdr): Add more tests once we have more paint properties.
|
|
|
| } // namespace
|
| } // namespace blink
|
|
|