Skip to content

theme_test.cpp

file tests/app/theme_test.cpp · Test suite

Tests of nmeasim::app::theme::Theme and the themed parts of the desktop application.

Source tests/app/theme_test.cpp

Covers the console colouring by nmeasim::app::sentence_spans, theme names, applying a theme to the application palette and style sheet only when the look changes, the system look following the desktop colour scheme where the platform lets the test choose it, the bundled readout font, the toolbar icons, nmeasim::app::StatusLed, the override mark of nmeasim::app::InstrumentTile, the colours of output states, and the status lights and theme menu of nmeasim::app::MainWindow. The theme is a process-wide singleton, so a test that depends on one theme applies it first. The last test stores the theme choice through QSettings, which main.cpp redirects to a temporary directory. The file reads no fixtures.

Test cases

11 test cases, in source order.

Test case Tags
console lines are split into coloured runs [app][theme]
theme names round-trip and unknown names give the night theme [app][theme]
applying a theme sets the palette and the style sheet [app][theme]
applying the look in use again changes nothing [app][theme]
the system look follows the desktop colour scheme [app][theme]
the readout font is the bundled Share Tech Mono [app][theme]
every icon is painted in both states [app][theme]
status lights show a colour, a caption and blink [app][theme]
an active override marks the instrument tile [app][theme]
output states map to theme colours [app][theme]
the main window shows its state in lights and switches themes [app][theme][integration]

Summary

File-local enumerations

Name Description
SentenceRole The parts of a console line that are coloured differently.

File-local functions

Name Description
spans() Splits a console line into coloured runs.

File-local enumerations

SentenceRole

enum class SentenceRole

The parts of a console line that are coloured differently.

Each role has its own colour in theme::Colors.

Declared in tests/app/theme_test.cpp:41 · defined in src/app/widgets/sentence_highlighter.hpp:24

File-local functions

spans()

std::vector<SentenceSpan> spans(const char* line)

Splits a console line into coloured runs.

Parameters

Name Type Description
line const char* The line as Latin-1 text, without a line terminator.

Returns std::vector<SentenceSpan>: The runs nmeasim::app::sentence_spans finds, in order of their start.

Declared in tests/app/theme_test.cpp:50