예제 #1
0
        public void TestAppend()
        {
            var list1 = new MathList();
            var atom1 = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Operator("+", false);
            var atom3 = MathAtoms.Operator("-", false);

            list1.Add(atom1);
            list1.Add(atom2);
            list1.Add(atom3);

            var list2 = new MathList();
            var atom5 = MathAtoms.Times;
            var atom6 = MathAtoms.Divide;

            list2.Add(atom5);
            list2.Add(atom6);

            Assert.Equal(3, list1.Count);
            Assert.Equal(2, list2.Count);

            list1.Append(list2);
            Assert.Equal(5, list1.Count);
            Assert.Equal(atom5, list1[3]);
            Assert.Equal(atom6, list1[4]);
        }
예제 #2
0
        public void TestAddErrors()
        {
            var list = new MathList();

            Assert.Throws <InvalidOperationException>(() => list.Add(null));
            Assert.Throws <InvalidOperationException>(() => list.Add(MathAtoms.Create(MathAtomType.Boundary, "")));
        }
예제 #3
0
        public void TestSimpleVariable()
        {
            var list = new MathList {
                MathAtoms.ForCharacter('x')
            };
            var display = _context.CreateLine(list, _font, LineStyle.Display);

            Assert.NotNull(display);
            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(int.MinValue, display.IndexInParent);
            Assert.Single(display.Displays);
            var sub0 = display.Displays[0];

            Assert.True(sub0 is TextLineDisplay <TFont, TGlyph>);
            var line = sub0 as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line.Atoms); // have to think about these; doesn't really work atm

            Assert.Equal("x", line.StringText());
            Assert.Equal(new PointF(), line.Position);
            Assert.Equal(new Range(0, 1), line.Range);
            Assert.False(line.HasScript);
            var descent = display.Descent;

            Assertions.ApproximatelyEqual(14, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(4, descent, 0.01);
            Assertions.ApproximatelyEqual(10, display.Width, 0.01);
            Assert.Equal(display.Ascent, line.Ascent);
            Assert.Equal(display.Descent, line.Descent);
            Assert.Equal(display.Width, line.Width);
        }
예제 #4
0
        public void TestCopySpace()
        {
            var space = MathAtoms.Space(3 * Structures.Space.Point);

            Assert.Equal(MathAtomType.Space, space.AtomType);

            var copy = new Space(space, false);

            CheckClone(space, copy);
            Assert.Equal(3, copy.Length);
            Assert.False(copy.IsMu);
        }
예제 #5
0
        public void TestAtomInit()
        {
            var atom = MathAtoms.Create(MathAtomType.Open, "(");

            Assert.Equal(MathAtomType.Open, atom.AtomType);
            Assert.Equal("(", atom.Nucleus);

            var atom2 = MathAtoms.Create(MathAtomType.Radical, "(");

            Assert.Equal(MathAtomType.Radical, atom2.AtomType);
            Assert.Equal("(", atom2.Nucleus);
        }
예제 #6
0
        public void TestSuperScript()
        {
            var mathList    = new MathList();
            var x           = MathAtoms.ForCharacter('x');
            var superscript = new MathList {
                MathAtoms.ForCharacter('2')
            };

            x.Superscript = superscript;
            mathList.Add(x);

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.NotNull(display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(display.IndexInParent, Range.UndefinedInt);
            Assert.Equal(2, display.Displays.Count());

            var super0 = display.Displays[0];
            var line   = super0 as TextLineDisplay <TFont, TGlyph>;

            Assert.NotNull(line);
            Assert.Single(line.Atoms);
            Assert.Equal("x", line.StringText());
            Assert.Equal(new PointF(), line.Position);
            Assert.True(line.HasScript);

            var super1 = display.Displays[1] as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(super1);
            Assert.Equal(LinePosition.Superscript, super1.LinePosition);
            var super1Position = super1.Position;

            Assertions.ApproximatePoint(10.32, 7.26, super1Position, 0.01); // may change as we implement more details?
            Assert.Equal(new Range(0, 1), super1.Range);
            Assert.False(super1.HasScript);
            Assert.Equal(0, super1.IndexInParent);
            Assert.Single(super1.Displays);

            var super10 = super1.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.NotNull(super10);
            Assert.Single(super10.Atoms);
            Assert.Equal(new PointF(), super10.Position);
            Assert.False(super10.HasScript);

            Assertions.ApproximatelyEqual(17.06, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(4, display.Descent, 0.01);
        }
예제 #7
0
        public void TestRadical()
        {
            var mathList = new MathList {
                new Radical {
                    Radicand = new MathList {
                        MathAtoms.ForCharacter('1')
                    }
                }
            };

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Single(display.Displays);

            var radical = display.Displays[0] as RadicalDisplay <TFont, TGlyph>;

            Assert.Equal(new Range(0, 1), radical.Range);
            Assert.False(radical.HasScript);
            Assert.Equal(new PointF(), radical.Position);
            Assert.NotNull(radical.Radicand);
            Assert.Null(radical.Degree);

            var display2 = radical.Radicand as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(display2);
            Assert.Equal(LinePosition.Regular, display2.LinePosition);
            Assertions.ApproximatePoint(10, 0, display2.Position, 0.01);
            Assert.Equal(new Range(0, 1), display2.Range);
            Assert.False(display2.HasScript);
            Assert.Equal(Range.UndefinedInt, display2.IndexInParent);
            Assert.Single(display2.Displays);

            var line2 = display2.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line2.Atoms);
            Assert.Equal("1", line2.StringText());
            Assert.Equal(new PointF(), line2.Position);
            Assert.Equal(new Range(0, 1), line2.Range);
            Assert.False(line2.HasScript);

            Assertions.ApproximatelyEqual(18.56, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(4, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(20, display.Width, 0.01);
        }
예제 #8
0
        public void TestCustom()
        {
            var input   = @"\lcm(a,b)";
            var builder = new MathListBuilder(input);
            var list    = builder.Build();

            Assert.Null(list);
            Assert.NotNull(builder.Error);

            MathAtoms.AddLatexSymbol("lcm", MathAtoms.Operator("lcm", false));
            var builder2 = new MathListBuilder(input);
            var list2    = builder2.Build();

            ExpandGroups(list2);
            CheckAtomTypes(list2, MathAtomType.LargeOperator, MathAtomType.Open,
                           MathAtomType.Variable, MathAtomType.Punctuation, MathAtomType.Variable,
                           MathAtomType.Close);
            var latex = MathListBuilder.MathListToString(list2);

            Assert.Equal(@"\lcm (a,b)", latex);
        }
예제 #9
0
        public void TestRaiseBox()
        {
            var mathList = new MathList {
                new Atoms.Extension.RaiseBox {
                    InnerList = new MathList {
                        MathAtoms.ForCharacter('r')
                    },
                    Raise = new Space(3 * Structures.Space.Point)
                }
            };

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Single(display.Displays);

            var display2 = display.Displays[0] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Regular, display2.LinePosition);
            Assert.Equal(new PointF(0, 3), display2.Position);
            Assert.Equal(new Range(0, 1), display2.Range);
            Assert.False(display2.HasScript);
            Assert.Equal(Range.UndefinedInt, display2.IndexInParent);
            Assert.Equal(1, display2.Displays.Count);

            var line = display2.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line.Atoms);
            Assert.Equal("r", line.StringText());
            Assert.Equal(new PointF(), line.Position);
            Assert.False(line.HasScript);

            Assertions.ApproximatelyEqual(17, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(1, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(10, display.Width, 0.01);
        }
예제 #10
0
        public void TestCopyInner()
        {
            var atom1 = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Times;
            var atom3 = MathAtoms.Divide;

            var list = MathLists.WithAtoms(atom1, atom2, atom3);

            var inner = new Inner {
                InnerList     = list,
                LeftBoundary  = MathAtoms.Create(MathAtomType.Boundary, "("),
                RightBoundary = MathAtoms.Create(MathAtomType.Boundary, ")")
            };

            Assert.Equal(MathAtomType.Inner, inner.AtomType);

            var copy = new Inner(inner, false);

            CheckClone(inner, copy);
            CheckClone(inner.InnerList, copy.InnerList);
            CheckClone(inner.LeftBoundary, copy.LeftBoundary);
            CheckClone(inner.RightBoundary, copy.RightBoundary);
        }
예제 #11
0
        public void TestScripts()
        {
            var atom = MathAtoms.Create(MathAtomType.Open, "(");

            Assert.True(atom.ScriptsAllowed);
            atom.Subscript = new MathList();
            Assert.NotNull(atom.Subscript);
            atom.Superscript = new MathList();
            Assert.NotNull(atom.Superscript);

            var atom2 = MathAtoms.Create(MathAtomType.Boundary, "(");

            Assert.False(atom2.ScriptsAllowed);
            atom2.Subscript = null;
            Assert.Null(atom2.Subscript);
            atom2.Superscript = null;
            Assert.Null(atom2.Superscript);

            var list = new MathList();

            Assert.ThrowsAny <Exception>(() => atom2.Subscript   = list);
            Assert.ThrowsAny <Exception>(() => atom2.Superscript = list);
        }
예제 #12
0
        public void TestInsert()
        {
            var list = new MathList();

            Assert.Empty(list);
            var atom = MathAtoms.Placeholder;

            list.Insert(0, atom);
            Assert.Single(list);
            Assert.Equal(atom, list[0]);
            var atom2 = MathAtoms.Operator("+", false);

            list.Insert(0, atom2);
            Assert.Equal(2, list.Count);
            Assert.Equal(atom2, list[0]);
            Assert.Equal(atom, list[1]);
            var atom3 = MathAtoms.Create(MathAtomType.Variable, "x");

            list.Insert(2, atom3);
            Assert.Equal(3, list.Count);
            Assert.Equal(atom2, list[0]);
            Assert.Equal(atom, list[1]);
            Assert.Equal(atom3, list[2]);
        }
예제 #13
0
        public void TestCopy()
        {
            var list = new MathList {
                MathAtoms.Placeholder,
                MathAtoms.Times,
                MathAtoms.Divide
            };

            var list2 = new MathList {
                MathAtoms.Divide,
                MathAtoms.Times
            };

            var open = MathAtoms.Create(MathAtomType.Open, "(");

            open.Subscript   = list;
            open.Superscript = list2;

            var clone = AtomCloner.Clone(open, false);

            CheckClone(open, clone);
            CheckClone(open.Superscript, clone.Superscript);
            CheckClone(open.Subscript, clone.Subscript);
        }
예제 #14
0
        public void TestBinomial()
        {
            var list     = new MathList();
            var fraction = new Fraction(false)
            {
                Numerator = new MathList {
                    MathAtoms.ForCharacter('1')
                },
                Denominator = new MathList {
                    MathAtoms.ForCharacter('3')
                },
                LeftDelimiter  = "(",
                RightDelimiter = ")"
            };

            list.Add(fraction);

            var display = Typesetter <TFont, TGlyph> .CreateLine(list, _font, _context, LineStyle.Display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Single(display.Displays);

            var display0 = display.Displays[0] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Regular, display0.LinePosition);
            Assert.Equal(new PointF(), display0.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display0.HasScript);
            Assert.Equal(Range.UndefinedInt, display0.IndexInParent);
            Assert.Equal(3, display0.Displays.Count);

            var glyph = display0.Displays[0] as GlyphDisplay <TFont, TGlyph>;

            Assert.Equal(new PointF(), glyph.Position);
            Assert.Equal(Range.NotFound, glyph.Range);
            Assert.False(glyph.HasScript);

            var subFraction = display0.Displays[1] as FractionDisplay <TFont, TGlyph>;

            Assert.Equal(new Range(0, 1), subFraction.Range);
            Assert.False(subFraction.HasScript);
            Assertions.ApproximatePoint(10, 0, subFraction.Position, 0.01);

            var numerator = subFraction.Numerator as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(numerator);
            Assert.Equal(LinePosition.Regular, numerator.LinePosition);
            Assertions.ApproximatePoint(10, 13.54, numerator.Position, 0.01);
            Assert.Single(numerator.Displays);
            Assert.Equal(Range.UndefinedInt, numerator.IndexInParent);
            Assert.False(numerator.HasScript);

            var subNumerator = numerator.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(subNumerator.Atoms);
            Assert.Equal("1", subNumerator.StringText());
            Assert.Equal(new PointF(), subNumerator.Position);
            Assert.Equal(new Range(0, 1), subNumerator.Range);
            Assert.False(subNumerator.HasScript);

            var denominator = subFraction.Denominator as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(denominator);
            Assert.Equal(LinePosition.Regular, denominator.LinePosition);
            Assertions.ApproximatePoint(10, -13.72, denominator.Position, 0.01);
            Assert.Equal(new Range(0, 1), denominator.Range);
            Assert.False(denominator.HasScript);
            Assert.Equal(Range.UndefinedInt, denominator.IndexInParent);
            Assert.Single(denominator.Displays);

            var subDenominator = denominator.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(subDenominator.Atoms);
            Assert.Equal("3", subDenominator.StringText());
            Assert.Equal(new PointF(), subDenominator.Position);
            Assert.Equal(new Range(0, 1), subDenominator.Range);
            Assert.False(subDenominator.HasScript);

            var subRight = display0.Displays[2] as GlyphDisplay <TFont, TGlyph>;

            Assert.False(subRight.HasScript);
            Assert.Equal(Range.NotFound, subRight.Range);
            Assertions.ApproximatePoint(20, 0, subRight.Position, 0.01);
            Assertions.ApproximatelyEqual(27.54, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(17.72, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(30, display.Width, 0.01);
        }
예제 #15
0
        public void TestAtop()
        {
            var mathList = new MathList {
                new Fraction(false)
                {
                    Numerator = new MathList {
                        MathAtoms.ForCharacter('1')
                    },
                    Denominator = new MathList {
                        MathAtoms.ForCharacter('3')
                    }
                }
            };

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Single(display.Displays);

            var fraction = display.Displays[0] as FractionDisplay <TFont, TGlyph>;

            Assert.Equal(new Range(0, 1), fraction.Range);
            Assert.False(fraction.HasScript);
            Assert.Equal(new PointF(), fraction.Position);

            var numerator = fraction.Numerator as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(numerator);
            Assert.Equal(LinePosition.Regular, numerator.LinePosition);
            Assert.False(numerator.HasScript);
            Assertions.ApproximatePoint(0, 13.54, numerator.Position, 0.01);
            Assert.Equal(new Range(0, 1), numerator.Range);
            Assert.Equal(Range.UndefinedInt, numerator.IndexInParent);
            Assert.Single(numerator.Displays);

            var subNumerator = numerator.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(subNumerator.Atoms);
            Assert.Equal("1", subNumerator.StringText());
            Assert.Equal(new PointF(), subNumerator.Position);
            Assert.Equal(new Range(0, 1), subNumerator.Range);
            Assert.False(subNumerator.HasScript);

            var denominator = fraction.Denominator as ListDisplay <TFont, TGlyph>;

            Assert.NotNull(denominator);
            Assert.Equal(LinePosition.Regular, denominator.LinePosition);
            Assertions.ApproximatePoint(0, -13.73, denominator.Position, 0.01);
            Assert.Equal(new Range(0, 1), denominator.Range);
            Assert.False(denominator.HasScript);
            Assert.Equal(Range.UndefinedInt, denominator.IndexInParent);
            Assert.Single(denominator.Displays);

            var subDenominator = denominator.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(subDenominator.Atoms);
            Assert.Equal("3", subDenominator.StringText());
            Assert.Equal(new PointF(), subDenominator.Position);
            Assert.Equal(new Range(0, 1), subDenominator.Range);
            Assert.False(subDenominator.HasScript);

            Assertions.ApproximatelyEqual(27.54, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(17.72, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(10, display.Width, 0.01);
        }
예제 #16
0
        public void TestInner()
        {
            var mathList = new MathList {
                new Inner {
                    InnerList = new MathList {
                        MathAtoms.ForCharacter('x'),
                    },
                    LeftBoundary  = MathAtoms.Create(MathAtomType.Boundary, '('),
                    RightBoundary = MathAtoms.Create(MathAtomType.Boundary, ')')
                }
            };

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Single(display.Displays);

            var display2 = display.Displays[0] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Regular, display2.LinePosition);
            Assert.Equal(new PointF(), display2.Position);
            Assert.Equal(new Range(0, 1), display2.Range);
            Assert.False(display2.HasScript);
            Assert.Equal(Range.UndefinedInt, display2.IndexInParent);
            Assert.Equal(3, display2.Displays.Count);

            var glyph = display2.Displays[0] as GlyphDisplay <TFont, TGlyph>;

            Assert.Equal(new PointF(), glyph.Position);
            Assert.Equal(Range.NotFound, glyph.Range);
            Assert.False(glyph.HasScript);

            var display3 = display2.Displays[1] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Regular, display3.LinePosition);
            Assertions.ApproximatePoint(10, 0, display3.Position, 0.01);
            Assert.Equal(new Range(0, 1), display3.Range);
            Assert.False(display3.HasScript);
            Assert.Equal(Range.UndefinedInt, display3.IndexInParent);
            Assert.Single(display3.Displays);

            var line = display3.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line.Atoms);
            Assert.Equal("x", line.StringText());
            Assert.Equal(new PointF(), line.Position);
            Assert.False(line.HasScript);

            var glyph2 = display2.Displays[2] as GlyphDisplay <TFont, TGlyph>;

            Assertions.ApproximatePoint(20, 0, glyph2.Position, 0.01);
            Assert.Equal(Range.NotFound, glyph2.Range);
            Assert.False(glyph2.HasScript);

            Assert.Equal(display.Ascent, display2.Ascent);
            Assert.Equal(display.Descent, display2.Descent);
            Assert.Equal(display.Width, display2.Width);

            Assertions.ApproximatelyEqual(14, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(4, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(30, display.Width, 0.01);
        }
예제 #17
0
        public void TestSuperSubscript()
        {
            var mathList    = new MathList();
            var x           = MathAtoms.ForCharacter('x');
            var superscript = new MathList {
                MathAtoms.ForCharacter('2')
            };
            var subscript = new MathList {
                MathAtoms.ForCharacter('1')
            };

            x.Subscript   = subscript;
            x.Superscript = superscript;
            mathList.Add(x);

            var display = Typesetter <TFont, TGlyph> .CreateLine(mathList, _font, _context, LineStyle.Display);

            Assert.NotNull(display);
            Assert.Equal(LinePosition.Regular, display.LinePosition);
            Assert.Equal(new PointF(), display.Position);
            Assert.Equal(new Range(0, 1), display.Range);
            Assert.False(display.HasScript);
            Assert.Equal(Range.UndefinedInt, display.IndexInParent);
            Assert.Equal(3, display.Displays.Count());

            var line = display.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line.Atoms);
            Assert.Equal("x", line.StringText());
            Assert.Equal(new PointF(), line.Position);
            Assert.True(line.HasScript);

            var display2 = display.Displays[1] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Superscript, display2.LinePosition);
            Assertions.ApproximatePoint(10.32, 9.68, display2.Position, 0.01);
            Assert.Equal(new Range(0, 1), display2.Range);
            Assert.False(display2.HasScript);
            Assert.Equal(0, display2.IndexInParent);
            Assert.Single(display2.Displays);

            var line2 = display2.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line2.Atoms);
            Assert.Equal("2", line2.StringText());
            Assert.Equal(new PointF(), line2.Position);
            Assert.False(line2.HasScript);

            var display3 = display.Displays[2] as ListDisplay <TFont, TGlyph>;

            Assert.Equal(LinePosition.Subscript, display3.LinePosition);

            // Because both subscript and superscript are present, coords are
            // different from the subscript-only case.
            Assertions.ApproximatePoint(10, -6.12, display3.Position, 0.01);
            Assert.Equal(new Range(0, 1), display3.Range);
            Assert.False(display3.HasScript);
            Assert.Equal(0, display3.IndexInParent);
            Assert.Single(display3.Displays);

            var line3 = display3.Displays[0] as TextLineDisplay <TFont, TGlyph>;

            Assert.Single(line3.Atoms);
            Assert.Equal("1", line3.StringText());
            Assert.Equal(new PointF(), line3.Position);
            Assert.False(line3.HasScript);

            Assertions.ApproximatelyEqual(19.48, display.Ascent, 0.01);
            Assertions.ApproximatelyEqual(8.92, display.Descent, 0.01);
            Assertions.ApproximatelyEqual(17.32, display.Width, 0.01);
            Assertions.ApproximatelyEqual(display.Ascent, display2.Position.Y + line2.Ascent, 0.01);
            Assertions.ApproximatelyEqual(display.Descent, line3.Descent - display3.Position.Y, 0.01);
        }