mirror of
https://github.com/esphome/esphome.git
synced 2026-10-16 19:22:49 +00:00
Expect the byte order constructor argument and compare the fallback colour without alpha
This commit is contained in:
@@ -745,7 +745,7 @@ def test_image_generation(
|
||||
in main_cpp
|
||||
)
|
||||
assert (
|
||||
"new(cat_img) image::Image(uint8_t_id, 32, 24, image::IMAGE_TYPE_RGB565, image::TRANSPARENCY_OPAQUE);"
|
||||
"new(cat_img) image::Image(uint8_t_id, 32, 24, image::IMAGE_TYPE_RGB565, image::TRANSPARENCY_OPAQUE, false);"
|
||||
in main_cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -172,7 +172,9 @@ TEST(ImageDraw, FallbackKeepsRgbChannelOrder) {
|
||||
image.draw(0, 0, &display, Color::WHITE, Color::BLACK);
|
||||
ASSERT_EQ(display.pixels.size(), static_cast<size_t>(W * H));
|
||||
for (const auto &pixel : display.pixels) {
|
||||
EXPECT_EQ(pixel.raw, image.get_pixel(pixel.x, pixel.y).raw_32) << "at " << pixel.x << "," << pixel.y;
|
||||
// get_pixel() reports an opaque pixel with alpha set; the fallback decodes colour only
|
||||
const Color expected = image.get_pixel(pixel.x, pixel.y);
|
||||
EXPECT_EQ(pixel.raw, Color(expected.r, expected.g, expected.b).raw_32) << "at " << pixel.x << "," << pixel.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user