KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_autoplace_fields.cpp File Reference

Test suite for autoplace fields functionality. More...

Go to the source code of this file.

Classes

class  TEST_AUTOPLACE_FIELDS_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (RotatedSymbolFieldBoundingBox)
 Test that field bounding boxes for rotated symbols have correct dimensions.
 
 BOOST_AUTO_TEST_CASE (FieldDrawRotationForRotatedSymbol)
 Test that GetDrawRotation returns correct visual orientation.
 

Detailed Description

Test suite for autoplace fields functionality.

Tests fix for issue #16538: autoplace fields overlaps symbol text.

Definition in file test_autoplace_fields.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( FieldDrawRotationForRotatedSymbol )

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( RotatedSymbolFieldBoundingBox )

Test that field bounding boxes for rotated symbols have correct dimensions.

This is a regression test for issue #16538.

The bug was that when computing field bounding boxes for autoplace, the code set field text angle to ANGLE_VERTICAL for 90/270 degree rotated symbols. However, GetBoundingBox() applies BOTH the field angle AND the symbol transform, resulting in 180-degree effective rotation (field angle + symbol transform). This caused the bounding box dimensions to be incorrect.

The fix sets field text angle to ANGLE_HORIZONTAL, so that GetBoundingBox() applies only the symbol transform (90 degrees), giving correct dimensions for vertical text display.

Definition at line 82 of file test_autoplace_fields.cpp.

References ANGLE_HORIZONTAL, BOOST_AUTO_TEST_CASE(), BOOST_REQUIRE(), SCH_FIELD::GetBoundingBox(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), BOX2< Vec >::GetHeight(), SYMBOL::GetTransform(), BOX2< Vec >::GetWidth(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), REFERENCE, EDA_TEXT::SetTextAngle(), and TRANSFORM::y1.