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 |