Ejemplo n.º 1
0
        public void Bug_1_br_failure()
        {
            //Throws: ArgumnetException
            //This is the original code that caused the bug to be produced.
            //redux will reduce the code to the minimum value needed to reproduce.
            HTMLDualTagFormatting u  = new HTMLDualTagFormatting("u");
            HTMLDualTagFormatting b  = new HTMLDualTagFormatting("b");
            HTMLDualTagFormatting i  = new HTMLDualTagFormatting("i");
            SingleHTMLTag         br = new SingleHTMLTag("br");

            //Note that the >> was there unintentionally.
            string bug_1 = "Hi There, this is an initial Test.<br/><br/><u>Hello World</u>><br/><b>Hello World</b>><br/><i>Hello World</i>";
            var    res   = StringProcessor.ProcessString(bug_1, new List <TextFormattingRule> {
                u, b, i, br
            });
        }
Ejemplo n.º 2
0
        public void Bug_1_br_redux()
        {
            HTMLDualTagFormatting u  = new HTMLDualTagFormatting("u");
            HTMLDualTagFormatting b  = new HTMLDualTagFormatting("b");
            HTMLDualTagFormatting i  = new HTMLDualTagFormatting("i");
            SingleHTMLTag         br = new SingleHTMLTag("br");

            //Explanation of cause:
            //Initially: Problem was due to an instance of WrappedFormat being created over a single HTML tag with a wrapped rule inserted.
            //This should never have happened in the first place, code was modified to throw an error earlier on.

            //Once found, the Position was from 34:39 and 39:44, this was deemed by the code to be an overlap of type: OverlapType.Right
            //Unit tests were added to fix this (TestPosition_bug_1), now returns OverlapType.None
            string bug_1 = "Hi There, this is an initial Test.<br/><br/><u>Hello World</u>><br/><b>Hello World</b>><br/><i>Hello World</i>";
            var    res   = StringProcessor.ProcessString(bug_1, new List <TextFormattingRule> {
                u, b, i, br
            });

            //only need to assert that no error was created.
        }
Ejemplo n.º 3
0
        public void Bug_2_br_redux()
        {
            //Same code as Bug_1, the displayed text was shown incorrectly.

            HTMLDualTagFormatting u  = new HTMLDualTagFormatting("u");
            HTMLDualTagFormatting b  = new HTMLDualTagFormatting("b");
            HTMLDualTagFormatting i  = new HTMLDualTagFormatting("i");
            SingleHTMLTag         br = new SingleHTMLTag("br");

            //Looking a the output text, it was as expected.
            //Looking at the positioning of the breaks, it was as expected.
            //Output seemed perfect, there was a Bug using System.Windows.Forms.RichTextBox, assumed: start,end, was actually start, length

            //TODO: Before this is marked as done, add an adapter to the presentation layer.

            string bug_1 = "<br/><br/><u>Hello World</u>><br/><b>Hello World</b>><br/><i>Hello World</i>";
            var    res   = StringProcessor.ProcessString(bug_1, new List <TextFormattingRule> {
                u, b, i, br
            });
            string result = res.Value;

            Assert.AreEqual("Hello World>Hello World>Hello World", result);
            Assert.Inconclusive();
        }
Ejemplo n.º 4
0
        public void ConstructorWorksWithTag()
        {
            var tag = new SingleHTMLTag("br");

            Assert.AreEqual("br", tag.TagName);
        }