public void ShouldChangeCurrentTool(eTool toolType) { //Given PaintingMediator paint = new PaintingMediator(); //When paint.ChangeToolTo(toolType); //Then Tool expectedTool = new Tool(toolType); Assert.AreEqual(expectedTool, paint.GetCurrentTool()); }
public MainWindow() { InitializeComponent(); _paint = new PaintingMediator(); CanvasBackService canvasService = new CanvasBackService(); Canvas canvasNode = this.canvasNode; canvasNode.MouseDown += _paint.OnCanvasMouseDown; canvasNode.MouseMove += _paint.OnCanvasMouseMove; canvasNode.MouseUp += _paint.OnCanvasMouseUp; canvasService.SetCanvas(canvasNode); _paint.SetCanvasService(canvasService); _paint.ChangeToolTo(eTool.Pencil); _paint.ChangeActiveColor("#000000"); SetButtonAsActive(pencil); }
public void ShouldDrawWithCurrentToolOnCanvas(eTool currentTool) { //Given PaintingMediator paint = new PaintingMediator(); CanvasBackService canvasService = new CanvasBackService(); Canvas canvasNode = new Canvas(); canvasNode.MouseDown += paint.OnCanvasMouseDown; canvasService.SetCanvas(canvasNode); paint.SetCanvasService(canvasService); paint.ChangeToolTo(currentTool); int numberOfElementsOnCanvas = canvasNode.Children.Count; //When ImitateMouseDownOn(canvasNode); //Then Assert.AreNotEqual(numberOfElementsOnCanvas, canvasNode.Children.Count); }
public void ShouldFloodFillConsistentColorSpace() { //Given PaintingMediator paint = new PaintingMediator(); CanvasBackService canvasService = new CanvasBackService(); Canvas canvasNode = new Canvas(); canvasService.SetCanvas(canvasNode); paint.SetCanvasService(canvasService); canvasNode.MouseDown += paint.OnCanvasMouseDown; paint.ChangeToolTo(eTool.Line); paint.ChangeActiveColor("#ffffff"); ImitateMouseDownOn(canvasNode); paint.ChangeToolTo(eTool.Fill); paint.ChangeActiveColor("#000000"); Line drawedLine = canvasNode.Children[0] as Line; drawedLine.MouseDown += paint.OnCanvasChildClick; //When ImitateMouseDownOn(drawedLine); //Then Assert.AreEqual(paint.GetActiveColor().ToString(),drawedLine.Stroke.ToString()); }