diff --git a/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js b/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js index c28758b2036..82c1c7a23e5 100644 --- a/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js +++ b/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js @@ -29,7 +29,10 @@ const staticOffsetModel = { Line: { factor: 1, offset: -1 }, Point: { factor: 0, offset: -2 }, }; -const staticOffsetAPI = {}; +const noOp = () => undefined; +const staticOffsetAPI = { + modified: noOp, +}; addCoincidentTopologyMethods( staticOffsetAPI, diff --git a/Sources/Rendering/Core/Mapper/test/testCoincidentTopologyHelper.js b/Sources/Rendering/Core/Mapper/test/testCoincidentTopologyHelper.js new file mode 100644 index 00000000000..aafc8576a42 --- /dev/null +++ b/Sources/Rendering/Core/Mapper/test/testCoincidentTopologyHelper.js @@ -0,0 +1,38 @@ +import test from 'tape'; +import testUtils from 'vtk.js/Sources/Testing/testUtils'; + +import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper'; + +test('Test calling CoincidentTopologyHelper static functions', async (t) => { + const gc = testUtils.createGarbageCollector(t); + + // set back to starting/default values to avoid side effects for other tests + const startingParameters = + vtkMapper.getResolveCoincidentTopologyPolygonOffsetParameters(); + vtkMapper.setResolveCoincidentTopologyPolygonOffsetParameters({ + factor: -3, + offset: -3, + }); + vtkMapper.setResolveCoincidentTopologyPolygonOffsetParameters( + startingParameters + ); + const endingParameters = + vtkMapper.getResolveCoincidentTopologyPolygonOffsetParameters(); + t.deepEqual( + startingParameters, + endingParameters, + 'Initial PolygonOffset parameters after get and set are matching' + ); + + const startingLineParameters = + vtkMapper.getResolveCoincidentTopologyLineOffsetParameters(); + vtkMapper.setResolveCoincidentTopologyLineOffsetParameters(-3, -3); + vtkMapper.setResolveCoincidentTopologyLineOffsetParameters( + startingLineParameters + ); + + t.ok('rendering', 'CoincidentTopologyHelper functions called without error'); + + // Free memory, end the test + gc.releaseResources(); +});