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

Function TEST

tests/io/buffer_export_core_test.cpp:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37#include "support/scratch_dir.h"
38
39TEST(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
61TEST(ExportCore, NormalizeFloatScalesTo255) {
62 const std::array<float, 2> px = {0.0f,

Callers

nothing calls this directly

Calls 7

normalize_to_rgba8_rawFunction · 0.85
scratch_dirFunction · 0.85
export_octave_rawFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected