Commit 25b33e15 authored by Eric Jiang's avatar Eric Jiang Committed by Jean-Baptiste Mardelle
Browse files

Test waveform RGB/BGR handling

parent e0f68346
#include "test_utils.hpp"
#include "scopes/colorscopes/colorconstants.h"
#include "scopes/colorscopes/vectorscopegenerator.h"
#include "scopes/colorscopes/waveformgenerator.h"
TEST_CASE("Vectorscope")
// test for a bug where pixels were assumed to be RGB which was not true on
// Windows, resulting in red and blue switched. BUG: 453149
// Multiple scopes are affected, including vectorscope and waveform
TEST_CASE("Colorscope RGB/BGR handling")
{
// create a fully red image
QImage inputImage(480, 320, QImage::Format_RGB32);
inputImage.fill(Qt::red);
VectorscopeGenerator vectorscope{};
QImage bgrInputImage = inputImage.convertToFormat(QImage::Format_BGR30);
QSize scopeSize{256, 256};
// test for a bug where pixels were assumed to be RGB which was not true on
// Windows, resulting in red and blue switched. BUG: 453149
SECTION("Vectorscope handles both RGB and BGR")
{
VectorscopeGenerator vectorscope{};
QImage rgbScope = vectorscope.calculateVectorscope(scopeSize, inputImage, 1,
VectorscopeGenerator::PaintMode::PaintMode_Green2,
VectorscopeGenerator::ColorSpace::ColorSpace_YUV,
false, 7);
QImage bgrInputImage = inputImage.convertToFormat(QImage::Format_BGR30);
QImage bgrScope = vectorscope.calculateVectorscope(scopeSize, bgrInputImage, 1,
VectorscopeGenerator::PaintMode::PaintMode_Green2,
VectorscopeGenerator::ColorSpace::ColorSpace_YUV,
......@@ -30,4 +32,17 @@ TEST_CASE("Vectorscope")
// handle different pixel formats
CHECK(rgbScope == bgrScope);
}
SECTION("Waveform handles both RGB and BGR")
{
WaveformGenerator waveform{};
QImage rgbScope = waveform.calculateWaveform(scopeSize, inputImage,
WaveformGenerator::PaintMode::PaintMode_Yellow,
false, ITURec::Rec_709, 1);
QImage bgrScope = waveform.calculateWaveform(scopeSize, bgrInputImage,
WaveformGenerator::PaintMode::PaintMode_Yellow,
false, ITURec::Rec_709, 1);
CHECK(rgbScope == bgrScope);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment