Blender V5.3
blender::ed::greasepencil::tests Namespace Reference

Classes

class  GreasePencilBooleanTest
struct  GreasePencilIDTestContext
class  GreasePencilMergeTest
class  GreasePencilTrimTest
class  SVGMapping

Functions

static void CSS_setup_style (std::ofstream &f)
static void SVG_add_path (std::ofstream &f, const std::string &class_name, const Span< float2 > &positions, const GroupedSpan< int > shapes, const IndexMask &shape_mask, const OffsetIndices< int > points_by_curve, const VArraySpan< bool > &cyclic, const SVGMapping &mapping)
static std::ofstream get_file_stream ()
static void draw_divider_start (const std::string &label)
static void draw_divider_end ()
static float2 project_fn (const float3 position)
static void draw_results (const std::string &label, const std::string &type, const bke::CurvesGeometry &src_curves, const bke::CurvesGeometry &dst_curves, const IndexMask &clipping_shapes)
static bke::CurvesGeometry create_test_curves (const Span< int > offsets, const Span< float2 > points, const Span< int > fill_ids, const Span< bool > cyclic)
static void expect_boolean_result_coord (const bke::CurvesGeometry &dst_curves, const Array< Vector< float2 > > &expected_points)
static bke::CurvesGeometry test_curve_boolean (const Operation opt, const bke::CurvesGeometry &src_curves, const Span< int > fill_ids, const IndexMask &clipping_shapes)
 TEST_F (GreasePencilBooleanTest, Squares)
 TEST_F (GreasePencilBooleanTest, Simple)
 TEST_F (GreasePencilBooleanTest, Complex)
 TEST_F (GreasePencilBooleanTest, Last_Edge_Loop)
 TEST_F (GreasePencilBooleanTest, Simple_Cuts)
 TEST_F (GreasePencilBooleanTest, Square_With_Hole)
 TEST_F (GreasePencilBooleanTest, Squares_With_Holes)
 TEST_F (GreasePencilBooleanTest, Multiple_Shapes)
 TEST_F (GreasePencilMergeTest, merge_simple)
 TEST_F (GreasePencilMergeTest, merge_in_same_group)
 TEST_F (GreasePencilMergeTest, merge_in_different_group)
 TEST_F (GreasePencilMergeTest, merge_keyframes)
 TEST_F (GreasePencilMergeTest, merge_layer_attributes)
static bke::CurvesGeometry create_test_curves (const Span< int > offsets, const Span< float2 > positions_2d, const Span< bool > cyclic)
static void expect_near_positions (const Span< float3 > actual, const Span< float2 > expected)
 TEST_F (GreasePencilTrimTest, trim_two_edges)
 TEST_F (GreasePencilTrimTest, trim_sub_edges)
 TEST_F (GreasePencilTrimTest, trim_plus_intersection)
 TEST_F (GreasePencilTrimTest, trim_t_intersection_to_corner)
 TEST_F (GreasePencilTrimTest, trim_t_intersection_line)
 TEST_F (GreasePencilTrimTest, trim_figure_eight)
 TEST_F (GreasePencilTrimTest, trim_no_geometry)
 TEST_F (GreasePencilTrimTest, trim_no_geometry_loop)
 TEST_F (GreasePencilTrimTest, trim_cyclical_corner)
 TEST_F (GreasePencilTrimTest, trim_no_geometry_edge_end_intersection)
 TEST_F (GreasePencilTrimTest, trim_no_geometry_cyclical_loop)
 TEST_F (GreasePencilTrimTest, trim_no_geometry_point_intersection)
 TEST_F (GreasePencilTrimTest, trim_no_geometry_self_intersection_degeneracy)

Variables

static bool draw_append = false

Function Documentation

◆ create_test_curves() [1/2]

◆ create_test_curves() [2/2]

bke::CurvesGeometry blender::ed::greasepencil::tests::create_test_curves ( const Span< int > offsets,
const Span< float2 > positions_2d,
const Span< bool > cyclic )
static

◆ CSS_setup_style()

void blender::ed::greasepencil::tests::CSS_setup_style ( std::ofstream & f)
static

Definition at line 33 of file grease_pencil_boolean_test.cc.

References CSS_setup_style().

Referenced by CSS_setup_style(), and get_file_stream().

◆ draw_divider_end()

void blender::ed::greasepencil::tests::draw_divider_end ( )
static

◆ draw_divider_start()

void blender::ed::greasepencil::tests::draw_divider_start ( const std::string & label)
static

◆ draw_results()

◆ expect_boolean_result_coord()

◆ expect_near_positions()

void blender::ed::greasepencil::tests::expect_near_positions ( const Span< float3 > actual,
const Span< float2 > expected )
static

◆ get_file_stream()

std::ofstream blender::ed::greasepencil::tests::get_file_stream ( )
static

◆ project_fn()

float2 blender::ed::greasepencil::tests::project_fn ( const float3 position)
static

◆ SVG_add_path()

void blender::ed::greasepencil::tests::SVG_add_path ( std::ofstream & f,
const std::string & class_name,
const Span< float2 > & positions,
const GroupedSpan< int > shapes,
const IndexMask & shape_mask,
const OffsetIndices< int > points_by_curve,
const VArraySpan< bool > & cyclic,
const SVGMapping & mapping )
static

◆ test_curve_boolean()

◆ TEST_F() [1/26]

blender::ed::greasepencil::tests::TEST_F ( GreasePencilBooleanTest ,
Complex  )

This is a replica of Fig. 16 from Greiner, Günther; Kai Hormann (1998). "Efficient clipping of arbitrary polygons". ACM Transactions on Graphics. 17 (2): 71-83.

Definition at line 554 of file grease_pencil_boolean_test.cc.

References create_test_curves(), blender::ed::greasepencil::boolean::Difference, draw_divider_end(), draw_divider_start(), draw_results(), expect_boolean_result_coord(), blender::IndexRange::IndexRange(), blender::ed::greasepencil::boolean::Intersect, test_curve_boolean(), TEST_F(), and blender::ed::greasepencil::boolean::Union.

◆ TEST_F() [2/26]

blender::ed::greasepencil::tests::TEST_F ( GreasePencilBooleanTest ,
Last_Edge_Loop  )

These shapes are designed to test the following: 1: Intersection with the last edge. 2: Segment connected through a full loop around. 3: Multiple intersection on one edge not in order. 4: Having a self intersection.

Definition at line 647 of file grease_pencil_boolean_test.cc.

References create_test_curves(), blender::ed::greasepencil::boolean::Difference, draw_divider_end(), draw_divider_start(), draw_results(), expect_boolean_result_coord(), blender::IndexRange::IndexRange(), blender::ed::greasepencil::boolean::Intersect, test_curve_boolean(), TEST_F(), and blender::ed::greasepencil::boolean::Union.

◆ TEST_F() [3/26]

blender::ed::greasepencil::tests::TEST_F ( GreasePencilBooleanTest ,
Multiple_Shapes  )

Multiple separate but intersecting subject shapes. The two subject shapes should be affected by the clipping shape, but not join into one.

Definition at line 941 of file grease_pencil_boolean_test.cc.

References create_test_curves(), blender::ed::greasepencil::boolean::Difference, draw_divider_end(), draw_divider_start(), draw_results(), expect_boolean_result_coord(), blender::IndexRange::from_begin_end(), blender::ed::greasepencil::boolean::Intersect, test_curve_boolean(), and TEST_F().

◆ TEST_F() [4/26]

blender::ed::greasepencil::tests::TEST_F ( GreasePencilBooleanTest ,
Simple  )

This is a replica of Fig. 10 from Greiner, Günther; Kai Hormann (1998). "Efficient clipping of arbitrary polygons". ACM Transactions on Graphics. 17 (2): 71-83.

Definition at line 500 of file grease_pencil_boolean_test.cc.

References create_test_curves(), blender::ed::greasepencil::boolean::Difference, draw_divider_end(), draw_divider_start(), draw_results(), expect_boolean_result_coord(), blender::IndexRange::IndexRange(), blender::ed::greasepencil::boolean::Intersect, test_curve_boolean(), TEST_F(), and blender::ed::greasepencil::boolean::Union.

◆ TEST_F() [5/26]

◆ TEST_F() [6/26]

◆ TEST_F() [7/26]

◆ TEST_F() [8/26]

◆ TEST_F() [9/26]

◆ TEST_F() [10/26]

◆ TEST_F() [11/26]

◆ TEST_F() [12/26]

◆ TEST_F() [13/26]

◆ TEST_F() [14/26]

◆ TEST_F() [15/26]

◆ TEST_F() [16/26]

◆ TEST_F() [17/26]

◆ TEST_F() [18/26]

◆ TEST_F() [19/26]

◆ TEST_F() [20/26]

◆ TEST_F() [21/26]

◆ TEST_F() [22/26]

◆ TEST_F() [23/26]

◆ TEST_F() [24/26]

◆ TEST_F() [25/26]

◆ TEST_F() [26/26]

Variable Documentation

◆ draw_append

bool blender::ed::greasepencil::tests::draw_append = false
static

Definition at line 200 of file grease_pencil_boolean_test.cc.

Referenced by get_file_stream().