KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_design_block_io.cpp File Reference
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <wx/arrstr.h>
#include <wx/buffer.h>
#include <wx/translation.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <design_block_io.h>

Go to the source code of this file.

Classes

struct  TRANSLATED_KICAD_FIXTURE
 Installs a wxTranslations instance that actually translates "KiCad". More...
 

Functions

 BOOST_AUTO_TEST_CASE (ShowTypeIsLocaleIndependent)
 The type token serialized into the design-block-lib-table must be the ASCII literal "KiCad", never a translated string.
 
 BOOST_AUTO_TEST_CASE (EnumFromStrRoundTrips)
 EnumFromStr must map the ShowType output, and the bare ASCII token, back to KICAD_SEXP even with a translating catalog active.
 
 BOOST_AUTO_TEST_CASE (EnumFromStrAcceptsLegacyTranslatedToken)
 Backward compatibility: a table already corrupted by an older release that wrote the translated token must still load rather than report an unknown library type.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( EnumFromStrAcceptsLegacyTranslatedToken )

Backward compatibility: a table already corrupted by an older release that wrote the translated token must still load rather than report an unknown library type.

Definition at line 176 of file test_design_block_io.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), DESIGN_BLOCK_IO_MGR::EnumFromStr(), and DESIGN_BLOCK_IO_MGR::KICAD_SEXP.

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( EnumFromStrRoundTrips )

EnumFromStr must map the ShowType output, and the bare ASCII token, back to KICAD_SEXP even with a translating catalog active.

This is the load half of the table portability contract.

Definition at line 160 of file test_design_block_io.cpp.

References BOOST_CHECK_EQUAL(), DESIGN_BLOCK_IO_MGR::EnumFromStr(), DESIGN_BLOCK_IO_MGR::KICAD_SEXP, and DESIGN_BLOCK_IO_MGR::ShowType().

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( ShowTypeIsLocaleIndependent )

The type token serialized into the design-block-lib-table must be the ASCII literal "KiCad", never a translated string.

Locales that translate the product name (Finnish, Arabic, Tamil, Thai) otherwise write a table that no other locale can parse (issue 24659). With a catalog that translates "KiCad" active, ShowType must still emit the bare token; if the production code wraps it in _() this assertion fails.

Definition at line 145 of file test_design_block_io.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), DESIGN_BLOCK_IO_MGR::KICAD_SEXP, and DESIGN_BLOCK_IO_MGR::ShowType().