Skip to content

Commit

Permalink
test unindexed colors don't get mixed with indexed ones with same RGBA
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Sep 14, 2022
1 parent de440d3 commit 13c56c8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/colors_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ def test_color_like_namedtuple():
],
id="fill-empty-slots",
),
# unindexed color are never conflated with those with an explicit index
# even if == RGBA value, for selecting a different palette should not
# inadvertently affect colors that weren't explicitly assigned an index
pytest.param(
[
Color(0xFF, 0, 0, 1.0),
Color(0xFF, 0, 0, 1.0, palette_index=0),
],
[
Color(0xFF, 0, 0, 1.0, palette_index=0),
Color(0xFF, 0, 0, 1.0),
],
id="keep-unindexed-distinct",
),
],
)
def test_uniq_sort_cpal_colors(colors, expected):
Expand Down
1 change: 1 addition & 0 deletions tests/cpal_color_indices.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/write_font_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,5 +645,6 @@ def test_colr_keep_cpal_palette_entry_indices():
"#FF0000FF", # red was var(--color0)
"#00FF00FF", # 'lime' had no var(--color), implicitly placed in empty slot
"#0000FFFF", # blue was var(--color2)
"#FF0000FF", # same as #0 but no explicit index; placed in unindexed slot
"#FFFFFFFF", # white had no var(--color), no empty slots, appended at the end
]

0 comments on commit 13c56c8

Please sign in to comment.