From 0dfc8a8a37c5972ae25a3580f6c0dcaaa8c7df61 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Tue, 18 Nov 2025 18:11:37 -0600 Subject: [PATCH] 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. --- examples/domain-1d-lut.cube | 6 +++--- examples/domain-3d-lut.cube | 14 +++++++------- tests/ColorMap.cpp | 23 +++++++++++++++-------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/examples/domain-1d-lut.cube b/examples/domain-1d-lut.cube index 71b98b71..cfa2afc6 100644 --- a/examples/domain-1d-lut.cube +++ b/examples/domain-1d-lut.cube @@ -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 diff --git a/examples/domain-3d-lut.cube b/examples/domain-3d-lut.cube index 818c5835..9720e03f 100644 --- a/examples/domain-3d-lut.cube +++ b/examples/domain-3d-lut.cube @@ -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 diff --git a/tests/ColorMap.cpp b/tests/ColorMap.cpp index a69dfbe4..7fed1679 100644 --- a/tests/ColorMap.cpp +++ b/tests/ColorMap.cpp @@ -39,6 +39,17 @@ static std::shared_ptr makeTestFrame() return frame; } +// Frame that keeps the example pixel in the bright range used by the domain tests +static std::shared_ptr 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->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]")