KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_footprint_editor_tabs.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <memory>
#include <functional>
#include <vector>
#include <board.h>
#include <footprint.h>
#include <lib_id.h>
#include <pcb_text.h>
#include <footprint_edit_frame.h>
#include <footprint_editor_settings.h>
#include <footprint_editor_tab_context.h>

Go to the source code of this file.

Classes

class  INSTRUMENTED_BOARD
 A BOARD that bumps a counter on destruction, to observe when a displaced tab's board is freed. More...
 

Functions

static std::unique_ptr< BOARDmakeFpHolder (const wxString &aLib, const wxString &aName)
 Build an fp-holder BOARD carrying a single footprint with the given identity.
 
 BOOST_AUTO_TEST_CASE (ReusedPreviewTabBoardOutlivesInstall)
 Reusing a preview tab must install the successor board before the displaced board is freed, so the canvas VIEW never clears items from a destroyed board.
 
 BOOST_AUTO_TEST_CASE (NewFootprintDetachedFromOutgoingBoard)
 A new footprint is parented to the active board, which opening its tab frees.
 
 BOOST_AUTO_TEST_CASE (BoardSourcedFootprintKeepsItsBoard)
 A footprint opened from the board keeps the legacy single-board path, so no tab is opened and nothing detaches it from the board it is being edited on.
 
 BOOST_AUTO_TEST_CASE (TablessAndAnonymousLoadsKeepTheirBoard)
 Without a tab strip, or without a library nickname to key a tab on, the load stays on the active board and the footprint keeps its parent.
 
 BOOST_AUTO_TEST_CASE (ContextIdentityAndDirty)
 
 BOOST_AUTO_TEST_CASE (ContextEmptyBoardIsNeverDirty)
 
 BOOST_AUTO_TEST_CASE (InstanceTabContextIsTransientAndKeyedByUuid)
 An instance (board) tab owns its fp-holder board, reports IsTransient(), keys off the source board footprint UUID in a namespace disjoint from library keys, and carries the board-uuid remap.
 
 BOOST_AUTO_TEST_CASE (SettingsOpenTabsRoundTrip)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/8]

BOOST_AUTO_TEST_CASE ( BoardSourcedFootprintKeepsItsBoard )

A footprint opened from the board keeps the legacy single-board path, so no tab is opened and nothing detaches it from the board it is being edited on.

Definition at line 143 of file test_footprint_editor_tabs.cpp.

References BOOST_CHECK_EQUAL(), BOARD_ITEM::GetBoard(), makeFpHolder(), FOOTPRINT_EDIT_FRAME::prepareFootprintTabHandoff(), and FOOTPRINT::SetLink().

◆ BOOST_AUTO_TEST_CASE() [2/8]

BOOST_AUTO_TEST_CASE ( ContextEmptyBoardIsNeverDirty )

◆ BOOST_AUTO_TEST_CASE() [3/8]

◆ BOOST_AUTO_TEST_CASE() [4/8]

BOOST_AUTO_TEST_CASE ( InstanceTabContextIsTransientAndKeyedByUuid )

◆ BOOST_AUTO_TEST_CASE() [5/8]

BOOST_AUTO_TEST_CASE ( NewFootprintDetachedFromOutgoingBoard )

A new footprint is parented to the active board, which opening its tab frees.

It must be detached before the switch, or the FOOTPRINT::Clone() in ReloadFootprint walks freed memory.

Definition at line 115 of file test_footprint_editor_tabs.cpp.

References APPEND, BOOST_CHECK_EQUAL(), FPHOLDER, and FOOTPRINT_EDIT_FRAME::prepareFootprintTabHandoff().

◆ BOOST_AUTO_TEST_CASE() [6/8]

BOOST_AUTO_TEST_CASE ( ReusedPreviewTabBoardOutlivesInstall )

Reusing a preview tab must install the successor board before the displaced board is freed, so the canvas VIEW never clears items from a destroyed board.

Definition at line 73 of file test_footprint_editor_tabs.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), FPHOLDER, FOOTPRINT_EDITOR_TAB_CONTEXT::GetBoard(), makeFpHolder(), and FOOTPRINT_EDIT_FRAME::placeReusedTabContext().

◆ BOOST_AUTO_TEST_CASE() [7/8]

◆ BOOST_AUTO_TEST_CASE() [8/8]

BOOST_AUTO_TEST_CASE ( TablessAndAnonymousLoadsKeepTheirBoard )

Without a tab strip, or without a library nickname to key a tab on, the load stays on the active board and the footprint keeps its parent.

Definition at line 157 of file test_footprint_editor_tabs.cpp.

References BOOST_CHECK_EQUAL(), BOARD_ITEM::GetBoard(), makeFpHolder(), FOOTPRINT_EDIT_FRAME::prepareFootprintTabHandoff(), and FOOTPRINT::SetFPID().

◆ makeFpHolder()

static std::unique_ptr< BOARD > makeFpHolder ( const wxString & aLib,
const wxString & aName )
static

Build an fp-holder BOARD carrying a single footprint with the given identity.

Definition at line 38 of file test_footprint_editor_tabs.cpp.

References FOOTPRINT, FPHOLDER, and FOOTPRINT::SetFPID().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().