MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

snap_drawing/test/src/ImageBitmap_tests.cpp:10–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace snap::drawing {
9
10TEST(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

Callers

nothing calls this directly

Calls 9

createTestBitmapFunction · 0.85
getMessageMethod · 0.65
errorMethod · 0.65
valueMethod · 0.65
getInfoMethod · 0.65
BytesViewClass · 0.50
failureMethod · 0.45
getBitmapMethod · 0.45
lockBytesMethod · 0.45

Tested by

no test coverage detected