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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp

Issue 2725513002: Increment property tree sequence number when updating. (Closed)
Patch Set: Add comment. Created 3 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 unified diff | Download patch
OLDNEW
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 "platform/graphics/compositing/PaintArtifactCompositor.h" 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 EXPECT_EQ(translation(150, 150), maskingLayer->screen_space_transform()); 1757 EXPECT_EQ(translation(150, 150), maskingLayer->screen_space_transform());
1758 EXPECT_EQ(gfx::Size(100, 100), maskingLayer->bounds()); 1758 EXPECT_EQ(gfx::Size(100, 100), maskingLayer->bounds());
1759 const cc::EffectNode* maskingGroup = 1759 const cc::EffectNode* maskingGroup =
1760 propertyTrees().effect_tree.Node(maskingLayer->effect_tree_index()); 1760 propertyTrees().effect_tree.Node(maskingLayer->effect_tree_index());
1761 EXPECT_TRUE(maskingGroup->has_render_surface); 1761 EXPECT_TRUE(maskingGroup->has_render_surface);
1762 EXPECT_EQ(maskedGroup->id, maskingGroup->parent_id); 1762 EXPECT_EQ(maskedGroup->id, maskingGroup->parent_id);
1763 ASSERT_EQ(1u, maskingGroup->filters.size()); 1763 ASSERT_EQ(1u, maskingGroup->filters.size());
1764 EXPECT_EQ(cc::FilterOperation::REFERENCE, maskingGroup->filters.at(0).type()); 1764 EXPECT_EQ(cc::FilterOperation::REFERENCE, maskingGroup->filters.at(0).type());
1765 } 1765 }
1766 1766
1767 TEST_F(PaintArtifactCompositorTestWithPropertyTrees,
1768 UpdateProducesNewSequenceNumber) {
1769 // A 90 degree clockwise rotation about (100, 100).
1770 RefPtr<TransformPaintPropertyNode> transform =
1771 TransformPaintPropertyNode::create(
1772 TransformPaintPropertyNode::root(), TransformationMatrix().rotate(90),
1773 FloatPoint3D(100, 100, 0), false, 0, CompositingReason3DTransform);
1774
1775 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create(
1776 ClipPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
1777 FloatRoundedRect(100, 100, 300, 200));
1778
1779 RefPtr<EffectPaintPropertyNode> effect =
1780 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1781
1782 TestPaintArtifact artifact;
1783 artifact.chunk(transform, clip, effect)
1784 .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
1785 artifact
1786 .chunk(TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(),
1787 EffectPaintPropertyNode::root())
1788 .rectDrawing(FloatRect(0, 0, 100, 100), Color::gray);
1789 update(artifact.build());
1790
1791 // Two content layers for the differentiated rect drawings and three dummy
1792 // layers for each of the transform, clip and effect nodes.
1793 EXPECT_EQ(5u, rootLayer()->children().size());
1794 EXPECT_EQ(1, propertyTrees().sequence_number);
1795 for (auto layer : rootLayer()->children()) {
1796 EXPECT_EQ(1, layer->property_tree_sequence_number());
1797 }
1798
1799 update(artifact.build());
1800
1801 EXPECT_EQ(5u, rootLayer()->children().size());
1802 EXPECT_EQ(2, propertyTrees().sequence_number);
1803 for (auto layer : rootLayer()->children()) {
1804 EXPECT_EQ(2, layer->property_tree_sequence_number());
1805 }
1806
1807 update(artifact.build());
1808
1809 EXPECT_EQ(5u, rootLayer()->children().size());
1810 EXPECT_EQ(3, propertyTrees().sequence_number);
1811 for (auto layer : rootLayer()->children()) {
1812 EXPECT_EQ(3, layer->property_tree_sequence_number());
1813 }
1814 }
1815
1767 } // namespace blink 1816 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698