Updating 1D and 3D unit tests for Color Map to use a more obvious cube color map, with 1D = green and blue, and 3D = red and blue.

This commit is contained in:
Jonathan Thomas
2025-11-18 18:11:37 -06:00
parent e25763d089
commit 0dfc8a8a37
3 changed files with 25 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
TITLE "Domain 1D LUT"
DOMAIN_MIN 0.0 0.0 0.0
DOMAIN_MAX 2.0 2.0 2.0
DOMAIN_MAX 0.1 0.1 0.1
LUT_1D_SIZE 2
0.0 0.0 0.0
1.0 1.0 1.0
0.0 1.0 0.0
0.0 0.0 1.0

View File

@@ -1,12 +1,12 @@
TITLE "Domain 3D LUT"
DOMAIN_MIN 0.0 0.0 0.0
DOMAIN_MAX 2.0 2.0 2.0
DOMAIN_MAX 0.1 0.1 0.1
LUT_3D_SIZE 2
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
0.0 1.0 1.0
1.0 1.0 1.0

View File

@@ -39,6 +39,17 @@ static std::shared_ptr<Frame> makeTestFrame()
return frame;
}
// Frame that keeps the example pixel in the bright range used by the domain tests
static std::shared_ptr<Frame> makeBrightTestFrame()
{
QImage img(2, 2, QImage::Format_ARGB32);
img.fill(QColor(50,100,150,255));
img.setPixelColor(0,0, QColor(230,230,230,255));
auto frame = std::make_shared<Frame>();
*frame->GetImage() = img;
return frame;
}
// Helper to construct the LUT-path from TEST_MEDIA_PATH
static std::string lutPath()
{
@@ -234,12 +245,10 @@ TEST_CASE("1D LUT obeys DOMAIN_MIN and DOMAIN_MAX", "[effect][colormap][lut][dom
Keyframe(1.0)
);
auto out = effect.GetFrame(makeTestFrame(), 0);
auto out = effect.GetFrame(makeBrightTestFrame(), 0);
QColor after = out->GetImage()->pixelColor(0,0);
CHECK(after.red() == 5);
CHECK(after.green() == 10);
CHECK(after.blue() == 15);
CHECK(after == QColor(255,0,0,255));
}
TEST_CASE("3D LUT obeys DOMAIN_MIN and DOMAIN_MAX", "[effect][colormap][lut][domain]")
@@ -252,12 +261,10 @@ TEST_CASE("3D LUT obeys DOMAIN_MIN and DOMAIN_MAX", "[effect][colormap][lut][dom
Keyframe(1.0)
);
auto out = effect.GetFrame(makeTestFrame(), 0);
auto out = effect.GetFrame(makeBrightTestFrame(), 0);
QColor after = out->GetImage()->pixelColor(0,0);
CHECK(after.red() == 5);
CHECK(after.green() == 10);
CHECK(after.blue() == 15);
CHECK(after == QColor(255,0,0,255));
}
TEST_CASE("Disabling red channel produces different result than full-intensity", "[effect][colormap][lut]")