Add coverage for colors (extended) (#385)

This commit is contained in:
Arthur Sonzogni
2022-04-26 18:00:05 +02:00
committed by ArthurSonzogni
parent 04b36df567
commit 06ed8567b8
6 changed files with 113 additions and 11 deletions

View File

@@ -170,7 +170,8 @@ Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
// static
Color Color::Interpolate(float t, const Color& a, const Color& b) {
if (a.type_ == ColorType::Palette1) {
if (a.type_ == ColorType::Palette1 || //
b.type_ == ColorType::Palette1) {
if (t < 0.5F) { // NOLINT
return a;
} else {
@@ -178,14 +179,6 @@ Color Color::Interpolate(float t, const Color& a, const Color& b) {
}
}
if (b.type_ == ColorType::Palette1) {
if (t > 0.5F) { // NOLINT
return a;
} else {
return b;
}
}
auto get_color = [](const Color& color, //
uint8_t* red, uint8_t* green, uint8_t* blue) {
switch (color.type_) {