Skip to content

Commit

Permalink
fix: TextBox move should not re-calculate stats (#223)
Browse files Browse the repository at this point in the history
* fix: TexBox move should not re-calculate stats

* fix: Broken tests

* fix: RenderingEngineUID should not be shared between tests
  • Loading branch information
sedghi authored and swederik committed Mar 21, 2022
1 parent 2fb251d commit 85fe884
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {

//const { createFloat32SharedArray } = Utilities

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const scene2UID = 'SCENE_2'
Expand Down
209 changes: 0 additions & 209 deletions packages/cornerstone-render/test/renderingCore_debug_test.js

This file was deleted.

5 changes: 2 additions & 3 deletions packages/cornerstone-render/test/renderingCore_stack_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ const {

const { calibratedPixelSpacingMetadataProvider } = Utilities

const { fakeImageLoader, fakeMetaDataProvider, compareImages, downloadURI } =
const { fakeImageLoader, fakeMetaDataProvider, compareImages } =
Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
const viewportUID2 = 'VIEWPORT2'

const AXIAL = 'AXIAL'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const {
const { fakeMetaDataProvider, compareImages, fakeVolumeLoader } =
Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,12 @@ export default class BidirectionalTool extends BaseAnnotationTool {
point[1] += worldPosDelta[1]
point[2] += worldPosDelta[2]
})
data.invalidated = true
} else {
this._mouseDragModifyHandle(evt)
data.invalidated = true
}

data.invalidated = true
triggerAnnotationRenderForViewportUIDs(
renderingEngine,
viewportUIDsToRender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,12 @@ export default class EllipticalRoiTool extends BaseAnnotationTool {
point[1] += worldPosDelta[1]
point[2] += worldPosDelta[2]
})
data.invalidated = true
} else {
this._dragHandle(evt)
data.invalidated = true
}

data.invalidated = true

const enabledElement = getEnabledElement(element)
const { renderingEngine } = enabledElement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,16 @@ class LengthTool extends BaseAnnotationTool {
point[1] += worldPosDelta[1]
point[2] += worldPosDelta[2]
})
data.invalidated = true
} else {
// Moving handle
const { currentPoints } = eventData
const worldPos = currentPoints.world

data.handles.points[handleIndex] = [...worldPos]
data.invalidated = true
}

data.invalidated = true
this.editData.hasMoved = true

const enabledElement = getEnabledElement(element)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ export default class RectangleRoiTool extends BaseAnnotationTool {
point[1] += worldPosDelta[1]
point[2] += worldPosDelta[2]
})
data.invalidated = true
} else {
// Moving handle.
const { currentPoints } = eventData
Expand Down Expand Up @@ -475,9 +476,9 @@ export default class RectangleRoiTool extends BaseAnnotationTool {

break
}
data.invalidated = true
}

data.invalidated = true
this.editData.hasMoved = true

const enabledElement = getEnabledElement(element)
Expand Down
2 changes: 1 addition & 1 deletion packages/cornerstone-tools/test/BidirectionalTool_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
createNormalizedMouseEvent,
} = Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
6 changes: 3 additions & 3 deletions packages/cornerstone-tools/test/CrosshairsTool_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const {
const { fakeMetaDataProvider, fakeVolumeLoader, createNormalizedMouseEvent } =
Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID1 = 'VIEWPORT1'
Expand Down Expand Up @@ -511,8 +511,8 @@ describe('Cornerstone Tools: ', () => {
})
})
done()
}, 1000)
}, 1000)
}, 500)
}, 500)
}

canvas1.addEventListener(EVENTS.IMAGE_RENDERED, eventHandler)
Expand Down
2 changes: 1 addition & 1 deletion packages/cornerstone-tools/test/EllipseROI_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
createNormalizedMouseEvent,
} = Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
2 changes: 1 addition & 1 deletion packages/cornerstone-tools/test/LengthTool_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
createNormalizedMouseEvent,
} = Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
2 changes: 1 addition & 1 deletion packages/cornerstone-tools/test/ProbeTool_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
createNormalizedMouseEvent,
} = Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
2 changes: 1 addition & 1 deletion packages/cornerstone-tools/test/RectangleROI_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
createNormalizedMouseEvent,
} = Utilities.testUtils

const renderingEngineUID = 'RENDERING_ENGINE_UID'
const renderingEngineUID = Utilities.uuidv4()

const scene1UID = 'SCENE_1'
const viewportUID = 'VIEWPORT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ describe('Cornerstone Tools Scroll Wheel: ', () => {
attachEventHandler()

// Note: I don't know why I need this setTimeOut here
setTimeout(() => {
canvas.dispatchEvent(evt)
})
canvas.dispatchEvent(evt)
}

const attachEventHandler = () => {
Expand Down Expand Up @@ -218,9 +216,7 @@ describe('Cornerstone Tools Scroll Wheel: ', () => {
})

attachEventHandler()
setTimeout(() => {
canvas.dispatchEvent(evt)
})
canvas.dispatchEvent(evt)
}

const attachEventHandler = () => {
Expand Down
Loading

0 comments on commit 85fe884

Please sign in to comment.