// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include #include #include "../preview//JFJochJPEG.h" #include "../preview//PreviewImage.h" #include "../writer/HDF5Objects.h" #include "../common/RawToConvertedGeometry.h" TEST_CASE("JPEGTest","[JPEG]") { size_t width = 1024; size_t height = 1024; std::vector val(width * height); for (int i = 0; i < width * height; i++) { size_t x = i % width; if (x < 512) { val[i].r = 234; val[i].g = 0; val[i].b = 0; } else { val[i].r = 0; val[i].g = 0; val[i].b = 255; } } std::string s; CompressedImage image(val, width, height); REQUIRE_NOTHROW(s = WriteJPEGToMem(image)); std::ofstream f("x.jpeg", std::ios::binary); f.write(s.data(), s.size()); }