| 37 | #include "support/scratch_dir.h" |
| 38 | |
| 39 | TEST(ExportCore, NormalizeUint8GrayIdentityContrast) { |
| 40 | // 2x2 single-channel uint8, bc = {1,1,1,1, 0,0,0,0} (gain 1, bias 0), |
| 41 | // layout "rgba" |
| 42 | const std::uint8_t px[] = {0, 64, 128, 255}; |
| 43 | const auto img = oid::BufferExporter::normalize_to_rgba8_raw( |
| 44 | px, |
| 45 | oid::BufferType::UnsignedByte, |
| 46 | 2, |
| 47 | 2, |
| 48 | 1, |
| 49 | 2, |
| 50 | {1, 1, 1, 1, 0, 0, 0, 0}, |
| 51 | "rgba"); |
| 52 | ASSERT_EQ(img.width, 2); |
| 53 | ASSERT_EQ(img.height, 2); |
| 54 | ASSERT_EQ(img.pixels.size(), 16u); |
| 55 | // Grayscale repeats ch0 into G,B; A=255. |
| 56 | const std::uint8_t expected[] = { |
| 57 | 0, 0, 0, 255, 64, 64, 64, 255, 128, 128, 128, 255, 255, 255, 255, 255}; |
| 58 | EXPECT_TRUE(std::equal(img.pixels.begin(), img.pixels.end(), expected)); |
| 59 | } |
| 60 | |
| 61 | TEST(ExportCore, NormalizeFloatScalesTo255) { |
| 62 | const std::array<float, 2> px = {0.0f, |
nothing calls this directly
no test coverage detected