KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_orcad_sch_import.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <sch_io/orcad/sch_io_orcad.h>
#include <sch_io/orcad/orcad_cache.h>
#include <sch_io/orcad/orcad_converter.h>
#include <sch_io/orcad/orcad_ole.h>
#include <sch_io/orcad/orcad_page.h>
#include <schematic.h>
#include <connection_graph.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <sch_sheet_path.h>
#include <sch_symbol.h>
#include <sch_label.h>
#include <sch_line.h>
#include <sch_bitmap.h>
#include <sch_shape.h>
#include <sch_pin.h>
#include <lib_symbol.h>
#include <reporter.h>
#include <settings/settings_manager.h>
#include <wx/ffile.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <algorithm>
#include <filesystem>
#include <fstream>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>

Go to the source code of this file.

Classes

struct  ORCAD_SCH_IMPORT_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (PrimitiveLineWidth)
 
 BOOST_AUTO_TEST_CASE (CaptureColorPalette)
 
 BOOST_AUTO_TEST_CASE (CaptureCompoundFileName)
 
 BOOST_AUTO_TEST_CASE (CaptureStrokeAndFillSemantics)
 
 BOOST_AUTO_TEST_CASE (CapturePageOrder)
 
 BOOST_AUTO_TEST_CASE (PrimitiveStrokeAndFillStyles)
 
 BOOST_AUTO_TEST_CASE (PrimitivePolygonStylesBeforePoints)
 
 BOOST_AUTO_TEST_CASE (PrimitiveSymbolVectorContents)
 
 BOOST_AUTO_TEST_CASE (OleMetafilePreviewExtraction)
 
 BOOST_AUTO_TEST_CASE (OleNativeBitmapExtraction)
 
 BOOST_AUTO_TEST_CASE (LegacyPageNetGroups)
 
 BOOST_AUTO_TEST_CASE (RejectsSpecctraTextDsn)
 
 BOOST_AUTO_TEST_CASE (RejectsNonexistentFile)
 
 BOOST_AUTO_TEST_CASE (RejectsWrongExtension)
 
static std::string trimCell (std::string aText)
 
static std::vector< std::string > splitRefs (const std::string &aCell)
 
static std::set< std::string > parseBomRefs (const std::string &aPath)
 
static std::set< std::string > parseNetComs (const std::string &aPath)
 
static std::set< std::string > collectImportedRefs (SCHEMATIC &aSchematic)
 Unique refdes of real (non-power) parts.
 
static std::string terminalToken (const std::string &aRef, const std::string &aPin)
 
static std::vector< std::set< std::string > > parseNetTerminals (const std::string &aPath)
 Net terminal sets from .NET.
 
static std::pair< int, int > checkConnectivity (SCHEMATIC &aSchematic, const std::vector< std::set< std::string > > &aNets, std::vector< std::set< std::string > > *aInconsistent=nullptr)
 Count ground-truth nets whose resolvable terminals all land on one KiCad net after connectivity rebuild.
 
static std::set< std::string > expectedRefsFor (const std::filesystem::path &aDsn, std::string &aSource)
 Ground-truth companion beside .DSN, .NET preferred over .BOM.
 
 BOOST_AUTO_TEST_CASE (CorpusValidation)
 
static std::filesystem::path findCorpusDesign (const std::filesystem::path &aRoot, const std::string &aFileName)
 
 BOOST_AUTO_TEST_CASE (Issue25005Hierarchy)
 
 BOOST_AUTO_TEST_CASE (Issue25009PageOrderAndGraphics)
 
 BOOST_AUTO_TEST_CASE (OlbLibraryImport)
 
 BOOST_AUTO_TEST_CASE (MultiPageFlatImport)
 
 BOOST_AUTO_TEST_CASE (ComponentDetailImport)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/20]

BOOST_AUTO_TEST_CASE ( CaptureColorPalette )

Definition at line 237 of file test_orcad_sch_import.cpp.

References OrcadColor(), and KIGFX::COLOR4D::UNSPECIFIED.

◆ BOOST_AUTO_TEST_CASE() [2/20]

BOOST_AUTO_TEST_CASE ( CaptureCompoundFileName )

Definition at line 249 of file test_orcad_sch_import.cpp.

References BOOST_CHECK_EQUAL(), and OrcadNormalizeCfbName().

◆ BOOST_AUTO_TEST_CASE() [3/20]

BOOST_AUTO_TEST_CASE ( CapturePageOrder )

Definition at line 275 of file test_orcad_sch_import.cpp.

References BOOST_CHECK_EQUAL(), and OrcadPageOrder().

◆ BOOST_AUTO_TEST_CASE() [4/20]

BOOST_AUTO_TEST_CASE ( CaptureStrokeAndFillSemantics )

◆ BOOST_AUTO_TEST_CASE() [5/20]

◆ BOOST_AUTO_TEST_CASE() [6/20]

◆ BOOST_AUTO_TEST_CASE() [7/20]

◆ BOOST_AUTO_TEST_CASE() [8/20]

◆ BOOST_AUTO_TEST_CASE() [9/20]

BOOST_AUTO_TEST_CASE ( LegacyPageNetGroups )

◆ BOOST_AUTO_TEST_CASE() [10/20]

◆ BOOST_AUTO_TEST_CASE() [11/20]

BOOST_AUTO_TEST_CASE ( OlbLibraryImport )

◆ BOOST_AUTO_TEST_CASE() [12/20]

BOOST_AUTO_TEST_CASE ( OleMetafilePreviewExtraction )

◆ BOOST_AUTO_TEST_CASE() [13/20]

BOOST_AUTO_TEST_CASE ( OleNativeBitmapExtraction )

◆ BOOST_AUTO_TEST_CASE() [14/20]

BOOST_AUTO_TEST_CASE ( PrimitiveLineWidth )

◆ BOOST_AUTO_TEST_CASE() [15/20]

BOOST_AUTO_TEST_CASE ( PrimitivePolygonStylesBeforePoints )

◆ BOOST_AUTO_TEST_CASE() [16/20]

BOOST_AUTO_TEST_CASE ( PrimitiveStrokeAndFillStyles )

◆ BOOST_AUTO_TEST_CASE() [17/20]

BOOST_AUTO_TEST_CASE ( PrimitiveSymbolVectorContents )

◆ BOOST_AUTO_TEST_CASE() [18/20]

BOOST_AUTO_TEST_CASE ( RejectsNonexistentFile )

Definition at line 481 of file test_orcad_sch_import.cpp.

References BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [19/20]

BOOST_AUTO_TEST_CASE ( RejectsSpecctraTextDsn )

Definition at line 471 of file test_orcad_sch_import.cpp.

References BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [20/20]

BOOST_AUTO_TEST_CASE ( RejectsWrongExtension )

Definition at line 490 of file test_orcad_sch_import.cpp.

References BOOST_REQUIRE().

◆ checkConnectivity()

static std::pair< int, int > checkConnectivity ( SCHEMATIC & aSchematic,
const std::vector< std::set< std::string > > & aNets,
std::vector< std::set< std::string > > * aInconsistent = nullptr )
static

Count ground-truth nets whose resolvable terminals all land on one KiCad net after connectivity rebuild.

Returns {consistent, checkable}.

Definition at line 723 of file test_orcad_sch_import.cpp.

References SCHEMATIC::BuildSheetListSortedByPageNumbers(), SCHEMATIC::ConnectionGraph(), CONNECTION_GRAPH::GetNetMap(), SCH_SYMBOL::GetRef(), pin, CONNECTION_GRAPH::Recalculate(), SCH_PIN_T, and terminalToken().

Referenced by BOOST_AUTO_TEST_CASE().

◆ collectImportedRefs()

static std::set< std::string > collectImportedRefs ( SCHEMATIC & aSchematic)
static

Unique refdes of real (non-power) parts.

Annotated refs live in per-sheet-path instance data, so walk sheet list and query GetRef() per path (same screen may recur on several paths).

Definition at line 639 of file test_orcad_sch_import.cpp.

References SCHEMATIC::BuildSheetListSortedByPageNumbers(), SCH_SYMBOL::GetRef(), SCH_SCREEN::Items(), EE_RTREE::OfType(), path, and SCH_SYMBOL_T.

Referenced by BOOST_AUTO_TEST_CASE().

◆ expectedRefsFor()

static std::set< std::string > expectedRefsFor ( const std::filesystem::path & aDsn,
std::string & aSource )
static

Ground-truth companion beside .DSN, .NET preferred over .BOM.

Definition at line 811 of file test_orcad_sch_import.cpp.

References parseBomRefs(), and parseNetComs().

Referenced by BOOST_AUTO_TEST_CASE().

◆ findCorpusDesign()

static std::filesystem::path findCorpusDesign ( const std::filesystem::path & aRoot,
const std::string & aFileName )
static

Definition at line 1186 of file test_orcad_sch_import.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ parseBomRefs()

static std::set< std::string > parseBomRefs ( const std::string & aPath)
static

Definition at line 557 of file test_orcad_sch_import.cpp.

References splitRefs(), and trimCell().

Referenced by expectedRefsFor().

◆ parseNetComs()

static std::set< std::string > parseNetComs ( const std::string & aPath)
static

Definition at line 606 of file test_orcad_sch_import.cpp.

References trimCell().

Referenced by expectedRefsFor().

◆ parseNetTerminals()

static std::vector< std::set< std::string > > parseNetTerminals ( const std::string & aPath)
static

Net terminal sets from .NET.

Net starts at .ADD_TER <ref> <pin>, gathers following .TER/indented <ref> <pin> continuations until next net.

Definition at line 676 of file test_orcad_sch_import.cpp.

References pin, and terminalToken().

Referenced by BOOST_AUTO_TEST_CASE().

◆ splitRefs()

static std::vector< std::string > splitRefs ( const std::string & aCell)
static

Definition at line 526 of file test_orcad_sch_import.cpp.

References trimCell().

Referenced by parseBomRefs().

◆ terminalToken()

static std::string terminalToken ( const std::string & aRef,
const std::string & aPin )
static

Definition at line 668 of file test_orcad_sch_import.cpp.

References trimCell().

Referenced by checkConnectivity(), and parseNetTerminals().

◆ trimCell()

static std::string trimCell ( std::string aText)
static

Definition at line 513 of file test_orcad_sch_import.cpp.

Referenced by parseBomRefs(), parseNetComs(), splitRefs(), and terminalToken().