Example #1
0
        public void DeleteRow()
        {
            var rowCount = 0;
            var colCount = 0;
            var tabCols  = 0;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var editor  = new NoteEditor();
                var form    = CreateForm();
                form.Shown += (sender, args) =>
                {
                    //insert table
                    editor.HTML     = "Some Text There";
                    var body        = editor.Document.Body.DomElement as IHTMLBodyElement;
                    IHTMLTxtRange r = body.createTextRange() as IHTMLTxtRange;
                    r.findText("Text");
                    r.select();
                    var sut = new HtmlTableHelper(editor);
                    sut.TableInsert(new HtmlTableProperty(true));
                    //move inside table
                    IHTMLTxtRange r2 = body.createTextRange() as IHTMLTxtRange;
                    r2.findText("Text");
                    r2.select();
                    //modify table
                    sut.DeleteRow();

                    form.Close();
                };

                form.Controls.Add(editor);

                form.ShowDialog();

                rowCount = GetTable(editor).rows.length;
                colCount = (GetTable(editor).rows.item(0) as IHTMLTableRow).cells.length;
                tabCols  = GetTable(editor).cols;
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            Assert.AreEqual(2, rowCount);
        }
Example #2
0
        public void GetTableProperties()
        {
            var tableProperties = new HtmlTableProperty(false);

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var editor  = new NoteEditor();
                var form    = CreateForm();
                form.Shown += (sender, args) =>
                {
                    //insert table
                    var sut = new HtmlTableHelper(editor);
                    sut.TableInsert(new HtmlTableProperty(true));
                    //fill table
                    FillTable((editor.Document.GetElementsByTagName("table")[0].DomElement) as IHTMLTable);
                    //move inside table
                    var body         = editor.Document.Body.DomElement as IHTMLBodyElement;
                    IHTMLTxtRange r2 = body.createTextRange() as IHTMLTxtRange;
                    r2.findText("r2c2");
                    r2.select();
                    //modify table
                    sut.DeleteRow();
                    tableProperties = sut.GetTableProperties(GetTable(editor));

                    form.Close();
                };

                form.Controls.Add(editor);

                form.ShowDialog();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            Assert.AreEqual(2, tableProperties.TableRows);
        }
Example #3
0
        public void GetTableProperties()
        {
            var tableProperties = new HtmlTableProperty(false);

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var editor = new NoteEditor();
                var form = CreateForm();
                form.Shown += (sender, args) =>
                {
                    //insert table
                    var sut = new HtmlTableHelper(editor);
                    sut.TableInsert(new HtmlTableProperty(true));
                    //fill table
                    FillTable((editor.Document.GetElementsByTagName("table")[0].DomElement) as IHTMLTable);
                    //move inside table
                    var body = editor.Document.Body.DomElement as IHTMLBodyElement;
                    IHTMLTxtRange r2 = body.createTextRange() as IHTMLTxtRange;
                    r2.findText("r2c2");
                    r2.select();
                    //modify table
                    sut.DeleteRow();
                    tableProperties = sut.GetTableProperties(GetTable(editor));

                    form.Close();
                };

                form.Controls.Add(editor);

                form.ShowDialog();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            Assert.AreEqual(2, tableProperties.TableRows);
        }
Example #4
0
        public void DeleteRow()
        {
            var rowCount = 0;
            var colCount = 0;
            var tabCols = 0;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var editor = new NoteEditor();
                var form = CreateForm();
                form.Shown += (sender, args) =>
                {
                    //insert table
                    editor.HTML = "Some Text There";
                    var body = editor.Document.Body.DomElement as IHTMLBodyElement;
                    IHTMLTxtRange r = body.createTextRange() as IHTMLTxtRange;
                    r.findText("Text");
                    r.select();
                    var sut = new HtmlTableHelper(editor);
                    sut.TableInsert(new HtmlTableProperty(true));
                    //move inside table
                    IHTMLTxtRange r2 = body.createTextRange() as IHTMLTxtRange;
                    r2.findText("Text");
                    r2.select();
                    //modify table
                    sut.DeleteRow();

                    form.Close();
                };

                form.Controls.Add(editor);

                form.ShowDialog();

                rowCount = GetTable(editor).rows.length;
                colCount = (GetTable(editor).rows.item(0) as IHTMLTableRow).cells.length;
                tabCols = GetTable(editor).cols;
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            Assert.AreEqual(2, rowCount);
        }