Blender V4.5
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 "testing/testing.h"
16
18class MeshTests : public testing::Test {
19 public:
21
22 static void SetUpTestSuite()
23 {
25 }
26
27 void SetUp() override
28 {
29 cube_mesh = geometry::create_cuboid_mesh(float3(1.0, 1.0, 1.0), 2, 2, 2);
30 }
31
32 void TearDown() override
33 {
34 BKE_id_free(nullptr, cube_mesh);
35 }
36};
37
39{
40 const OffsetIndices faces = cube_mesh->faces();
41 const Span<int> corner_verts = cube_mesh->corner_verts();
42 const GroupedSpan<int> vert_to_face_map = cube_mesh->vert_to_face_map();
43
45 for (const int i : verts.index_range()) {
46 verts[i] = i;
47 }
48
49 const BitVector boundary_verts(int64_t(cube_mesh->verts_num));
50 const Vector<bool> hide_poly(cube_mesh->faces_num, false);
51
52 Vector<int> offset_data;
55 faces, corner_verts, vert_to_face_map, boundary_verts, hide_poly, verts, offset_data, data);
56
57 ASSERT_EQ(result.size(), 8);
58 for (const int i : result.index_range()) {
59 ASSERT_EQ(result[i].size(), 3);
60 }
61}
62} // namespace blender::ed::sculpt_paint::tests
void BKE_idtype_init()
Definition idtype.cc:122
void BKE_id_free(Main *bmain, void *idv)
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:7746
Mesh * create_cuboid_mesh(const float3 &size, int verts_x, int verts_y, int verts_z, const std::optional< StringRef > &uv_id)
VecBase< float, 3 > float3
i
Definition text_draw.cc:230