KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue24858_variant_persistence.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <memory>
#include <lib_symbol.h>
#include <sch_pin.h>
#include <sch_symbol.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <settings/settings_manager.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <locale_io.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>

Go to the source code of this file.

Classes

struct  ISSUE24858_FIXTURE
 Regression tests for issue 24858, deleted design variants reappear after reload. More...
 

Functions

 BOOST_AUTO_TEST_CASE (BaseValueSetCreatesNoEntry)
 Setting a variant attribute to the value it already resolves to must not create an instance variant entry.
 
 BOOST_AUTO_TEST_CASE (DiffLessEntryNotSerialized)
 An instance variant entry with no differences from the base symbol must not be serialized.
 
 BOOST_AUTO_TEST_CASE (RealEntryStillSerialized)
 Positive control, an entry with a real differential must still be serialized.
 
 BOOST_AUTO_TEST_CASE (DeletedVariantStaysDeleted)
 The issue 24858 flow.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( BaseValueSetCreatesNoEntry )

Setting a variant attribute to the value it already resolves to must not create an instance variant entry.

This is what the symbol fields table apply pass does for every symbol, and it is the source of the phantom (variant (name "X")) blocks.

Definition at line 167 of file test_issue24858_variant_persistence.cpp.

References BOOST_AUTO_TEST_CASE().

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( DeletedVariantStaysDeleted )

The issue 24858 flow.

A variant is deleted, then an apply pass writes the resolved (now base) attribute values back with the deleted variant name. After save and reload no trace of the variant may remain.

Definition at line 226 of file test_issue24858_variant_persistence.cpp.

References BOOST_REQUIRE(), SCH_SYMBOL::GetInstances(), and reload.

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( DiffLessEntryNotSerialized )

An instance variant entry with no differences from the base symbol must not be serialized.

Diff-less blocks in the file are what resurrect deleted variants on the next load.

Definition at line 187 of file test_issue24858_variant_persistence.cpp.

References SCH_SYMBOL_VARIANT::InitializeAttributes().

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( RealEntryStillSerialized )

Positive control, an entry with a real differential must still be serialized.

Definition at line 204 of file test_issue24858_variant_persistence.cpp.

References SCH_SYMBOL_VARIANT::InitializeAttributes(), and VARIANT::m_DNP.