chromium/components/viz/service/display/draw_polygon_unittest.cc

// 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.

#include <stddef.h>

#include <algorithm>
#include <cmath>
#include <limits>
#include <numbers>
#include <utility>
#include <vector>

#include "base/containers/contains.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "components/viz/service/display/bsp_compare_result.h"
#include "components/viz/service/display/draw_polygon.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/transform.h"

namespace viz {

#if !BUILDFLAG(IS_WIN)
void DrawPolygon::RecomputeNormalForTesting() {}
#endif

static int sign(float v) {}

bool IsPlanarForTesting(const DrawPolygon& p) {}

bool IsConvexForTesting(const DrawPolygon& p) {}

namespace {

#define CREATE_NEW_DRAW_POLYGON(name, points_vector, normal, polygon_id)

#define CREATE_NEW_DRAW_POLYGON_PTR(name, points_vector, normal, polygon_id)

#define CREATE_TEST_DRAW_FORWARD_POLYGON(name, points_vector, id)

#define CREATE_TEST_DRAW_REVERSE_POLYGON(name, points_vector, id)

#define EXPECT_FLOAT_WITHIN_EPSILON_OF(a, b)

#define EXPECT_POINT_EQ(point_a, point_b)

#define EXPECT_NORMAL(poly, n_x, n_y, n_z)

static void ValidatePoints(const DrawPolygon& polygon,
                           const std::vector<gfx::Point3F>& points) {}

static void ValidatePointsWithinDeltaOf(const DrawPolygon& polygon,
                                        const std::vector<gfx::Point3F>& points,
                                        float delta) {}

// A simple square in a plane.
TEST(DrawPolygonConstructionTest, NormalNormal) {}

// More complicated shapes.
TEST(DrawPolygonConstructionTest, TestNormal) {}

TEST(DrawPolygonConstructionTest, ClippedNormal) {}

TEST(DrawPolygonConstructionTest, SlimTriangleNormal) {}

TEST(DrawPolygonConstructionTest, ManyVertexNormal) {}

// A simple rect being transformed.
TEST(DrawPolygonConstructionTest, SimpleNormal) {}

TEST(DrawPolygonConstructionTest, NormalInvertXY) {}

TEST(DrawPolygonConstructionTest, NormalInvertXZ) {}

TEST(DrawPolygonConstructionTest, NormalInvertYZ) {}

TEST(DrawPolygonConstructionTest, NormalRotate90) {}

TEST(DrawPolygonConstructionTest, InvertXNormal) {}

TEST(DrawPolygonConstructionTest, InvertYNormal) {}

TEST(DrawPolygonConstructionTest, InvertZNormal) {}

// Two quads are nearly touching but definitely ordered. Second one should
// compare in front.
TEST(DrawPolygonSplitTest, NearlyTouchingOrder) {}

// Two quads are definitely not touching and so no split should occur.
TEST(DrawPolygonSplitTest, NotClearlyInFront) {}

// Two quads are definitely not touching and so no split should occur.
TEST(DrawPolygonSplitTest, NotTouchingNoSplit) {}

// One quad is resting against another, but doesn't cross its plane so no
// split
// should occur.
TEST(DrawPolygonSplitTest, BarelyTouchingNoSplit) {}

// One quad intersects a pent with an occluded side.
TEST(DrawPolygonSplitTest, SlimClip) {}

// One quad intersects another and becomes two pieces.
TEST(DrawPolygonSplitTest, BasicSplit) {}

// In this test we cut the corner of a quad so that it creates a triangle and
// a pentagon as a result.
TEST(DrawPolygonSplitTest, AngledSplit) {}

// This test was derived from crbug.com/693826. An almost coplanar
// pair of polygons are used for splitting. In this case, the
// splitting plane distance signs are [ 0 0 + - ]. This configuration
// represents a case where snapping to the splitting plane causes the
// polygon to become twisted. Splitting should still give a valid
// result, indicated by all four of the input split polygon vertices
// being present in the output polygons.
TEST(DrawPolygonSplitTest, AlmostCoplanarSplit) {}

// In this test we cut the corner of a quad so that it creates a triangle and
// a pentagon as a result, and then cut the pentagon.
TEST(DrawPolygonSplitTest, DoubleSplit) {}

// This test was derived from crbug.com/1264787.
TEST(DrawPolygonSplitTest, SplitNoNaNs) {}

// This test was derived from crbug.com/1264787.
TEST(DrawPolygonSplitTest, SplitNoInfs) {}

TEST(DrawPolygonTransformTest, TransformNormal) {}

}  // namespace
}  // namespace viz