MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / TEST

Function TEST

pj_scene2D/tests/codecs_test.cpp:109–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107} // namespace
108
109TEST(PngCodecTest, RejectsAbsurdDimensionsBeforeAllocating) {
110 // A real 2x2 PNG with its IHDR forged to 11000x11000 (121 MP > the 100 MP cap).
111 // Without the cap the decoder value-initializes a ~240 MB buffer straight from
112 // these header bytes; the cap must reject up front with a dimension error.
113 auto small = PJ::test::makeGrayPng(2, 2, 16, std::vector<uint16_t>{0, 1000, 2000, 3000});
114 ASSERT_GT(small.size(), 33u);
115 auto huge = pngWithPatchedDimensions(small, 11000, 11000);
116
117 PJ::PngCodec codec;
118 auto result = codec.decode(rawBytesFrame(huge));
119 ASSERT_FALSE(result.has_value());
120 EXPECT_NE(result.error().find("dimension"), std::string::npos) << "got: " << result.error();
121}
122
123TEST(AutoImageCodecTest, NormalizesMono16PngToRgbGrayscale) {
124 const std::vector<uint16_t> values = {0, 1000, 2000, 3000};

Callers

nothing calls this directly

Calls 15

makeGrayPngFunction · 0.85
pngWithPatchedDimensionsFunction · 0.85
rawBytesFrameFunction · 0.85
mono16FrameFunction · 0.85
rgbFrameFunction · 0.85
channelEncodedMosaicFunction · 0.85
mono8MosaicFrameFunction · 0.85
expectRgbFunction · 0.85
BayerDecodeClass · 0.85
sizeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected