KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_graphics_importer_buffer.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <eda_item.h>
#include <import_gfx/graphics_importer_buffer.h>
#include <base_units.h>
#include <limits>

Go to the source code of this file.

Classes

class  TEST_GRAPHICS_IMPORTER
 

Functions

 BOOST_AUTO_TEST_CASE (LargeCoordinatesAutoOffset)
 Test that large coordinates that would overflow when converted to internal units are automatically offset to fit within the valid coordinate range.
 
 BOOST_AUTO_TEST_CASE (NormalCoordinatesNoOffset)
 Test that normal coordinates (within valid range) are not modified.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( LargeCoordinatesAutoOffset )

Test that large coordinates that would overflow when converted to internal units are automatically offset to fit within the valid coordinate range.

This tests the fix for GitLab issue #9681 where DXF files with large coordinates (e.g., around 2300mm which exceeds INT_MAX/1e6 ~= 2147mm) caused visual corruption.

Definition at line 77 of file test_graphics_importer_buffer.cpp.

References GRAPHICS_IMPORTER_BUFFER::AddLine(), BOOST_AUTO_TEST_CASE(), end, GRAPHICS_IMPORTER::GetImportOffsetMM(), GRAPHICS_IMPORTER::GetMillimeterToIuFactor(), GRAPHICS_IMPORTER_BUFFER::ImportTo(), TEST_GRAPHICS_IMPORTER::m_lines, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( NormalCoordinatesNoOffset )

Test that normal coordinates (within valid range) are not modified.

Definition at line 123 of file test_graphics_importer_buffer.cpp.

References GRAPHICS_IMPORTER_BUFFER::AddLine(), end, GRAPHICS_IMPORTER::GetImportOffsetMM(), and GRAPHICS_IMPORTER_BUFFER::ImportTo().