예제 #1
0
        public void Test_Label_MeasureString_Returns_Positive_Number()
        {
            ScottPlot.TextLabel lbl1     = new("testing");
            ScottPlot.PixelSize lbl1Size = lbl1.Measure(Canvas);

            Assert.NotZero(lbl1Size.Width);
            Assert.NotZero(lbl1Size.Height);
        }
예제 #2
0
        public void Test_Label_MeasureString_Respects_Text_Content()
        {
            ScottPlot.TextLabel lbl1     = new("XX");
            ScottPlot.PixelSize lbl1Size = lbl1.Measure(Canvas);

            ScottPlot.TextLabel lbl2     = new("X");
            ScottPlot.PixelSize lbl2Size = lbl2.Measure(Canvas);

            Assert.Greater(lbl1Size.Width, lbl2Size.Width);
            Assert.AreEqual(lbl1Size.Height, lbl2Size.Height);
        }
예제 #3
0
        public void Test_Label_MeasureString_Respects_Font_Size()
        {
            ScottPlot.TextLabel lbl1     = new("testing");
            ScottPlot.PixelSize lbl1Size = lbl1.Measure(Canvas);

            ScottPlot.TextLabel lbl2     = new("testing") { FontSize = lbl1.FontSize / 2 };
            ScottPlot.PixelSize lbl2Size = lbl2.Measure(Canvas);

            Assert.Greater(lbl1Size.Width, lbl2Size.Width);
            Assert.Greater(lbl1Size.Height, lbl2Size.Height);
        }