public void TestProcessMessage() { try { Assert.IsNotNull(SynchronizationContext.Current, "SynchronizationContext.Current"); DicomFile file = new DicomFile("TileEntityHandlerTest.dcm"); DicomAttributeCollection dataSet = file.DataSet; SetupSecondaryCapture(dataSet); file.Save(); ImageViewerComponent viewer = new ImageViewerComponent(); viewer.Start(); viewer.LoadImages(new[] { "TileEntityHandlerTest.dcm" }); ManualResetEvent signal = new ManualResetEvent(false); viewer.EventBroker.LayoutManagerCompleted += (s, e) => signal.Set(); viewer.Layout(); Console.WriteLine("Waiting for layout to complete"); if (!signal.WaitOne(20000)) { Assert.Fail("Abort: something is not working properly."); } Console.WriteLine("Layout completed"); Assert.IsNotNull(viewer.PhysicalWorkspace); Assert.IsNotNull(viewer.PhysicalWorkspace.ImageBoxes[0]); Assert.IsNotNull(viewer.PhysicalWorkspace.ImageBoxes[0].Tiles[0]); Tile tile = viewer.PhysicalWorkspace.ImageBoxes[0].Tiles[0] as Tile; Assert.IsNotNull(tile.PresentationImage); MockApplicationContext context = new MockApplicationContext(); TileEntityHandler handler = new TileEntityHandler { ApplicationContext = context }; handler.SetModelObject(tile); ChangeClientRectangle(context, handler, 0, 0, 512, 512, "Case: Size is even"); ChangeClientRectangle(context, handler, 0, 0, 311, 311, "Case: Size is odd"); ChangeClientRectangle(context, handler, 10, 10, 300, 301, "Case: Left,Top are positive"); ChangeClientRectangle(context, handler, -10, -10, 512, 512, "Case: Left,Top are negative"); } finally { File.Delete("TileEntityHandlerTest.dcm"); } }
public void TestProcessMessage() { try { Assert.IsNotNull(SynchronizationContext.Current, "SynchronizationContext.Current"); DicomFile file = new DicomFile("TileEntityHandlerTest.dcm"); DicomAttributeCollection dataSet = file.DataSet; SetupSecondaryCapture(dataSet); file.Save(); ImageViewerComponent viewer = new ImageViewerComponent(); viewer.Start(); viewer.LoadImages(new[] { "TileEntityHandlerTest.dcm" }); ManualResetEvent signal = new ManualResetEvent(false); viewer.EventBroker.LayoutManagerCompleted += (s, e) => signal.Set(); viewer.Layout(); Console.WriteLine("Waiting for layout to complete"); if (!signal.WaitOne(20000)) Assert.Fail("Abort: something is not working properly."); Console.WriteLine("Layout completed"); Assert.IsNotNull(viewer.PhysicalWorkspace); Assert.IsNotNull(viewer.PhysicalWorkspace.ImageBoxes[0]); Assert.IsNotNull(viewer.PhysicalWorkspace.ImageBoxes[0].Tiles[0]); Tile tile = viewer.PhysicalWorkspace.ImageBoxes[0].Tiles[0] as Tile; Assert.IsNotNull(tile.PresentationImage); MockApplicationContext context = new MockApplicationContext(); TileEntityHandler handler = new TileEntityHandler { ApplicationContext = context }; handler.SetModelObject(tile); ChangeClientRectangle(context, handler, 0, 0, 512, 512, "Case: Size is even"); ChangeClientRectangle(context, handler, 0, 0, 311, 311, "Case: Size is odd"); ChangeClientRectangle(context, handler, 10, 10, 300, 301, "Case: Left,Top are positive"); ChangeClientRectangle(context, handler, -10, -10, 512, 512, "Case: Left,Top are negative"); } finally { File.Delete("TileEntityHandlerTest.dcm"); } }