|
KiCad PCB EDA Suite
|
Test suite for autoplace fields functionality. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include "eeschema_test_utils.h"#include <sch_symbol.h>#include <sch_field.h>#include <sch_item.h>#include <geometry/eda_angle.h>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. | |
Test suite for autoplace fields functionality.
Tests fix for issue #16538: autoplace fields overlaps symbol text.
Definition in file test_autoplace_fields.cpp.
| BOOST_AUTO_TEST_CASE | ( | FieldDrawRotationForRotatedSymbol | ) |
Test that GetDrawRotation returns correct visual orientation.
Definition at line 123 of file test_autoplace_fields.cpp.
References ANGLE_HORIZONTAL, EDA_ANGLE::AsDegrees(), BOOST_REQUIRE(), SCH_FIELD::GetDrawRotation(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), EDA_ANGLE::IsVertical(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), REFERENCE, and EDA_TEXT::SetTextAngle().
| 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.