Blender V5.0
mesh_brush_common_tests.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
5
6#include "BLI_bit_span.hh"
7
8#include "BKE_idtype.hh"
9#include "BKE_lib_id.hh"
10
11#include "DNA_mesh_types.h"
12
14
15#include "CLG_log.h"
16
17#include "testing/testing.h"
18
20class MeshTests : public testing::Test {
21 public:
23
24 static void SetUpTestSuite()
25 {
26 CLG_init();
28 }
29
30 static void TearDownTestSuite()
31 {
32 CLG_exit();
33 }
34
35 void SetUp() override
36 {
37 cube_mesh = geometry::create_cuboid_mesh(float3(1.0, 1.0, 1.0), 2, 2, 2);
38 }
39
40 void TearDown() override
41 {
42 BKE_id_free(nullptr, cube_mesh);
43 }
44};
45
47{
48 const OffsetIndices faces = cube_mesh->faces();
49 const Span<int> corner_verts = cube_mesh->corner_verts();
50 const GroupedSpan<int> vert_to_face_map = cube_mesh->vert_to_face_map();
51
53 for (const int i : verts.index_range()) {
54 verts[i] = i;
55 }
56
57 const BitVector boundary_verts(int64_t(cube_mesh->verts_num));
58 const Vector<bool> hide_poly(cube_mesh->faces_num, false);
59
60 Vector<int> offset_data;
63 faces, corner_verts, vert_to_face_map, boundary_verts, hide_poly, verts, offset_data, data);
64
65 ASSERT_EQ(result.size(), 8);
66 for (const int i : result.index_range()) {
67 ASSERT_EQ(result[i].size(), 3);
68 }
69}
70} // namespace blender::ed::sculpt_paint::tests
void BKE_idtype_init()
Definition idtype.cc:121
void BKE_id_free(Main *bmain, void *idv)
void CLG_exit()
Definition clog.cc:880
void CLG_init()
Definition clog.cc:873
BMesh const char void * data
long long int int64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static float verts[][3]
static char faces[256]
TEST_F(MeshTests, calc_vert_neighbors_interior)
GroupedSpan< int > calc_vert_neighbors_interior(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face, BitSpan boundary_verts, Span< bool > hide_poly, Span< int > verts, Vector< int > &r_offset_data, Vector< int > &r_data)
Definition sculpt.cc:7739
Mesh * create_cuboid_mesh(const float3 &size, int verts_x, int verts_y, int verts_z, std::optional< StringRef > uv_id)
VecBase< float, 3 > float3
i
Definition text_draw.cc:230