Tests: Use Core::Stream to write output files in LibGL tests

This commit is contained in:
Tim Schumacher 2023-01-20 00:14:19 +01:00 committed by Linus Groh
parent d7eead4f4c
commit 9eb040af32

View file

@ -7,7 +7,7 @@
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <LibCore/FileStream.h>
#include <LibCore/Stream.h>
#include <LibGL/GL/gl.h>
#include <LibGL/GLContext.h>
#include <LibGfx/Bitmap.h>
@ -36,10 +36,8 @@ static void expect_bitmap_equals_reference(Gfx::Bitmap const& bitmap, StringView
if constexpr (SAVE_OUTPUT) {
auto target_path = LexicalPath("/home/anon").append(reference_filename);
auto qoi_buffer = Gfx::QOIWriter::encode(bitmap);
auto qoi_output_stream = MUST(Core::OutputFileStream::open(target_path.string()));
auto number_of_bytes_written = qoi_output_stream.write(qoi_buffer);
qoi_output_stream.close();
EXPECT_EQ(number_of_bytes_written, qoi_buffer.size());
auto qoi_output_stream = MUST(Core::Stream::File::open(target_path.string(), Core::Stream::OpenMode::Write));
MUST(qoi_output_stream->write_entire_buffer(qoi_buffer));
}
auto reference_image_path = DeprecatedString::formatted(REFERENCE_IMAGE_DIR "/{}", reference_filename);