Example #1
0
        public void TestCopyUnderline()
        {
            var atom1 = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Times;
            var atom3 = MathAtoms.Divide;

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

            var under = new Underline();

            Assert.Equal(MathAtomType.Underline, under.AtomType);
            under.InnerList = list;

            var copy = new Underline(under, false);

            CheckClone(copy, under);
            CheckClone(copy.InnerList, under.InnerList);
        }
Example #2
0
        public void TestCopyAccent()
        {
            var atom1 = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Times;
            var atom3 = MathAtoms.Divide;

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

            var accent = new Accent("^");

            Assert.Equal(MathAtomType.Accent, accent.AtomType);
            accent.InnerList = list;

            var copy = new Accent(accent, false);

            CheckClone(copy, accent);
            CheckClone(copy.InnerList, accent.InnerList);
        }
Example #3
0
        public void TestCopyRadical()
        {
            var atom  = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Times;
            var atom3 = MathAtoms.Divide;

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

            var radical = new Radical {
                Radicand = list,
                Degree   = list2
            };

            var copy = new Radical(radical, false);

            CheckClone(copy, radical);
            CheckClone(copy.Radicand, radical.Radicand);
            CheckClone(copy.Degree, radical.Degree);
        }
Example #4
0
        public void TestCreateMathTable()
        {
            var table = new Table();

            Assert.Equal(MathAtomType.Table, table.AtomType);

            var atom1 = MathAtoms.Placeholder;
            var atom2 = MathAtoms.Times;
            var atom3 = MathAtoms.Divide;

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

            table.SetCell(list, 3, 2);
            table.SetCell(list2, 1, 0);

            table.SetAlignment(ColumnAlignment.Left, 2);
            table.SetAlignment(ColumnAlignment.Right, 1);

            Assert.Equal(4, table.Cells.Count);
            Assert.Empty(table.Cells[0]);
            Assert.Single(table.Cells[1]);
            Assert.Empty(table.Cells[2]);
            Assert.Equal(3, table.Cells[3].Count);

            Assert.Equal(2, table.Cells[1][0].Atoms.Count);
            Assert.Equal(list2, table.Cells[1][0]);
            Assert.Empty(table.Cells[3][0].Atoms);
            Assert.Empty(table.Cells[3][1].Atoms);

            Assert.Equal(list, table.Cells[3][2]);

            Assert.Equal(4, table.NRows);
            Assert.Equal(3, table.NColumns);

            Assert.Equal(3, table.Alignments.Count);
            Assert.Equal(ColumnAlignment.Center, table.Alignments[0]);
            Assert.Equal(ColumnAlignment.Right, table.Alignments[1]);
            Assert.Equal(ColumnAlignment.Left, table.Alignments[2]);
        }
Example #5
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);
        }