Skip to content

Commit dcf90b4

Browse files
PaulHaxfinetjul
authored andcommitted
test: re-enable four tests skipped during past tooling migrations
Four tests were skipped over the years, each during a test-harness or build migration rather than for a genuine feature failure. A skipped test is green in CI, so none produced a signal and all silently rotted. Re-enable them. testLabelmapOutlineManyRenderer Skipped 2022-03-11 in commit 50ace42 (PR #2308, "Make test harnesses the same for release and PRs"); the commit gave no reason. While skipped the code rotted: createLabelPipeline called backgroundImageData.getDimensionsByReference(), which is not a function on vtkImageData. Use getDimensions(). Passes against the existing baseline, so no baseline change. testEdgeVisibility Skipped 2021-11-12 in commit 13b9be1 (PR #2161, "Update test framework"), flagged in a pixelmatch-threshold-0 audit (PR #2098, closed unmerged) as a "bad image test" (issue #2104). The 2017 baseline predates commit a8873e5 (2021-02-19, "feat(vtkopenglpolydatamapper): add support for backface property"), which changed the edge draw path from lit (ambient = getAmbient(), diffuse = getDiffuse()) to flat (ambient = 1.0, diffuse = 0.0): edges now render at the full configured edge color, the intended behavior. The render has been stable since at least 2021-06 (a steady 1.80% from the 2017 baseline at 2021-06, 2022, and 2024). Refresh the baseline; the tolerance is unchanged at 1% (chromium ~0%, firefox passes). testAverageIntensityProjection Skipped 2021-11-12 in commit 13b9be1 (PR #2161), tracked by issue #2102. It did not drift or regress. Before the 2021 test-framework work the test was effectively a no-op: the old compareImages passed its threshold argument (here 1.5) straight to pixelmatch, whose threshold range is 0 to 1, so pixelmatch reported zero differing pixels for any image and the test passed vacuously. The pixelmatch-threshold-0 audit (PR #2098, closed unmerged) exposed the real comparison, and the test then "failed" because its baseline had never actually been checked. The committed baseline is the original 2019 image from aae2f55; commit 8a50448 only renamed it OpenGL/ to Core/ (100% rename). It is a near-blank volume the real render never matched. Rendering against old Sources shows a stable, correct head volume back to 2021-06 (~1.5% from the corrected baseline, ~0% on current master). Replace the baseline with the actual render (chromium ~0%, firefox 0.01%, within the 1% tolerance) and re-enable the test. Also release resources via .finally; gc.releaseResources had been passed as an unused 5th argument to compareImages. testSetTable Skipped 2026-05-21 by the Vite/Vitest migration (c0d9887), which rewrote test.onlyIfWebGL(...) as it.skip(...) instead of the it.skipIf(__VTK_TEST_NO_WEBGL__)(...) form used for every other migrated WebGL test, silently disabling a passing test. Restore the intended WebGL-conditional skip. Closes #2102
1 parent 3659cda commit dcf90b4

6 files changed

Lines changed: 247 additions & 239 deletions

File tree

Sources/Common/Core/LookupTable/test/testSetTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import vtkPolyData from 'vtk.js/Sources/Common/DataModel/PolyData';
1212

1313
import baseline from './testSetTable.png';
1414

15-
it.skip('Test LookupTable setTable', () => {
15+
it.skipIf(__VTK_TEST_NO_WEBGL__)('Test LookupTable setTable', () => {
1616
const gc = testUtils.createGarbageCollector();
1717
expect('rendering', 'vtkLookupTable TestSetTable').toBeTruthy();
1818
// testUtils.keepDOM();

Sources/Rendering/Core/Mapper/test/testEdgeVisibility.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';
1010

1111
import baseline from './testEdgeVisibility.png';
1212

13-
it.skip('Test Edge Visibility', () => {
13+
it.skipIf(__VTK_TEST_NO_WEBGL__)('Test Edge Visibility', () => {
1414
const gc = testUtils.createGarbageCollector();
1515
expect('rendering', 'vtkMapper EdgeVisibility').toBeTruthy();
1616

@@ -50,7 +50,7 @@ it.skip('Test Edge Visibility', () => {
5050
testUtils.compareImages(
5151
image,
5252
[baseline],
53-
'Rendering/Core/Mapper/testEdgeVisibility.js',
53+
'Rendering/Core/Mapper/testEdgeVisibility',
5454
1
5555
)
5656
)
7.97 KB
Loading

Sources/Rendering/Core/VolumeMapper/test/testAverageIntensityProjection.js

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,87 +14,92 @@ import Constants from 'vtk.js/Sources/Rendering/Core/VolumeMapper/Constants';
1414

1515
import baseline from './testAverageIntensityProjection.png';
1616

17-
it.skip('Test Average Intensity Projection Volume Rendering', async () => {
18-
const gc = testUtils.createGarbageCollector();
19-
expect('rendering', 'vtkVolumeMapper AverageIP').toBeTruthy();
20-
// testUtils.keepDOM();
21-
22-
// Create some control UI
23-
const container = document.querySelector('body');
24-
const renderWindowContainer = gc.registerDOMElement(
25-
document.createElement('div')
26-
);
27-
container.appendChild(renderWindowContainer);
28-
29-
// create what we will view
30-
const renderWindow = gc.registerResource(vtkRenderWindow.newInstance());
31-
const renderer = gc.registerResource(vtkRenderer.newInstance());
32-
renderWindow.addRenderer(renderer);
33-
renderer.setBackground(0.32, 0.34, 0.43);
34-
35-
const actor = gc.registerResource(vtkVolume.newInstance());
36-
37-
const mapper = gc.registerResource(vtkVolumeMapper.newInstance());
38-
mapper.setSampleDistance(0.7);
39-
mapper.setBlendMode(Constants.BlendMode.AVERAGE_INTENSITY_BLEND);
40-
41-
actor.setMapper(mapper);
42-
43-
const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });
44-
45-
// create color and opacity transfer functions
46-
const ctfun = vtkColorTransferFunction.newInstance();
47-
ctfun.addRGBPoint(-3024, 0, 0, 0);
48-
ctfun.addRGBPoint(-637.62, 1, 1, 1);
49-
ctfun.addRGBPoint(700, 1, 1, 1);
50-
ctfun.addRGBPoint(3071, 1, 1, 1);
51-
ctfun.setMappingRange(500, 3000);
52-
53-
const ofun = vtkPiecewiseFunction.newInstance();
54-
ofun.addPoint(-3024, 0);
55-
ofun.addPoint(-637.62, 0);
56-
ofun.addPoint(700, 0.5);
57-
ofun.addPoint(3071, 0.9);
58-
59-
actor.getProperty().setRGBTransferFunction(0, ctfun);
60-
actor.getProperty().setScalarOpacity(0, ofun);
61-
actor.getProperty().setScalarOpacityUnitDistance(0, 4.5);
62-
actor.getProperty().setInterpolationTypeToFastLinear();
63-
64-
mapper.setInputConnection(reader.getOutputPort());
65-
66-
// now create something to view it
67-
const glwindow = gc.registerResource(renderWindow.newAPISpecificView());
68-
glwindow.setContainer(renderWindowContainer);
69-
renderWindow.addView(glwindow);
70-
glwindow.setSize(400, 400);
71-
72-
// Interactor
73-
const interactor = vtkRenderWindowInteractor.newInstance();
74-
interactor.setStillUpdateRate(0.01);
75-
interactor.setView(glwindow);
76-
interactor.initialize();
77-
interactor.bindEvents(renderWindowContainer);
78-
79-
await reader.setUrl(`${__BASE_PATH__}/Data/volume/headsq.vti`);
80-
await reader.loadData();
81-
82-
renderer.addVolume(actor);
83-
renderer.resetCamera();
84-
85-
const promise = glwindow.captureNextImage().then((image) =>
86-
testUtils.compareImages(
87-
image,
88-
[baseline],
89-
'Rendering/Core/VolumeMapper/testAverageIntensityProjection',
90-
{
91-
// be stricter here
92-
pixelThreshold: 0.01,
93-
mismatchTolerance: 1.0,
94-
},
95-
gc.releaseResources
96-
)
97-
);
98-
renderWindow.render();
99-
return promise;
100-
});
17+
it.skipIf(__VTK_TEST_NO_WEBGL__)(
18+
'Test Average Intensity Projection Volume Rendering',
19+
async () => {
20+
const gc = testUtils.createGarbageCollector();
21+
expect('rendering', 'vtkVolumeMapper AverageIP').toBeTruthy();
22+
// testUtils.keepDOM();
23+
24+
// Create some control UI
25+
const container = document.querySelector('body');
26+
const renderWindowContainer = gc.registerDOMElement(
27+
document.createElement('div')
28+
);
29+
container.appendChild(renderWindowContainer);
30+
31+
// create what we will view
32+
const renderWindow = gc.registerResource(vtkRenderWindow.newInstance());
33+
const renderer = gc.registerResource(vtkRenderer.newInstance());
34+
renderWindow.addRenderer(renderer);
35+
renderer.setBackground(0.32, 0.34, 0.43);
36+
37+
const actor = gc.registerResource(vtkVolume.newInstance());
38+
39+
const mapper = gc.registerResource(vtkVolumeMapper.newInstance());
40+
mapper.setSampleDistance(0.7);
41+
mapper.setBlendMode(Constants.BlendMode.AVERAGE_INTENSITY_BLEND);
42+
43+
actor.setMapper(mapper);
44+
45+
const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });
46+
47+
// create color and opacity transfer functions
48+
const ctfun = vtkColorTransferFunction.newInstance();
49+
ctfun.addRGBPoint(-3024, 0, 0, 0);
50+
ctfun.addRGBPoint(-637.62, 1, 1, 1);
51+
ctfun.addRGBPoint(700, 1, 1, 1);
52+
ctfun.addRGBPoint(3071, 1, 1, 1);
53+
ctfun.setMappingRange(500, 3000);
54+
55+
const ofun = vtkPiecewiseFunction.newInstance();
56+
ofun.addPoint(-3024, 0);
57+
ofun.addPoint(-637.62, 0);
58+
ofun.addPoint(700, 0.5);
59+
ofun.addPoint(3071, 0.9);
60+
61+
actor.getProperty().setRGBTransferFunction(0, ctfun);
62+
actor.getProperty().setScalarOpacity(0, ofun);
63+
actor.getProperty().setScalarOpacityUnitDistance(0, 4.5);
64+
actor.getProperty().setInterpolationTypeToFastLinear();
65+
66+
mapper.setInputConnection(reader.getOutputPort());
67+
68+
// now create something to view it
69+
const glwindow = gc.registerResource(renderWindow.newAPISpecificView());
70+
glwindow.setContainer(renderWindowContainer);
71+
renderWindow.addView(glwindow);
72+
glwindow.setSize(400, 400);
73+
74+
// Interactor
75+
const interactor = vtkRenderWindowInteractor.newInstance();
76+
interactor.setStillUpdateRate(0.01);
77+
interactor.setView(glwindow);
78+
interactor.initialize();
79+
interactor.bindEvents(renderWindowContainer);
80+
81+
await reader.setUrl(`${__BASE_PATH__}/Data/volume/headsq.vti`);
82+
await reader.loadData();
83+
84+
renderer.addVolume(actor);
85+
renderer.resetCamera();
86+
87+
const promise = glwindow
88+
.captureNextImage()
89+
.then((image) =>
90+
testUtils.compareImages(
91+
image,
92+
[baseline],
93+
'Rendering/Core/VolumeMapper/testAverageIntensityProjection',
94+
{
95+
// be stricter here
96+
pixelThreshold: 0.01,
97+
mismatchTolerance: 1.0,
98+
}
99+
)
100+
)
101+
.finally(gc.releaseResources);
102+
renderWindow.render();
103+
return promise;
104+
}
105+
);
12.2 KB
Loading

0 commit comments

Comments
 (0)