MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST_F

Function TEST_F

snap_drawing/test/src/Layer_tests.cpp:46–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46TEST_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
95TEST_F(LayerTests, visitsChildAgainAfterReinsertion) {
96 auto container = createLayer();

Callers

nothing calls this directly

Calls 15

childNeedsDisplayMethod · 0.80
setNeedsDisplayMethod · 0.80
isVisibleMethod · 0.80
setRectMethod · 0.80
setMaskLayerMethod · 0.80
setPositioningMethod · 0.80
setBackgroundColorMethod · 0.80
drawMethod · 0.65
SizeClass · 0.50
addChildMethod · 0.45
needsDisplayMethod · 0.45

Tested by

no test coverage detected