Ejemplo n.º 1
0
        public void Test_Annotation_ShadowColor()
        {
            var plt = new ScottPlot.Plot(400, 300);

            // start with default settings
            var pa = new ScottPlot.Plottable.Annotation()
            {
                Label = "Hello", X = 10, Y = 10
            };

            plt.Add(pa);
            var bmp1 = TestTools.GetLowQualityBitmap(plt);

            // change the plottable
            pa.ShadowColor = System.Drawing.Color.Black;
            var bmp2 = TestTools.GetLowQualityBitmap(plt);

            // measure what changed
            //TestTools.SaveFig(bmp1, "1");
            //TestTools.SaveFig(bmp2, "2");
            var before = new MeanPixel(bmp1);
            var after  = new MeanPixel(bmp2);

            Console.WriteLine($"Before: {before}");
            Console.WriteLine($"After: {after}");

            Assert.That(after.IsDarkerThan(before));
        }
Ejemplo n.º 2
0
        public void Test_Annotation_ChangingText()
        {
            var plt = new ScottPlot.Plot(400, 300);

            // start with default settings
            var pa = new ScottPlot.Plottable.Annotation()
            {
                label = "Hello", xPixel = 10, yPixel = 10, FontSize = 36
            };

            plt.Add(pa);
            var bmp1 = TestTools.GetLowQualityBitmap(plt);

            // change the plottable
            pa.label += "World";
            var bmp2 = TestTools.GetLowQualityBitmap(plt);

            // measure what changed
            //TestTools.SaveFig(bmp1, "1");
            //TestTools.SaveFig(bmp2, "2");
            var before = new MeanPixel(bmp1);
            var after  = new MeanPixel(bmp2);

            Console.WriteLine($"Before: {before}");
            Console.WriteLine($"After: {after}");

            Assert.That(after.IsDarkerThan(before));
        }