KiCad PCB EDA Suite
Loading...
Searching...
No Matches
BITMAP_OVERLAY_TEST_HELPERS Namespace Reference

Helper functions that mirror the logic from DRC_RE_BITMAP_OVERLAY_PANEL. More...

Functions

double ComputeScaleFactor (double aRawScale)
 Compute the scale factor from a raw content scale factor.
 
wxPoint ScalePosition (int aX, int aY, double aScaleFactor)
 Scale a position from 1x bitmap coordinates to display coordinates.
 
wxSize ScaleSize (int aWidth, int aHeight, double aScaleFactor)
 Scale a size from 1x bitmap coordinates to display coordinates.
 
bool IsOutOfBounds (const wxPoint &aScaledPos, const wxSize &aScaledSize, const wxSize &aBitmapSize)
 Check if a field position exceeds bitmap bounds.
 
void SortByTabOrder (std::vector< DRC_RE_FIELD_POSITION > &aPositions)
 Sort field positions by tab order.
 

Detailed Description

Helper functions that mirror the logic from DRC_RE_BITMAP_OVERLAY_PANEL.

These allow testing the mathematical operations without requiring wxWidgets GUI.

Function Documentation

◆ ComputeScaleFactor()

double BITMAP_OVERLAY_TEST_HELPERS::ComputeScaleFactor ( double aRawScale)

Compute the scale factor from a raw content scale factor.

Mirrors GetScaleFactor() logic from DRC_RE_BITMAP_OVERLAY_PANEL.

Definition at line 44 of file test_drc_bitmap_overlay_panel.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ IsOutOfBounds()

bool BITMAP_OVERLAY_TEST_HELPERS::IsOutOfBounds ( const wxPoint & aScaledPos,
const wxSize & aScaledSize,
const wxSize & aBitmapSize )

Check if a field position exceeds bitmap bounds.

Mirrors bounds check logic from PositionFields() in DRC_RE_BITMAP_OVERLAY_PANEL.

Definition at line 79 of file test_drc_bitmap_overlay_panel.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(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ ScalePosition()

wxPoint BITMAP_OVERLAY_TEST_HELPERS::ScalePosition ( int aX,
int aY,
double aScaleFactor )

Scale a position from 1x bitmap coordinates to display coordinates.

Mirrors ScalePosition() logic from DRC_RE_BITMAP_OVERLAY_PANEL.

Definition at line 59 of file test_drc_bitmap_overlay_panel.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ ScaleSize()

wxSize BITMAP_OVERLAY_TEST_HELPERS::ScaleSize ( int aWidth,
int aHeight,
double aScaleFactor )

Scale a size from 1x bitmap coordinates to display coordinates.

Mirrors ScaleSize() logic from DRC_RE_BITMAP_OVERLAY_PANEL.

Definition at line 69 of file test_drc_bitmap_overlay_panel.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SortByTabOrder()

void BITMAP_OVERLAY_TEST_HELPERS::SortByTabOrder ( std::vector< DRC_RE_FIELD_POSITION > & aPositions)

Sort field positions by tab order.

Mirrors expected keyboard navigation order.

Definition at line 90 of file test_drc_bitmap_overlay_panel.cpp.

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().