Skip to content

Colour tests in jcode-tui-style and jcode-tui-workspace fail when COLORTERM is unset #1557

Description

@Kenmege

Observed

Three colour tests assert exact truecolor (Color::Rgb) output, but they get their colour capability from the environment of the process running the tests. When COLORTERM is unset (and no truecolor TERM_PROGRAM is detected) they quantize to the 256-colour palette and fail. This happens on macOS and Linux alike. They pass only when the shell exports COLORTERM=truecolor.

  • jcode-tui-style: palette::buffer_tests::configured_role_recolors_role_cells_and_named_colors_only
  • jcode-tui-style: palette::light_theme_interaction::configured_colors_survive_the_light_theme_pass
  • jcode-tui-workspace: workspace_map_widget::tests::render_workspace_map_colors_completed_tiles_green

Reproduction (master 4c4d965)

$ env -u COLORTERM -u TERM_PROGRAM cargo test -p jcode-tui-style -p jcode-tui-workspace --lib --no-fail-fast
test palette::buffer_tests::configured_role_recolors_role_cells_and_named_colors_only ... FAILED
test palette::light_theme_interaction::configured_colors_survive_the_light_theme_pass ... FAILED
test result: FAILED. 80 passed; 2 failed; 1 ignored
test workspace_map_widget::tests::render_workspace_map_colors_completed_tiles_green ... FAILED
test result: FAILED. 23 passed; 1 failed; 0 ignored

$ COLORTERM=truecolor cargo test -p jcode-tui-style -p jcode-tui-workspace --lib --no-fail-fast
test result: ok. 82 passed; 0 failed; 1 ignored
test result: ok. 24 passed; 0 failed; 0 ignored

Expected

The tests pin the capability they assert, as the jcode-tui palette topology tests already do with jcode_tui_style::color::pin_truecolor_for_tests(), so their result does not depend on the shell running them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions