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

Unified Diff: cc/layer_sorter_unittest.cc

Issue 11362024: added fix that deals with precision in layer sorter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« cc/layer_sorter.cc ('K') | « cc/layer_sorter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_sorter_unittest.cc
diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc
index 941bd725158d8daa57b8a1c9ab99f4e327b1e356..2868e8de38ecbc73efa8d1375786e57e749a3b51 100644
--- a/cc/layer_sorter_unittest.cc
+++ b/cc/layer_sorter_unittest.cc
@@ -264,4 +264,45 @@ TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff)
EXPECT_EQ(5, layerList[4]->id());
}
+TEST(LayerSorterTest, verifyConcidentLayerPrecisionLossResultsInDocumentOrder)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ scoped_ptr<LayerImpl> layer1 = LayerImpl::create(1);
+ scoped_ptr<LayerImpl> layer2 = LayerImpl::create(2);
+
+ WebTransformationMatrix BehindMatrix;
+ BehindMatrix.translate3d(0, 0, 0.999999f);
+ BehindMatrix.rotate3d(38.5f, 77.0f, 0);
+ WebTransformationMatrix FrontMatrix;
+ FrontMatrix.translate3d(0, 0, 1.0f);
+ FrontMatrix.rotate3d(38.5f, 77.0f, 0);
+
+ layer1->setBounds(IntSize(10, 10));
+ layer1->setContentBounds(IntSize(10, 10));
+ layer1->setDrawTransform(BehindMatrix);
+ layer1->setDrawsContent(true);
+
+ layer2->setBounds(IntSize(10, 10));
+ layer2->setContentBounds(IntSize(10, 10));
+ layer2->setDrawTransform(FrontMatrix);
+ layer2->setDrawsContent(true);
+
+ std::vector<LayerImpl*> layerList;
+ layerList.push_back(layer1.get());
enne (OOO) 2012/11/01 20:08:55 Does this test pass before this patch? I thought p
+ layerList.push_back(layer2.get());
+
+ ASSERT_EQ(static_cast<size_t>(2), layerList.size());
+ EXPECT_EQ(1, layerList[0]->id());
+ EXPECT_EQ(2, layerList[1]->id());
+
+ LayerSorter layerSorter;
+ layerSorter.sort(layerList.begin(), layerList.end());
+
+ ASSERT_EQ(static_cast<size_t>(2), layerList.size());
+ EXPECT_EQ(1, layerList[0]->id());
+ EXPECT_EQ(2, layerList[1]->id());
+ EXPECT_FALSE(1.0f == 999999f);
enne (OOO) 2012/11/01 20:08:55 Missing a period here. Also, maybe better to actua
+}
+
} // namespace
« cc/layer_sorter.cc ('K') | « cc/layer_sorter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698