KiCad PCB EDA Suite
|
#include <memory>
#include <string>
#include <wx/string.h>
#include <gal/color4d.h>
#include <render_settings.h>
#include <font/text_attributes.h>
#include <font/stroke_font.h>
Go to the source code of this file.
Classes | |
class | SIMPLE_RENDER_SETTINGS |
Minimal concrete render settings suitable for plotters in tests. More... | |
Functions | |
wxString | MakeTempPdfPath (const wxString &aPrefix) |
Make a temporary file path with .pdf extension using a given prefix. | |
TEXT_ATTRIBUTES | BuildTextAttributes (int aSizeIu=3000, int aStrokeWidth=300, bool aBold=false, bool aItalic=false) |
Build a commonly used set of text attributes for plotting text in tests. | |
std::unique_ptr< KIFONT::STROKE_FONT > | LoadStrokeFontUnique () |
Load the default stroke font and return a unique_ptr for RAII deletion. | |
bool | ReadPdfWithDecompressedStreams (const wxString &aPdfPath, std::string &aOutBuffer) |
Read a PDF file and append best-effort decompressed contents of any Flate streams to the returned buffer to make text searches easier. | |
int | CountOccurrences (const std::string &aHaystack, const std::string &aNeedle) |
Count occurrences of a substring in a string (overlapping allowed). | |
bool | PdfContains (const std::string &aBuffer, const char *aNeedle) |
Convenience contains check. | |
bool | RasterizePdfCountDark (const wxString &aPdfPath, int aDpi, int aNearWhiteThresh, long &aOutDarkPixels) |
Rasterize a PDF page to PNG using pdftoppm if available and count non-near-white pixels. | |
void | MaybeRemoveFile (const wxString &aPath, const wxString &aEnvVar=wxT("KICAD_KEEP_TEST_PDF")) |
Remove a file unless the given environment variable is set (defaults to KICAD_KEEP_TEST_PDF). | |
TEXT_ATTRIBUTES BuildTextAttributes | ( | int | aSizeIu = 3000, |
int | aStrokeWidth = 300, | ||
bool | aBold = false, | ||
bool | aItalic = false ) |
Build a commonly used set of text attributes for plotting text in tests.
aSizeIu | Size in internal units (both X and Y) |
aStrokeWidth | Stroke width in internal units (0 for outline fonts) |
aBold | Bold flag |
aItalic | Italic flag |
Definition at line 55 of file pdf_test_utils.cpp.
References ANGLE_0, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_BOTTOM, TEXT_ATTRIBUTES::m_Angle, TEXT_ATTRIBUTES::m_Bold, TEXT_ATTRIBUTES::m_Halign, TEXT_ATTRIBUTES::m_Italic, TEXT_ATTRIBUTES::m_Mirrored, TEXT_ATTRIBUTES::m_Multiline, TEXT_ATTRIBUTES::m_Size, TEXT_ATTRIBUTES::m_StrokeWidth, and TEXT_ATTRIBUTES::m_Valign.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
int CountOccurrences | ( | const std::string & | aHaystack, |
const std::string & | aNeedle ) |
Count occurrences of a substring in a string (overlapping allowed).
Definition at line 144 of file pdf_test_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
std::unique_ptr< KIFONT::STROKE_FONT > LoadStrokeFontUnique | ( | ) |
Load the default stroke font and return a unique_ptr for RAII deletion.
Definition at line 70 of file pdf_test_utils.cpp.
References KIFONT::STROKE_FONT::LoadFont().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
wxString MakeTempPdfPath | ( | const wxString & | aPrefix | ) |
Make a temporary file path with .pdf extension using a given prefix.
Definition at line 36 of file pdf_test_utils.cpp.
Referenced by getTempPdfPath().
void MaybeRemoveFile | ( | const wxString & | aPath, |
const wxString & | aEnvVar = wxT("KICAD_KEEP_TEST_PDF") ) |
Remove a file unless the given environment variable is set (defaults to KICAD_KEEP_TEST_PDF).
Definition at line 213 of file pdf_test_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Convenience contains check.
Definition at line 94 of file pdf_test_utils.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
bool RasterizePdfCountDark | ( | const wxString & | aPdfPath, |
int | aDpi, | ||
int | aNearWhiteThresh, | ||
long & | aOutDarkPixels ) |
Rasterize a PDF page to PNG using pdftoppm if available and count non-near-white pixels.
aPdfPath | Input PDF path. |
aDpi | Rasterization DPI. |
aNearWhiteThresh | Threshold for each RGB channel to consider white (e.g., 240). |
aOutDarkPixels | Output: number of pixels darker than threshold. |
Definition at line 164 of file pdf_test_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
bool ReadPdfWithDecompressedStreams | ( | const wxString & | aPdfPath, |
std::string & | aOutBuffer ) |
Read a PDF file and append best-effort decompressed contents of any Flate streams to the returned buffer to make text searches easier.
Definition at line 126 of file pdf_test_utils.cpp.
References append_decompressed_streams().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().