wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
test_ConfigRoundtrip.cpp File Reference

Round-trip regression test for the mechanical scalar configuration settings. More...

#include <wx/app.h>
#include <wx/fileconf.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <wx/log.h>
#include "Configuration.h"
#include <cstdlib>
#include <type_traits>
#include <variant>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_ConfigRoundtrip.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("Every scalar setting in the table round-trips through write and read")
 
 SCENARIO ("Settings written only by WriteSettings() survive an OK-path round-trip")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Round-trip regression test for the mechanical scalar configuration settings.

ReadConfig() and the settings-writing side used to carry independent, hand-synced config->Read()/config->Write() call pairs; if the two ever drifted (a typo, or a key renamed on only one side) the affected setting silently stopped round-tripping - the same recurring bug class the styles had before Configuration::StyleConfigKeys().

Both sides now iterate Configuration::ScalarConfigSettings(). This test guards that table: it perturbs every listed member away from its default, writes the settings to a temporary config file, reads them back into a fresh Configuration, and checks every member arrives unchanged. A future key or type mismatch leaves the fresh instance at the default value for that key and fails the test naming it.