KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_richio.cpp File Reference

Test suite for RICHIO and related formatting utilities. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <richio.h>
#include <io/kicad/kicad_io_utils.h>
#include <wx/base64.h>
#include <wx/mstream.h>

Go to the source code of this file.

Macros

#define wxUSE_BASE64   1
 

Functions

 BOOST_AUTO_TEST_CASE (PrettifyLargeImageData)
 Verify that Prettify produces well-formed output for large (data ...) blocks such as base64-encoded images, and that STRING_LINE_READER can read the result.
 
 BOOST_AUTO_TEST_CASE (PrettifyLongQuotedString)
 Verify that STRING_LINE_READER can handle prettified output containing a very long quoted string (e.g.
 
 BOOST_AUTO_TEST_CASE (IndentWritesTwoSpacesPerLevel)
 Indent writes two spaces per nesting level and nothing else.
 
 BOOST_AUTO_TEST_CASE (NestedPrintIndentsItsOutput)
 The nesting Print() overload prepends that same indentation to its formatted output.
 

Detailed Description

Test suite for RICHIO and related formatting utilities.

Definition in file test_richio.cpp.

Macro Definition Documentation

◆ wxUSE_BASE64

#define wxUSE_BASE64   1

Definition at line 30 of file test_richio.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( IndentWritesTwoSpacesPerLevel )

Indent writes two spaces per nesting level and nothing else.

Callers that want only the indentation, such as DSN::WIRE::Format re-indenting a closing paren, depend on the exact width.

Definition at line 116 of file test_richio.cpp.

References BOOST_CHECK_EQUAL(), STRING_FORMATTER::GetString(), and OUTPUTFORMATTER::Indent().

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( NestedPrintIndentsItsOutput )

The nesting Print() overload prepends that same indentation to its formatted output.

Definition at line 133 of file test_richio.cpp.

References BOOST_CHECK_EQUAL(), STRING_FORMATTER::GetString(), and OUTPUTFORMATTER::Print().

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( PrettifyLargeImageData )

Verify that Prettify produces well-formed output for large (data ...) blocks such as base64-encoded images, and that STRING_LINE_READER can read the result.

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23162

Definition at line 44 of file test_richio.cpp.

References BOOST_AUTO_TEST_CASE(), KICAD_FORMAT::FormatStreamData(), STRING_FORMATTER::GetString(), KICAD_FORMAT::Prettify(), OUTPUTFORMATTER::Print(), and STRING_LINE_READER::ReadLine().

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( PrettifyLongQuotedString )

Verify that STRING_LINE_READER can handle prettified output containing a very long quoted string (e.g.

a property value that exceeds the old 1 MB limit).

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23162

Definition at line 84 of file test_richio.cpp.

References STRING_FORMATTER::GetString(), KICAD_FORMAT::Prettify(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotes(), and STRING_LINE_READER::ReadLine().