24#ifndef QA_UTILS_PDF_TEST_UTILS_H
25#define QA_UTILS_PDF_TEST_UTILS_H
71 bool aBold =
false,
bool aItalic =
false );
89int CountOccurrences(
const std::string& aHaystack,
const std::string& aNeedle );
94inline bool PdfContains(
const std::string& aBuffer,
const char* aNeedle )
96 return aBuffer.find( aNeedle ) != std::string::npos;
110 long& aOutDarkPixels );
115void MaybeRemoveFile(
const wxString& aPath,
const wxString& aEnvVar = wxT(
"KICAD_KEEP_TEST_PDF" ) );
A color representation with 4 components: red, green, blue, alpha.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
An abstract base class for deriving all objects that can be added to a VIEW.
void SetBackgroundColor(const KIGFX::COLOR4D &aColor) override
Set the background color.
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
KIGFX::COLOR4D m_background
const KIGFX::COLOR4D & GetCursorColor() override
Return current cursor color settings.
const KIGFX::COLOR4D & GetGridColor() override
Return current grid color settings.
KIGFX::COLOR4D GetColor(const KIGFX::VIEW_ITEM *, int) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
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 ReadPdfWithDecompressedStreams(const wxString &aPdfPath, std::string &aOutBuffer)
Read a PDF file and append best-effort decompressed contents of any Flate streams to the returned buf...
std::unique_ptr< KIFONT::STROKE_FONT > LoadStrokeFontUnique()
Load the default stroke font and return a unique_ptr for RAII deletion.
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.
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.
wxString MakeTempPdfPath(const wxString &aPrefix)
Make a temporary file path with .pdf extension using a given prefix.
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).