Exemplo n.º 1
0
        public void CleanHtmlCode()
        {
            HtmlCodeCleaner.Clean(noteGlue.Editor);

            // - makes the editor dirty
            // - also revolves an issue where editor is stuck in an odd state if
            //     1) a fixed sized div was selected earlier
            //     2) and the div size is cleared during Clean operation
            noteGlue.Editor.UpdateHtmlSource(noteGlue.Editor.HTML);
        }
Exemplo n.º 2
0
        public void Clean()
        {
            var    p    = new PersistenceManager();
            var    tree = p.OpenTree(@"Resources\Html Code Cleaner.mm");
            string html = null;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var editor = new NoteEditor();
                var form   = CreateForm();
                form.Controls.Add(editor);
                form.Shown += (sender, args) =>
                {
                    editor.HTML = tree.RootNode.FirstChild.NoteText;

                    //pre change tests

                    //change
                    HtmlCodeCleaner.Clean(editor);

                    //post change tests

                    tree.RootNode.FirstChild.NoteText = editor.HTML;
                    p.CurrentTree.Save(@"Resources\Html Code Cleaner - Cleaned.mm");
                    html = editor.HTML;
                    form.Close();
                };
                form.ShowDialog();
            });
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            t.Join();

            //Assert.IsTrue(html.Contains("srcOrig"));
            //int imgUpdated = Regex.Matches(html, "srcOrig", RegexOptions.IgnoreCase).Count;
            //Assert.IsTrue(imgUpdated > 50);

            //int imgCount = Regex.Matches(html, "<img", RegexOptions.IgnoreCase).Count;
            //Assert.IsTrue(imgCount >= imgUpdated);
        }