public MFTestResults Brush_DerviedBrushTest10() { MFTestResults testResult = MFTestResults.Pass; Point pt = new Point(3 * _width / 4, 3 * _height / 4); if (ClearingPanel() != MFTestResults.Pass) { return(MFTestResults.Fail); } try { _brush = new SolidColorBrush(Colors.Red); Log.Comment("Drawing Rectangle : w = " + pt.x.ToString() + ", h = " + pt.y.ToString()); Log.Comment("and filling with Red SolidColorBrush"); Master_Media._panel.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(DrawRectangle), pt); autoEvent.WaitOne(); Log.Comment("Initializing 40 Random Points that are inside the rectangle"); Point[] chkPoints = GetRandomPoints_InRectangle(40, pt.x, pt.y, midX, midY); Log.Comment("Verifying the pixel colors inside the rectangle are Red"); if (VerifyingPixelColor(chkPoints, Colors.Red) != MFTestResults.Pass) { Log.Comment("Failure : Rectangle not filled with SolidColorBrush"); testResult = MFTestResults.Fail; } Log.Comment("Changing the Brush to a new BlueBrush, drawing and verifying"); _brush = new BlueBrush(); Master_Media._panel.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(DrawRectangle), pt); autoEvent.WaitOne(); Log.Comment("Verifying the pixel colors inside the rectangle are Blue"); if (VerifyingPixelColor(chkPoints, Colors.Blue) != MFTestResults.Pass) { Log.Comment("Failure : Rectangle not filled with BlueBrush"); testResult = MFTestResults.Fail; } } catch (Exception ex) { Log.Comment("Caught : " + ex.Message); return(MFTestResults.Fail); } return(testResult); }
public void DrawSplit(IWorldCoordinate pwc, IWorldCoordinate mwc, IWorldCoordinate awc, IMonster target, List <IMonster> obstacles) { //get middle impale IWorldCoordinate middlewc = PointOnLine(awc, mwc, AdjacentYards); //get left and right impales IWorldCoordinate[] lr = PointOnOrthogonal(awc, middlewc, OppositeYards); //sort obstacles by distance if (target != null) { obstacles.Add(target); } if (obstacles.Any()) { obstacles.Sort((x, y) => x.NormalizedXyDistanceToMe.CompareTo(y.NormalizedXyDistanceToMe)); } //get first target for each impale projectile float distance = (target != null) ? (float)target.NormalizedXyDistanceToMe + 2 * target.RadiusBottom : 0; IMonster tm = FirstTarget(pwc, middlewc, obstacles, distance); IMonster tlr0 = FirstTarget(pwc, lr[0], obstacles, distance); IMonster tlr1 = FirstTarget(pwc, lr[1], obstacles, distance); //draw targetline for each impale and for maintarge if (target != null) { BlueBrush.DrawLineWorld(awc, target.FloorCoordinate, 4f); } DrawTargetLine(awc, middlewc, tm, target); DrawTargetLine(awc, lr[0], tlr0, target); DrawTargetLine(awc, lr[1], tlr1, target); //draw target hitbox if (target != null && tm != null && tlr0 != null && tlr1 != null && target.AnnId == tm.AnnId && target.AnnId == tlr0.AnnId && target.AnnId == tlr1.AnnId) { GreenHitBoxDecorator.Paint(_layer, target, target.FloorCoordinate, string.Empty); } else if (target != null) { BlueHitBoxDecorator.Paint(_layer, target, target.FloorCoordinate, string.Empty); } }
public MFTestResults Brush_DerviedBrushTest10() { MFTestResults testResult = MFTestResults.Pass; Point pt = new Point(3 * _width / 4, 3 * _height / 4); if (ClearingPanel() != MFTestResults.Pass) { return MFTestResults.Fail; } try { _brush = new SolidColorBrush(Colors.Red); Log.Comment("Drawing Rectangle : w = " + pt.x.ToString() + ", h = " + pt.y.ToString()); Log.Comment("and filling with Red SolidColorBrush"); Master_Media._panel.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(DrawRectangle), pt); autoEvent.WaitOne(); Log.Comment("Initializing 40 Random Points that are inside the rectangle"); Point[] chkPoints = GetRandomPoints_InRectangle(40, pt.x, pt.y, midX, midY); Log.Comment("Verifying the pixel colors inside the rectangle are Red"); if (VerifyingPixelColor(chkPoints, Colors.Red) != MFTestResults.Pass) { Log.Comment("Failure : Rectangle not filled with SolidColorBrush"); testResult = MFTestResults.Fail; } Log.Comment("Changing the Brush to a new BlueBrush, drawing and verifying"); _brush = new BlueBrush(); Master_Media._panel.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(DrawRectangle), pt); autoEvent.WaitOne(); Log.Comment("Verifying the pixel colors inside the rectangle are Blue"); if (VerifyingPixelColor(chkPoints, Colors.Blue) != MFTestResults.Pass) { Log.Comment("Failure : Rectangle not filled with BlueBrush"); testResult = MFTestResults.Fail; } } catch (Exception ex) { Log.Comment("Caught : " + ex.Message); return MFTestResults.Fail; } return testResult; }