|
KiCad PCB EDA Suite
|
Test suite for #ALTIUM_PARSER_SCH. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include <eeschema/sch_io/altium/altium_parser_sch.h>#include <eeschema/sch_text.h>#include <layer_ids.h>#include <project/net_settings.h>#include <validators.h>#include <wx/filename.h>#include <set>#include <vector>Go to the source code of this file.
Classes | |
| struct | ALTIUM_PARSER_SCH_FIXTURE |
| struct | ALTIUM_TO_KICAD_UNIT_FRAC_CASE |
| Declares the struct as the Boost test fixture. More... | |
| struct | SHEET_NAME_SANITIZE_CASE |
| struct | TEXT_ORIENT_CASE |
Functions | |
| int | ReadKiCadUnitFrac (const std::map< wxString, wxString > &aProps, const wxString &aKey) |
| void | SetTextPositioning (EDA_TEXT *text, ASCH_LABEL_JUSTIFICATION justification, ASCH_RECORD_ORIENTATION orientation) |
| void | AdjustTextForSymbolOrientation (SCH_TEXT *aText, const ASCH_SYMBOL &aSymbol) |
| wxString | AltiumWrapBusLabel (const wxString &aText) |
| wxString | AltiumDeriveSheetName (const wxString &aFilename, const std::set< wxString > &aExistingNames) |
| BOOST_AUTO_TEST_CASE (PropertiesReadKiCadUnitFracConversation) | |
| Test conversation from Altium internal units into KiCad internal units using properties with FRAC. | |
| BOOST_AUTO_TEST_CASE (SheetNameSlashSanitization) | |
| Verify that the slash-to-underscore sanitization used by the Altium importer produces valid KiCad sheet names. | |
| BOOST_AUTO_TEST_CASE (SheetNameSlashRejection) | |
| Verify that unsanitized sheet names with slashes are rejected by KiCad validation. | |
| BOOST_AUTO_TEST_CASE (ExtensionlessFilenameDetection) | |
| Verify that wxFileName::HasExt() correctly distinguishes extensionless Altium filenames from those with extensions. | |
| BOOST_AUTO_TEST_CASE (ExtensionlessBaseNameMatching) | |
| Verify that case-insensitive base-name matching works for resolving extensionless Altium sheet symbol filenames to .SchDoc files on disk. | |
| BOOST_AUTO_TEST_CASE (SheetNameDerivationFromFilename) | |
| Verify that name derivation from filenames for top-level sheets produces correct deduplicated names, matching the logic in LoadSchematicProject. | |
| static ASCH_SYMBOL | MakeTestSymbol (int aOrientation, bool aMirrored) |
| static void | SimulateRenderTransform (SCH_TEXT *aText, int aAltiumOrientation, bool aMirrored) |
| BOOST_AUTO_TEST_CASE (TextOrientationCompensation) | |
| Verify that AdjustTextForSymbolOrientation correctly pre-compensates text properties so that after the render-time symbol transform, the final text orientation matches the absolute Altium orientation. | |
| BOOST_AUTO_TEST_CASE (BusLabelWrapping) | |
| Guard the exact transform SCH_IO_ALTIUM::PostProcessBusLabels() applies to a scalar net label found on a bus line (issue #20707). | |
| BOOST_AUTO_TEST_CASE (SheetNameDerivation) | |
| Guard the name derivation SCH_IO_ALTIUM::EnsureSheetSymbolNames() applies to sheet symbols that arrive without a SHEET_NAME record. | |
Variables | |
| static const std::vector< ALTIUM_TO_KICAD_UNIT_FRAC_CASE > | altium_to_kicad_unit_frac |
| A list of valid internal unit conversation factors. | |
| static const std::vector< SHEET_NAME_SANITIZE_CASE > | sheet_name_sanitize_cases |
| static const std::vector< TEXT_ORIENT_CASE > | text_orient_cases |
Test suite for #ALTIUM_PARSER_SCH.
Definition in file test_altium_parser_sch.cpp.
| void AdjustTextForSymbolOrientation | ( | SCH_TEXT * | aText, |
| const ASCH_SYMBOL & | aSymbol ) |
Definition at line 2359 of file sch_io_altium.cpp.
References EDA_TEXT::FlipHJustify(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetVertJustify(), EDA_ANGLE::IsHorizontal(), ASCH_SYMBOL::isMirrored, ASCH_SYMBOL::orientation, SCH_TEXT::Rotate90(), and EDA_TEXT::SetVertJustify().
Referenced by BOOST_AUTO_TEST_CASE(), and SCH_IO_ALTIUM::ParseLabel().
| wxString AltiumDeriveSheetName | ( | const wxString & | aFilename, |
| const std::set< wxString > & | aExistingNames ) |
Definition at line 1041 of file sch_io_altium.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), SCH_IO_ALTIUM::EnsureSheetSymbolNames(), and SCH_IO_ALTIUM::LoadSchematicProject().
| wxString AltiumWrapBusLabel | ( | const wxString & | aText | ) |
Definition at line 1023 of file sch_io_altium.cpp.
References SCH_CONNECTION::IsBusLabel().
Referenced by BOOST_AUTO_TEST_CASE(), and SCH_IO_ALTIUM::PostProcessBusLabels().
| BOOST_AUTO_TEST_CASE | ( | BusLabelWrapping | ) |
Guard the exact transform SCH_IO_ALTIUM::PostProcessBusLabels() applies to a scalar net label found on a bus line (issue #20707).
Plain labels must become single-member bus groups so KiCad connects them to the bus; anything already a bus label is left untouched.
Definition at line 393 of file test_altium_parser_sch.cpp.
References AltiumWrapBusLabel(), BOOST_CHECK_EQUAL(), name, and NET_SETTINGS::ParseBusGroup().
| BOOST_AUTO_TEST_CASE | ( | ExtensionlessBaseNameMatching | ) |
Verify that case-insensitive base-name matching works for resolving extensionless Altium sheet symbol filenames to .SchDoc files on disk.
Definition at line 194 of file test_altium_parser_sch.cpp.
References empty().
| BOOST_AUTO_TEST_CASE | ( | ExtensionlessFilenameDetection | ) |
Verify that wxFileName::HasExt() correctly distinguishes extensionless Altium filenames from those with extensions.
The Altium importer uses this to decide when to try appending .SchDoc during the hierarchy descent.
Definition at line 177 of file test_altium_parser_sch.cpp.
| BOOST_AUTO_TEST_CASE | ( | PropertiesReadKiCadUnitFracConversation | ) |
Test conversation from Altium internal units into KiCad internal units using properties with FRAC.
Definition at line 101 of file test_altium_parser_sch.cpp.
References altium_to_kicad_unit_frac, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), ReadKiCadUnitFrac(), and result.
| BOOST_AUTO_TEST_CASE | ( | SheetNameDerivation | ) |
Guard the name derivation SCH_IO_ALTIUM::EnsureSheetSymbolNames() applies to sheet symbols that arrive without a SHEET_NAME record.
The name comes from the filename, with a numeric suffix to disambiguate collisions.
Definition at line 422 of file test_altium_parser_sch.cpp.
References AltiumDeriveSheetName(), and BOOST_CHECK_EQUAL().
| BOOST_AUTO_TEST_CASE | ( | SheetNameDerivationFromFilename | ) |
Verify that name derivation from filenames for top-level sheets produces correct deduplicated names, matching the logic in LoadSchematicProject.
Definition at line 227 of file test_altium_parser_sch.cpp.
References BOOST_CHECK_EQUAL().
| BOOST_AUTO_TEST_CASE | ( | SheetNameSlashRejection | ) |
Verify that unsanitized sheet names with slashes are rejected by KiCad validation.
Definition at line 163 of file test_altium_parser_sch.cpp.
References BOOST_CHECK_MESSAGE(), GetFieldValidationErrorMessage(), and SHEET_NAME.
| BOOST_AUTO_TEST_CASE | ( | SheetNameSlashSanitization | ) |
Verify that the slash-to-underscore sanitization used by the Altium importer produces valid KiCad sheet names.
Definition at line 140 of file test_altium_parser_sch.cpp.
References BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_TEST_CONTEXT(), GetFieldValidationErrorMessage(), SHEET_NAME, and sheet_name_sanitize_cases.
| BOOST_AUTO_TEST_CASE | ( | TextOrientationCompensation | ) |
Verify that AdjustTextForSymbolOrientation correctly pre-compensates text properties so that after the render-time symbol transform, the final text orientation matches the absolute Altium orientation.
Definition at line 360 of file test_altium_parser_sch.cpp.
References AdjustTextForSymbolOrientation(), TEXT_ORIENT_CASE::altiumSymOrientation, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), TEXT_ORIENT_CASE::expectedAngle, TEXT_ORIENT_CASE::expectedHJustify, TEXT_ORIENT_CASE::justification, LAYER_DEVICE, MakeTestSymbol(), TEXT_ORIENT_CASE::mirrored, SetTextPositioning(), SimulateRenderTransform(), text_orient_cases, and TEXT_ORIENT_CASE::textOrientation.
|
static |
Definition at line 255 of file test_altium_parser_sch.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
| int ReadKiCadUnitFrac | ( | const std::map< wxString, wxString > & | aProps, |
| const wxString & | aKey ) |
Definition at line 53 of file altium_parser_sch.cpp.
References Altium2KiCadUnit(), and ALTIUM_PROPS_UTILS::ReadInt().
Referenced by ASCH_ARC::ASCH_ARC(), ASCH_BEZIER::ASCH_BEZIER(), ASCH_BORDER_INTERFACE::ASCH_BORDER_INTERFACE(), ASCH_BUS::ASCH_BUS(), ASCH_BUS_ENTRY::ASCH_BUS_ENTRY(), ASCH_DESIGNATOR::ASCH_DESIGNATOR(), ASCH_ELLIPSE::ASCH_ELLIPSE(), ASCH_FILE_NAME::ASCH_FILE_NAME(), ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR(), ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE(), ASCH_IMAGE::ASCH_IMAGE(), ASCH_JUNCTION::ASCH_JUNCTION(), ASCH_LABEL::ASCH_LABEL(), ASCH_LINE::ASCH_LINE(), ASCH_NET_LABEL::ASCH_NET_LABEL(), ASCH_NO_ERC::ASCH_NO_ERC(), ASCH_PARAMETER::ASCH_PARAMETER(), ASCH_POLYGON::ASCH_POLYGON(), ASCH_POLYLINE::ASCH_POLYLINE(), ASCH_PORT::ASCH_PORT(), ASCH_POWER_PORT::ASCH_POWER_PORT(), ASCH_RECTANGLE::ASCH_RECTANGLE(), ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE(), ASCH_SHEET::ASCH_SHEET(), ASCH_SHEET_FONT::ASCH_SHEET_FONT(), ASCH_SHEET_NAME::ASCH_SHEET_NAME(), ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL(), ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS(), ASCH_SYMBOL::ASCH_SYMBOL(), ASCH_TEXT_FRAME::ASCH_TEXT_FRAME(), ASCH_WIRE::ASCH_WIRE(), and BOOST_AUTO_TEST_CASE().
| void SetTextPositioning | ( | EDA_TEXT * | text, |
| ASCH_LABEL_JUSTIFICATION | justification, | ||
| ASCH_RECORD_ORIENTATION | orientation ) |
Definition at line 2216 of file sch_io_altium.cpp.
References ANGLE_HORIZONTAL, ANGLE_VERTICAL, BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER_CENTER, CENTER_LEFT, CENTER_RIGHT, DOWNWARDS, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, LEFTWARDS, RIGHTWARDS, text, TOP_CENTER, TOP_LEFT, TOP_RIGHT, UNKNOWN, and UPWARDS.
Referenced by BOOST_AUTO_TEST_CASE(), SCH_IO_ALTIUM::ParseDesignator(), SCH_IO_ALTIUM::ParseFileName(), SCH_IO_ALTIUM::ParseLabel(), SCH_IO_ALTIUM::ParseLibDesignator(), SCH_IO_ALTIUM::ParseLibParameter(), SCH_IO_ALTIUM::ParseNetLabel(), SCH_IO_ALTIUM::ParseParameter(), and SCH_IO_ALTIUM::ParseSheetName().
|
static |
Definition at line 272 of file test_altium_parser_sch.cpp.
References EDA_TEXT::FlipHJustify(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetVertJustify(), EDA_ANGLE::IsHorizontal(), SCH_TEXT::Rotate90(), and EDA_TEXT::SetVertJustify().
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
A list of valid internal unit conversation factors.
Definition at line 72 of file test_altium_parser_sch.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 126 of file test_altium_parser_sch.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 300 of file test_altium_parser_sch.cpp.
Referenced by BOOST_AUTO_TEST_CASE().