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

Round-trip regression test for the worksheet text styles. More...

#include <wx/app.h>
#include <wx/colour.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <wx/log.h>
#include "Configuration.h"
#include "cells/TextStyle.h"
#include <cstdint>
#include <cstdlib>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_StyleConfigRoundtrip.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("Both the light and dark style sets round-trip through Write/ReadStyles")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Round-trip regression test for the worksheet text styles.

ReadStyles() and WriteStyles() used to carry two independent, hand-synced lists of TextStyle -> config-key-prefix mappings. If the two lists ever drifted (a typo, or a key renamed on only one side) the affected style silently stopped round-tripping through the configuration storage – a recurring source of "my style settings don't stick" bugs.

Both functions now iterate a single source of truth, Configuration::StyleConfigKeys(). This test guards that: it gives every persisted style a distinct, prefix-derived color, writes the styles to a temporary config file, reads them back into a fresh Configuration, and checks that each style comes back with the color stored under its own key. A future read/write key mismatch makes a style read back the wrong color (or a default) and fails the test instead of shipping as a silent settings bug.