|
KiCad PCB EDA Suite
|
Tests for multi-format clipboard export functionality in PCBnew. More...
#include <boost/test/unit_test.hpp>#include <board.h>#include <footprint.h>#include <pad.h>#include <pcb_track.h>#include <pcb_shape.h>#include <pcb_text.h>#include <pcb_field.h>#include <zone.h>#include <lset.h>#include <plotters/plotters_pslike.h>#include <pcb_painter.h>#include <wx/ffile.h>#include <wx/mstream.h>Go to the source code of this file.
Classes | |
| class | CLIPBOARD_EXPORT_FIXTURE |
Functions | |
| BOOST_AUTO_TEST_CASE (SvgPlotter_LayerSupport) | |
| Test that SVG_PLOTTER supports the StartLayer and EndLayer methods for proper Inkscape-compatible layer grouping. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsTracks) | |
| Test that tracks are properly represented in SVG export. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsVias) | |
| Test that vias are properly represented in SVG export. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsFootprintPads) | |
| Test that footprints with pads are properly created for export testing. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsZones) | |
| Test that zones are properly created for export testing. | |
| BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_FullyOpaque) | |
| Test the dual-buffer alpha computation algorithm used for PNG transparency. | |
| BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_FullyTransparent) | |
| BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_SemiTransparent) | |
| BOOST_AUTO_TEST_CASE (PngExport_UnselectedColors) | |
| Test that selection state is cleared for proper unselected color rendering. | |
| BOOST_AUTO_TEST_CASE (PngExport_FootprintChildrenUnselected) | |
| Test that footprint children have selection cleared for proper rendering. | |
| BOOST_AUTO_TEST_CASE (PngExport_LayerOrder) | |
| Test layer ordering for proper hole rendering in PNG export. | |
| BOOST_AUTO_TEST_CASE (PngExport_BitmapSizeCalculation) | |
| Test bitmap size calculation from bounding box and view scale. | |
| BOOST_AUTO_TEST_CASE (PngExport_BitmapSizeClamping) | |
| Test bitmap size clamping to maximum size while preserving aspect ratio. | |
| BOOST_AUTO_TEST_CASE (SvgExport_LayerNames) | |
| Test that board layer names are retrievable for SVG export. | |
| BOOST_AUTO_TEST_CASE (SvgExport_CollectLayers) | |
| Test layer set collection from board items. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsArcs) | |
| Test that PCB arcs are properly created for export testing. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsPcbShapes) | |
| Test that PCB shapes on copper layers are properly created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsPcbText) | |
| Test that PCB text is properly created for export testing. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsBlindVia) | |
| Test that blind vias are properly created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsMicroVia) | |
| Test that micro vias are properly created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_MultipleCopperLayers) | |
| Test that tracks on multiple copper layers can be created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_FootprintGraphics) | |
| Test that footprint graphics (silkscreen items) are properly created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ContainsSmdPads) | |
| Test that SMD pads are properly created. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ZoneWithNet) | |
| Test that zone fills can be created. | |
| BOOST_AUTO_TEST_CASE (BoundingBox_MultipleItems) | |
| Test bounding box computation for various item types. | |
| BOOST_AUTO_TEST_CASE (SvgExport_FillOpacity_MatchesColorAlpha) | |
| Test that SVG fill-opacity is set correctly when drawing shapes. | |
| BOOST_AUTO_TEST_CASE (SvgExport_FillOpacity_FullyOpaque) | |
| Test that SVG export with fully opaque colors has fill-opacity = 1.0. | |
| BOOST_AUTO_TEST_CASE (SvgExport_FootprintPads_IncludedInOutput) | |
| Test that footprint pads are included in SVG export. | |
| BOOST_AUTO_TEST_CASE (SvgExport_FootprintGraphics_IncludedInOutput) | |
| Test that footprint graphical items are included in SVG export. | |
| BOOST_AUTO_TEST_CASE (SvgExport_ColorAlpha_PreservedThroughSetColor) | |
| Test that verifies the COLOR4D alpha value is preserved through SetColor. | |
Tests for multi-format clipboard export functionality in PCBnew.
These tests verify:
Definition in file test_clipboard_export.cpp.
| BOOST_AUTO_TEST_CASE | ( | BoundingBox_MultipleItems | ) |
Test bounding box computation for various item types.
Definition at line 820 of file test_clipboard_export.cpp.
References BOX2< Vec >::Contains(), F_Cu, BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Merge(), and pcbIUScale.
| BOOST_AUTO_TEST_CASE | ( | PngExport_AlphaComputation_FullyOpaque | ) |
Test the dual-buffer alpha computation algorithm used for PNG transparency.
This verifies the mathematical approach: α = 1 - (white - black) / 255
Definition at line 282 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL().
| BOOST_AUTO_TEST_CASE | ( | PngExport_AlphaComputation_FullyTransparent | ) |
Definition at line 299 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL().
| BOOST_AUTO_TEST_CASE | ( | PngExport_AlphaComputation_SemiTransparent | ) |
Definition at line 316 of file test_clipboard_export.cpp.
| BOOST_AUTO_TEST_CASE | ( | PngExport_BitmapSizeCalculation | ) |
Test bitmap size calculation from bounding box and view scale.
Definition at line 438 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL().
| BOOST_AUTO_TEST_CASE | ( | PngExport_BitmapSizeClamping | ) |
Test bitmap size clamping to maximum size while preserving aspect ratio.
Definition at line 463 of file test_clipboard_export.cpp.
| BOOST_AUTO_TEST_CASE | ( | PngExport_FootprintChildrenUnselected | ) |
Test that footprint children have selection cleared for proper rendering.
Definition at line 361 of file test_clipboard_export.cpp.
References EDA_ITEM::ClearSelected(), FOOTPRINT::Clone(), EDA_ITEM::IsSelected(), pad, FOOTPRINT::Pads(), RECURSE, and EDA_ITEM::SetSelected().
| BOOST_AUTO_TEST_CASE | ( | PngExport_LayerOrder | ) |
Test layer ordering for proper hole rendering in PNG export.
Higher order values are drawn later (on top).
Definition at line 402 of file test_clipboard_export.cpp.
References LSET::AllCuMask(), BOOST_CHECK_EQUAL(), and LSET::CuStack().
| BOOST_AUTO_TEST_CASE | ( | PngExport_UnselectedColors | ) |
Test that selection state is cleared for proper unselected color rendering.
This verifies that ClearSelected() properly removes selection flag.
Definition at line 339 of file test_clipboard_export.cpp.
References PCB_TRACK::Clone(), F_Cu, EDA_ITEM::IsSelected(), and EDA_ITEM::SetSelected().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_CollectLayers | ) |
Test layer set collection from board items.
Definition at line 515 of file test_clipboard_export.cpp.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ColorAlpha_PreservedThroughSetColor | ) |
Test that verifies the COLOR4D alpha value is preserved through SetColor.
This is a regression test for fill-opacity:0 bug.
Definition at line 1092 of file test_clipboard_export.cpp.
References BOOST_REQUIRE(), SVG_PLOTTER::Circle(), SVG_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::OpenFile(), PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PAGE_INFO::SetHeightMils(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), and SVG_PLOTTER::StartPlot().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsArcs | ) |
Test that PCB arcs are properly created for export testing.
Definition at line 539 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), F_Cu, PCB_ARC::GetAngle(), BOARD_CONNECTED_ITEM::GetLayer(), EDA_ANGLE::IsZero(), pcbIUScale, PCB_TRACK::SetEnd(), BOARD_CONNECTED_ITEM::SetLayer(), PCB_ARC::SetMid(), PCB_TRACK::SetStart(), and PCB_TRACK::SetWidth().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsBlindVia | ) |
Test that blind vias are properly created.
Definition at line 636 of file test_clipboard_export.cpp.
References PADSTACK::ALL_LAYERS, BLIND, BOOST_REQUIRE(), F_Cu, PCB_VIA::GetViaType(), In1_Cu, PCB_VIA_T, pcbIUScale, and via.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsFootprintPads | ) |
Test that footprints with pads are properly created for export testing.
Definition at line 239 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), F_Cu, PAD::GetLayerSet(), PAD::GetNumber(), and FOOTPRINT::Pads().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsMicroVia | ) |
Test that micro vias are properly created.
Definition at line 667 of file test_clipboard_export.cpp.
References PADSTACK::ALL_LAYERS, BOOST_REQUIRE(), F_Cu, PCB_VIA::GetViaType(), In1_Cu, MICROVIA, PCB_VIA_T, pcbIUScale, and via.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsPcbShapes | ) |
Test that PCB shapes on copper layers are properly created.
Definition at line 562 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), CIRCLE, circle(), F_Cu, PCB_SHAPE_T, pcbIUScale, RECTANGLE, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), and SOLID.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsPcbText | ) |
Test that PCB text is properly created for export testing.
Definition at line 607 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), F_SilkS, PCB_TEXT_T, pcbIUScale, and text.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsSmdPads | ) |
Test that SMD pads are properly created.
Definition at line 760 of file test_clipboard_export.cpp.
References FOOTPRINT::Add(), PADSTACK::ALL_LAYERS, BOOST_CHECK_EQUAL(), F_Cu, F_Mask, F_Paste, PAD, pad, FOOTPRINT::Pads(), pcbIUScale, RECTANGLE, PAD::SetAttribute(), PAD::SetLayerSet(), PAD::SetNumber(), PAD::SetPosition(), PAD::SetShape(), PAD::SetSize(), and SMD.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsTracks | ) |
Test that tracks are properly represented in SVG export.
Definition at line 190 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), F_Cu, PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetLayer(), PCB_TRACK::GetStart(), pcbIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsVias | ) |
Test that vias are properly represented in SVG export.
Definition at line 211 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), PCB_VIA_T, pcbIUScale, THROUGH, and via.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ContainsZones | ) |
Test that zones are properly created for export testing.
Definition at line 263 of file test_clipboard_export.cpp.
References BOOST_CHECK_EQUAL(), F_Cu, ZONE::GetFirstLayer(), and ZONE::GetNumCorners().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_FillOpacity_FullyOpaque | ) |
Test that SVG export with fully opaque colors has fill-opacity = 1.0.
Definition at line 913 of file test_clipboard_export.cpp.
References BOOST_REQUIRE(), SVG_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::OpenFile(), SVG_PLOTTER::Rect(), PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PAGE_INFO::SetHeightMils(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), and SVG_PLOTTER::StartPlot().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_FillOpacity_MatchesColorAlpha | ) |
Test that SVG fill-opacity is set correctly when drawing shapes.
This verifies that colors with alpha values produce correct fill-opacity.
Definition at line 849 of file test_clipboard_export.cpp.
References BOOST_REQUIRE(), SVG_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::OpenFile(), SVG_PLOTTER::Rect(), PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PAGE_INFO::SetHeightMils(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), and SVG_PLOTTER::StartPlot().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_FootprintGraphics | ) |
Test that footprint graphics (silkscreen items) are properly created.
Definition at line 724 of file test_clipboard_export.cpp.
References FOOTPRINT::Add(), BOOST_CHECK_EQUAL(), F_Fab, F_SilkS, FOOTPRINT::GraphicalItems(), PCB_SHAPE_T, pcbIUScale, RECTANGLE, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), and SOLID.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_FootprintGraphics_IncludedInOutput | ) |
Test that footprint graphical items are included in SVG export.
Definition at line 1029 of file test_clipboard_export.cpp.
References FOOTPRINT::Add(), BOOST_REQUIRE(), SVG_PLOTTER::EndLayer(), SVG_PLOTTER::EndPlot(), F_SilkS, EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), PLOTTER::OpenFile(), pcbIUScale, SEGMENT, PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), EDA_SHAPE::SetEnd(), PAGE_INFO::SetHeightMils(), PCB_SHAPE::SetLayer(), PLOTTER::SetPageSettings(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), SOLID, SVG_PLOTTER::StartLayer(), SVG_PLOTTER::StartPlot(), and PLOTTER::ThickSegment().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_FootprintPads_IncludedInOutput | ) |
Test that footprint pads are included in SVG export.
This verifies that when a footprint is plotted, all its pads appear in the output.
Definition at line 961 of file test_clipboard_export.cpp.
References BOOST_REQUIRE(), SVG_PLOTTER::Circle(), SVG_PLOTTER::EndLayer(), SVG_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::OpenFile(), pad, FOOTPRINT::Pads(), pcbIUScale, radius, PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PAGE_INFO::SetHeightMils(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), SVG_PLOTTER::StartLayer(), and SVG_PLOTTER::StartPlot().
| BOOST_AUTO_TEST_CASE | ( | SvgExport_LayerNames | ) |
Test that board layer names are retrievable for SVG export.
Definition at line 495 of file test_clipboard_export.cpp.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_MultipleCopperLayers | ) |
Test that tracks on multiple copper layers can be created.
Definition at line 698 of file test_clipboard_export.cpp.
References B_Cu, BOOST_CHECK_EQUAL(), F_Cu, In1_Cu, and In2_Cu.
| BOOST_AUTO_TEST_CASE | ( | SvgExport_ZoneWithNet | ) |
Test that zone fills can be created.
Definition at line 797 of file test_clipboard_export.cpp.
References ZONE::AppendCorner(), B_Cu, BOOST_CHECK_EQUAL(), ZONE::GetFirstLayer(), ZONE::GetZoneName(), pcbIUScale, ZONE::SetLayer(), and ZONE::SetZoneName().
| BOOST_AUTO_TEST_CASE | ( | SvgPlotter_LayerSupport | ) |
Test that SVG_PLOTTER supports the StartLayer and EndLayer methods for proper Inkscape-compatible layer grouping.
Definition at line 132 of file test_clipboard_export.cpp.
References BOOST_AUTO_TEST_CASE(), BOOST_REQUIRE(), SVG_PLOTTER::EndLayer(), SVG_PLOTTER::EndPlot(), PLOTTER::OpenFile(), PSLIKE_PLOTTER::SetColor(), PAGE_INFO::SetHeightMils(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), PAGE_INFO::SetWidthMils(), SVG_PLOTTER::StartLayer(), SVG_PLOTTER::StartPlot(), and PLOTTER::ThickSegment().