示例#1
0
        public void DrawTest()
        {
            // arrange
            string specification = @"
⬇10
E10R80E10
78×E10RE78RE10
E10R80E10
⬇10
";

            this.ExpectedImage = TestImage.Create(100, 100, Color.Black, specification);

            var @event = new SpectralEvent()
            {
                EventEndSeconds    = 9,
                EventStartSeconds  = 1,
                HighFrequencyHertz = 900,
                LowFrequencyHertz  = 100,
            };
            var options = new EventRenderingOptions(new UnitConverters(0, 10, 1000, 100, 100));

            // act

            this.ActualImage.Mutate(x => @event.Draw(x, options));

            // assert
            this.AssertImagesEqual();
        }
示例#2
0
        public void DrawTest()
        {
            // arrange
            string specification = @"
⬇10
E10R80E10
78×E10RE78RE10
E10R80E10
⬇10
";
            var    expected      = TestImage.Create(100, 100, Color.Black, specification);

            var pen    = new Pen(Color.Red, 1f);
            var actual = Drawing.NewImage(100, 100, Color.Black);

            // act
            actual.Mutate(x =>
            {
                //var border = options.Converters.GetPixelRectangle(@event);
                var border = new RectangleF(10, 10, 79, 79);

                // the following two should be equivalent
                //x.NoAA().DrawRectangle(pen, border);
                border.Offset(Drawing.NoAA.Bug28Offset);
                x.Draw(Drawing.NoAntiAlias, pen, border);
            });

            // assert - this should pass without the delta if the bug was fixed
            Assert.That.ImageMatches(expected, actual, MissingCornerDelta);

            // add smoke test - this should fail if bug fixed
            // if there were no bug the expected pixel color is red
            Assert.AreEqual(
                new Rgb24(0, 0, 0),
                actual[89, 89]);
        }