Narrow retained UI overlay lifetime debt
This commit is contained in:
@@ -210,6 +210,46 @@ void dispatch_uses_stable_connection_snapshot(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, second_count == 1);
|
||||
}
|
||||
|
||||
void destroy_subtree_clears_child_connections(pp::tests::Harness& h)
|
||||
{
|
||||
NodeLifetimeTree tree;
|
||||
const auto root = tree.create_root();
|
||||
PP_EXPECT(h, root);
|
||||
if (!root) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto child = tree.create_child(root.value());
|
||||
PP_EXPECT(h, child);
|
||||
if (!child) {
|
||||
return;
|
||||
}
|
||||
|
||||
int parent_count = 0;
|
||||
int child_count = 0;
|
||||
const auto root_connection = tree.connect(root.value(), [&parent_count](pp::ui::NodeHandle) {
|
||||
++parent_count;
|
||||
});
|
||||
const auto child_connection = tree.connect(child.value(), [&child_count](pp::ui::NodeHandle) {
|
||||
++child_count;
|
||||
});
|
||||
PP_EXPECT(h, root_connection);
|
||||
PP_EXPECT(h, child_connection);
|
||||
if (!root_connection || !child_connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
PP_EXPECT(h, tree.dispatch(child.value()).ok());
|
||||
PP_EXPECT(h, parent_count == 0);
|
||||
PP_EXPECT(h, child_count == 1);
|
||||
|
||||
PP_EXPECT(h, tree.destroy_subtree(root.value()).ok());
|
||||
PP_EXPECT(h, !tree.disconnect(root_connection.value()).ok());
|
||||
PP_EXPECT(h, !tree.disconnect(child_connection.value()).ok());
|
||||
PP_EXPECT(h, !tree.contains(root.value()));
|
||||
PP_EXPECT(h, !tree.contains(child.value()));
|
||||
}
|
||||
|
||||
void captures_and_releases_pointer_and_keyboard_nodes(pp::tests::Harness& h)
|
||||
{
|
||||
NodeLifetimeTree tree;
|
||||
@@ -320,6 +360,7 @@ int main()
|
||||
harness.run("destroying_node_disconnects_callbacks", destroying_node_disconnects_callbacks);
|
||||
harness.run("dispatch_survives_destroy_during_callback", dispatch_survives_destroy_during_callback);
|
||||
harness.run("dispatch_uses_stable_connection_snapshot", dispatch_uses_stable_connection_snapshot);
|
||||
harness.run("destroy_subtree_clears_child_connections", destroy_subtree_clears_child_connections);
|
||||
harness.run("captures_and_releases_pointer_and_keyboard_nodes", captures_and_releases_pointer_and_keyboard_nodes);
|
||||
harness.run("destroying_captured_node_releases_capture", destroying_captured_node_releases_capture);
|
||||
harness.run("clear_models_layout_reload", clear_models_layout_reload);
|
||||
|
||||
Reference in New Issue
Block a user