// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "components/viz/service/display/bsp_tree.h" #include <stddef.h> #include <algorithm> #include <memory> #include <utility> #include "base/containers/circular_deque.h" #include "base/memory/raw_ptr.h" #include "components/viz/service/display/bsp_walk_action.h" #include "components/viz/service/display/draw_polygon.h" #include "testing/gtest/include/gtest/gtest.h" namespace viz { namespace { #define EXPECT_SORTED_LISTS_EQ(polygon_list, compare_list) … #define INT_VECTOR_FROM_ARRAY(array) … #define CREATE_DRAW_POLYGON(vertex_vector, normal, polygon_id) … class BspTreeTest { … }; // Simple standing quads all parallel with each other, causing no splits. TEST(BspTreeTest, NoSplit) { … } // Basic two polygon split, can be viewed as a + from above. TEST(BspTreeTest, BasicSplit) { … } // Same as above with the second quad offset so it doesn't intersect. One quad // should be very clearly on one side of the other, and no splitting should // occur. TEST(BspTreeTest, QuadOffset) { … } // Same as above, but this time we change the order in which the quads are // inserted into the tree, causing one to actually cross the plane of the other // and cause a split. TEST(BspTreeTest, QuadOffsetSplit) { … } // In addition to what can be viewed as a + from above, another piece of // geometry is inserted to cut these pieces right in the middle, viewed as // a quad from overhead. TEST(BspTreeTest, ThreeWaySplit) { … } // This test checks whether coplanar geometry, when inserted into the tree in // order, comes back in the same order as it should. TEST(BspTreeTest, Coplanar) { … } // A bunch of coplanar geometry should end up sharing a single node, and // result in the final piece of geometry splitting into just two pieces on // either side of the shared plane. TEST(BspTreeTest, CoplanarSplit) { … } } // namespace } // namespace viz