| 8 | namespace snap::drawing { |
| 9 | |
| 10 | TEST(ImageBitmap, testBitmapFullConversion) { |
| 11 | auto bitmap = createTestBitmap(); |
| 12 | auto imageResult = Image::makeFromBitmap(bitmap, true); |
| 13 | ASSERT_FALSE(imageResult.failure()) << imageResult.error().getMessage(); |
| 14 | |
| 15 | auto image = imageResult.value(); |
| 16 | auto returnedBitmap = image->getBitmap(); |
| 17 | auto returnedInfo = returnedBitmap->getInfo(); |
| 18 | ASSERT_TRUE(returnedInfo == bitmap->getInfo()); |
| 19 | |
| 20 | const auto pixelDataSize = returnedInfo.height * returnedInfo.rowBytes; |
| 21 | auto bitmapData = static_cast<uint8_t*>(bitmap->lockBytes()); |
| 22 | auto returnedBitmapData = static_cast<uint8_t*>(returnedBitmap->lockBytes()); |
| 23 | |
| 24 | ASSERT_EQ(BytesView(nullptr, bitmapData, pixelDataSize), BytesView(nullptr, returnedBitmapData, pixelDataSize)); |
| 25 | } |
| 26 | } // namespace snap::drawing |
nothing calls this directly
no test coverage detected