|
KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>#include <sch_label.h>#include <sch_text.h>#include <font/font.h>#include <font/outline_font.h>#include <font/stroke_font.h>#include <settings/settings_manager.h>Go to the source code of this file.
Classes | |
| struct | LABEL_BBOX_FIXTURE |
| Test fixture for label bounding box tests. More... | |
Functions | |
| BOOST_AUTO_TEST_CASE (TextBoundingBoxStrokeFont) | |
| Test that SCH_TEXT bounding boxes are correct with the default KiCad font (stroke font). | |
| BOOST_AUTO_TEST_CASE (TextBoundingBoxOutlineFont) | |
| Test that SCH_TEXT bounding boxes are correct with an outline font. | |
| BOOST_AUTO_TEST_CASE (TextBoundingBoxVariousStrings) | |
| Test various text strings to ensure bounding boxes are correct. | |
| BOOST_AUTO_TEST_CASE (LabelBodyBoundingBoxStrokeFont) | |
| Test that SCH_LABEL body bounding boxes are correct with stroke font. | |
| BOOST_AUTO_TEST_CASE (LabelBodyBoundingBoxOutlineFont) | |
| Test that SCH_LABEL body bounding boxes are correct with outline font. | |
| BOOST_AUTO_TEST_CASE (GlobalLabelBodyBoundingBoxStrokeFont) | |
| Test that SCH_GLOBALLABEL body bounding boxes are correct with stroke font. | |
| BOOST_AUTO_TEST_CASE (GlobalLabelBodyBoundingBoxOutlineFont) | |
| Test that SCH_GLOBALLABEL body bounding boxes are correct with outline font. | |
| BOOST_AUTO_TEST_CASE (HierLabelBodyBoundingBoxStrokeFont) | |
| Test that SCH_HIERLABEL body bounding boxes are correct with stroke font. | |
| BOOST_AUTO_TEST_CASE (HierLabelBodyBoundingBoxOutlineFont) | |
| Test that SCH_HIERLABEL body bounding boxes are correct with outline font. | |
| BOOST_AUTO_TEST_CASE (TextOffsetStrokeFontIsZero) | |
| Test that GetOffsetToMatchSCH_FIELD() returns zero for stroke fonts. | |
| BOOST_AUTO_TEST_CASE (TextOffsetOutlineFontIsNonZero) | |
| Test that GetOffsetToMatchSCH_FIELD() returns a non-zero offset for outline fonts, and that applying it to GetBoundingBox() moves the box upward (toward the actual text position). | |
| BOOST_AUTO_TEST_CASE (BoundingBoxRefreshedAfterFontResolve) | |
| Regression test for issue #23310. | |
| BOOST_AUTO_TEST_CASE | ( | BoundingBoxRefreshedAfterFontResolve | ) |
Regression test for issue #23310.
The bbox cache is keyed on draw position, not on the font, so resolving a lazily-loaded font must invalidate it. Otherwise the selection highlight stays sized for the stroke fallback until an unrelated setter clears the cache (the original report: first line excluded until the text was moved or its dialog opened).
Definition at line 395 of file test_label_bounding_box.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), expected, SCH_TEXT::GetBoundingBox(), BOX2< Vec >::GetHeight(), KIFONT::FONT::GetName(), EDA_TEXT::ResolveFont(), EDA_TEXT::SetFont(), EDA_TEXT::SetMultilineAllowed(), EDA_TEXT::SetTextSize(), and EDA_TEXT::SetUnresolvedFontName().
| BOOST_AUTO_TEST_CASE | ( | GlobalLabelBodyBoundingBoxOutlineFont | ) |
Test that SCH_GLOBALLABEL body bounding boxes are correct with outline font.
This is the most visible case of the bug where the bounding box was double-width.
Definition at line 278 of file test_label_bounding_box.cpp.
References BOOST_TEST_MESSAGE(), EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | GlobalLabelBodyBoundingBoxStrokeFont | ) |
Test that SCH_GLOBALLABEL body bounding boxes are correct with stroke font.
Definition at line 263 of file test_label_bounding_box.cpp.
References EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | HierLabelBodyBoundingBoxOutlineFont | ) |
Test that SCH_HIERLABEL body bounding boxes are correct with outline font.
Definition at line 314 of file test_label_bounding_box.cpp.
References BOOST_TEST_MESSAGE(), EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | HierLabelBodyBoundingBoxStrokeFont | ) |
Test that SCH_HIERLABEL body bounding boxes are correct with stroke font.
Definition at line 300 of file test_label_bounding_box.cpp.
References EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | LabelBodyBoundingBoxOutlineFont | ) |
Test that SCH_LABEL body bounding boxes are correct with outline font.
Definition at line 241 of file test_label_bounding_box.cpp.
References BOOST_TEST_MESSAGE(), EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | LabelBodyBoundingBoxStrokeFont | ) |
Test that SCH_LABEL body bounding boxes are correct with stroke font.
Definition at line 227 of file test_label_bounding_box.cpp.
References EDA_TEXT::SetFont(), and EDA_TEXT::SetTextSize().
| BOOST_AUTO_TEST_CASE | ( | TextBoundingBoxOutlineFont | ) |
Test that SCH_TEXT bounding boxes are correct with an outline font.
Definition at line 161 of file test_label_bounding_box.cpp.
References BOOST_TEST_MESSAGE(), KIFONT::FONT::GetName(), and text.
| BOOST_AUTO_TEST_CASE | ( | TextBoundingBoxStrokeFont | ) |
Test that SCH_TEXT bounding boxes are correct with the default KiCad font (stroke font).
Definition at line 146 of file test_label_bounding_box.cpp.
References BOOST_AUTO_TEST_CASE(), and text.
| BOOST_AUTO_TEST_CASE | ( | TextBoundingBoxVariousStrings | ) |
Test various text strings to ensure bounding boxes are correct.
Definition at line 185 of file test_label_bounding_box.cpp.
References text.
| BOOST_AUTO_TEST_CASE | ( | TextOffsetOutlineFontIsNonZero | ) |
Test that GetOffsetToMatchSCH_FIELD() returns a non-zero offset for outline fonts, and that applying it to GetBoundingBox() moves the box upward (toward the actual text position).
Definition at line 353 of file test_label_bounding_box.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_TEST_MESSAGE(), BOX2< Vec >::GetTop(), BOX2< Vec >::Offset(), text, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | TextOffsetStrokeFontIsZero | ) |
Test that GetOffsetToMatchSCH_FIELD() returns zero for stroke fonts.
Definition at line 336 of file test_label_bounding_box.cpp.
References BOOST_CHECK_EQUAL(), text, VECTOR2< T >::x, and VECTOR2< T >::y.