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

Tests for multi-format clipboard export functionality for symbol editor. More...

#include <boost/test/unit_test.hpp>
#include <lib_symbol.h>
#include <sch_pin.h>
#include <sch_shape.h>
#include <sch_text.h>
#include <sch_textbox.h>
#include <plotters/plotters_pslike.h>
#include <sch_painter.h>
#include <sch_plotter.h>
#include <locale_io.h>
#include <settings/color_settings.h>
#include <wx/ffile.h>
#include <wx/mstream.h>

Go to the source code of this file.

Classes

class  SYMBOL_CLIPBOARD_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 (BoundingBox_Pins)
 Test that bounding box is calculated correctly for pins.
 
 BOOST_AUTO_TEST_CASE (BoundingBox_Rectangle)
 Test that bounding box is calculated correctly for rectangle.
 
 BOOST_AUTO_TEST_CASE (BoundingBox_Circle)
 Test that bounding box is calculated correctly for circle.
 
 BOOST_AUTO_TEST_CASE (SvgExport_ComplexSymbol)
 Test that a complex symbol with multiple elements produces valid SVG.
 
 BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_OpaquePixel)
 Test PNG alpha computation formula: Given pixels on white background (W) and black background (B), alpha = 255 - (W - B), and color = B * 255 / alpha.
 
 BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_TransparentPixel)
 Test PNG alpha computation for transparent pixel.
 
 BOOST_AUTO_TEST_CASE (PngExport_AlphaComputation_SemiTransparentPixel)
 Test PNG alpha computation for semi-transparent pixel.
 
 BOOST_AUTO_TEST_CASE (SvgExport_EmptySymbol)
 Test that an empty symbol produces empty SVG content.
 

Detailed Description

Tests for multi-format clipboard export functionality for symbol editor.

These tests verify:

  1. SVG export produces valid output for symbols
  2. Symbol bounding box calculation is correct for different element types
  3. PNG alpha computation using dual-buffer technique

Definition in file test_symbol_clipboard_export.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/13]

BOOST_AUTO_TEST_CASE ( BoundingBox_Circle )

Test that bounding box is calculated correctly for circle.

Definition at line 325 of file test_symbol_clipboard_export.cpp.

References std::abs(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), radius, and schIUScale.

◆ BOOST_AUTO_TEST_CASE() [2/13]

BOOST_AUTO_TEST_CASE ( BoundingBox_Pins )

Test that bounding box is calculated correctly for pins.

Definition at line 291 of file test_symbol_clipboard_export.cpp.

References BOX2< Vec >::GetHeight(), and BOX2< Vec >::GetWidth().

◆ BOOST_AUTO_TEST_CASE() [3/13]

BOOST_AUTO_TEST_CASE ( BoundingBox_Rectangle )

Test that bounding box is calculated correctly for rectangle.

Definition at line 307 of file test_symbol_clipboard_export.cpp.

References std::abs(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), and schIUScale.

◆ BOOST_AUTO_TEST_CASE() [4/13]

BOOST_AUTO_TEST_CASE ( PngExport_AlphaComputation_OpaquePixel )

Test PNG alpha computation formula: Given pixels on white background (W) and black background (B), alpha = 255 - (W - B), and color = B * 255 / alpha.

Definition at line 381 of file test_symbol_clipboard_export.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [5/13]

BOOST_AUTO_TEST_CASE ( PngExport_AlphaComputation_SemiTransparentPixel )

Test PNG alpha computation for semi-transparent pixel.

Definition at line 421 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [6/13]

BOOST_AUTO_TEST_CASE ( PngExport_AlphaComputation_TransparentPixel )

Test PNG alpha computation for transparent pixel.

Definition at line 401 of file test_symbol_clipboard_export.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [7/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ComplexSymbol )

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

Definition at line 343 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [8/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsCircle )

Test that a symbol with a circle produces SVG output.

Definition at line 242 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [9/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsPins )

Test that a symbol with pins produces SVG output.

Definition at line 207 of file test_symbol_clipboard_export.cpp.

References BOOST_AUTO_TEST_CASE().

◆ BOOST_AUTO_TEST_CASE() [10/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsPolyline )

Test that a symbol with a polyline produces SVG output.

Definition at line 259 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [11/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsRectangle )

Test that a symbol with a rectangle produces SVG output.

Definition at line 226 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [12/13]

BOOST_AUTO_TEST_CASE ( SvgExport_ContainsText )

Test that a symbol with text produces SVG output.

Definition at line 275 of file test_symbol_clipboard_export.cpp.

◆ BOOST_AUTO_TEST_CASE() [13/13]

BOOST_AUTO_TEST_CASE ( SvgExport_EmptySymbol )

Test that an empty symbol produces empty SVG content.

Definition at line 445 of file test_symbol_clipboard_export.cpp.

References BOX2< Vec >::GetHeight(), and BOX2< Vec >::GetWidth().