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

Tests for symbol export to the SVG format. More...

#include "tl/expected.hpp"
#include <boost/test/unit_test.hpp>
#include <wx/ffile.h>
#include <wx/mstream.h>
#include <eda_units.h>
#include <lib_symbol.h>
#include <sch_pin.h>
#include <sch_shape.h>
#include <sch_text.h>
#include <sch_textbox.h>
#include <sch_painter.h>
#include <sch_plotter.h>
#include <settings/color_settings.h>
#include <qa_utils/svg_test_utils.h>
#include <wx/xml/xml.h>

Go to the source code of this file.

Classes

class  SYMBOL_SVG_EXPORT_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (SvgExport_ContainsPins)
 Test that a symbol with pins produces SVG output.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ContainsRectangle)
 Test that a symbol with a rectangle produces SVG output.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ContainsCircle)
 Test that a symbol with a circle produces SVG output.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ContainsPolyline)
 Test that a symbol with a polyline produces SVG output.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ContainsText)
 Test that a symbol with text produces SVG output.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ComplexSymbol)
 Test that a complex symbol with multiple elements produces valid SVG.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ViewBoxOrigin)
 A symbol body centred on the symbol origin extends to negative coordinates, so the exported SVG viewBox must start at a negative left/top edge, not at (0, 0).
 

Detailed Description

Tests for symbol export to the SVG format.

Definition in file test_symbol_svg_export.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ComplexSymbol )

Test that a complex symbol with multiple elements produces valid SVG.

Definition at line 237 of file test_symbol_svg_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsCircle )

Test that a symbol with a circle produces SVG output.

Definition at line 188 of file test_symbol_svg_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsPins )

Test that a symbol with pins produces SVG output.

Definition at line 153 of file test_symbol_svg_export.cpp.

References BOOST_AUTO_TEST_CASE().

◆ BOOST_AUTO_TEST_CASE() [4/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsPolyline )

Test that a symbol with a polyline produces SVG output.

Definition at line 205 of file test_symbol_svg_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [5/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsRectangle )

Test that a symbol with a rectangle produces SVG output.

Definition at line 172 of file test_symbol_svg_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [6/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsText )

Test that a symbol with text produces SVG output.

Definition at line 221 of file test_symbol_svg_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [7/7]

BOOST_AUTO_TEST_CASE ( SvgExport_ViewBoxOrigin )

A symbol body centred on the symbol origin extends to negative coordinates, so the exported SVG viewBox must start at a negative left/top edge, not at (0, 0).

This is an important contract of the SVG export because it allows plotted symbols to be placed into a parent document (e.g. for diffs) at a consistent position.

Detailed tests of viewboxes relative to SVG content (as opposed to symbols) are in SvgExport, this test only checks that the PlotSymbolToSVG() function drives the plotter to produce a correct viewBox.

Definition at line 281 of file test_symbol_svg_export.cpp.

References BOOST_REQUIRE(), BOOST_TEST(), KI_TEST::LoadSvg(), EDA_UNIT_UTILS::Mils2mm(), and KI_TEST::ParseViewBox().