| 44 | }; |
| 45 | |
| 46 | TEST_F(LayerTests, visitsChildrenOnDraw) { |
| 47 | auto metrics = draw(); |
| 48 | ASSERT_EQ(1, metrics.drawCacheMiss); |
| 49 | ASSERT_EQ(1, metrics.visitedLayers); |
| 50 | |
| 51 | auto container = createLayer(); |
| 52 | auto child1 = createLayer(); |
| 53 | auto child2 = createLayer(); |
| 54 | |
| 55 | _root->addChild(container); |
| 56 | container->addChild(child1); |
| 57 | container->addChild(child2); |
| 58 | |
| 59 | ASSERT_FALSE(_root->needsDisplay()); |
| 60 | ASSERT_TRUE(_root->childNeedsDisplay()); |
| 61 | ASSERT_TRUE(container->needsDisplay()); |
| 62 | ASSERT_TRUE(container->childNeedsDisplay()); |
| 63 | ASSERT_TRUE(child1->needsDisplay()); |
| 64 | ASSERT_TRUE(child1->childNeedsDisplay()); |
| 65 | ASSERT_TRUE(child2->needsDisplay()); |
| 66 | ASSERT_TRUE(child2->childNeedsDisplay()); |
| 67 | |
| 68 | metrics = draw(); |
| 69 | ASSERT_EQ(3, metrics.drawCacheMiss); |
| 70 | ASSERT_EQ(4, metrics.visitedLayers); |
| 71 | |
| 72 | ASSERT_FALSE(_root->needsDisplay()); |
| 73 | ASSERT_FALSE(_root->childNeedsDisplay()); |
| 74 | ASSERT_FALSE(container->needsDisplay()); |
| 75 | ASSERT_FALSE(container->childNeedsDisplay()); |
| 76 | ASSERT_FALSE(child1->needsDisplay()); |
| 77 | ASSERT_FALSE(child1->childNeedsDisplay()); |
| 78 | ASSERT_FALSE(child2->needsDisplay()); |
| 79 | ASSERT_FALSE(child2->childNeedsDisplay()); |
| 80 | |
| 81 | metrics = draw(); |
| 82 | ASSERT_EQ(0, metrics.drawCacheMiss); |
| 83 | ASSERT_EQ(0, metrics.visitedLayers); |
| 84 | |
| 85 | ASSERT_FALSE(_root->needsDisplay()); |
| 86 | ASSERT_FALSE(_root->childNeedsDisplay()); |
| 87 | ASSERT_FALSE(container->needsDisplay()); |
| 88 | ASSERT_FALSE(container->childNeedsDisplay()); |
| 89 | ASSERT_FALSE(child1->needsDisplay()); |
| 90 | ASSERT_FALSE(child1->childNeedsDisplay()); |
| 91 | ASSERT_FALSE(child2->needsDisplay()); |
| 92 | ASSERT_FALSE(child2->childNeedsDisplay()); |
| 93 | } |
| 94 | |
| 95 | TEST_F(LayerTests, visitsChildAgainAfterReinsertion) { |
| 96 | auto container = createLayer(); |
nothing calls this directly
no test coverage detected