public IEnumerator ParseCustomTextAsTextContent() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/ParserTestTextView/UUebTags'> <mytext>text</mytext>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.GetChildren().Count == 1, "not match."); True(parsedRoot.GetChildren()[0].treeType == TreeType.Container, "not match. expected:" + TreeType.Container + " actual:" + parsedRoot.GetChildren()[0].treeType); }
public IEnumerator ParseCustomImgAsImgContent() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/ParserTestImgView/UUebTags'> <myimg src='https://github.com/sassembla/Autoya/blob/master/doc/scr.png?raw=true2' />"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.GetChildren().Count == 1, "not match."); True(parsedRoot.GetChildren()[0].treeType == TreeType.Content_Img, "not match. expected:" + TreeType.Content_Img + " actual:" + parsedRoot.GetChildren()[0].treeType); }
public IEnumerator ParseImageAsImgContent() { var sampleHtml = @" <img src='https://github.com/sassembla/Autoya/blob/master/doc/scr.png?raw=true2' />"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.GetChildren().Count == 1, "not match."); True(parsedRoot.GetChildren()[0].tagValue == (int)HTMLTag.img, "not match 1. actual:" + parsedRoot.GetChildren()[0].tagValue); True(parsedRoot.GetChildren()[0].treeType == TreeType.Content_Img, "not match."); }
public IEnumerator CustomEmptyLayerCanSingleCloseTag2() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'> <body><newbadge/>aaa</body>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.errors.Count == 0, "not match."); True(parsedRoot.GetChildren().Count == 1, "count:" + parsedRoot.GetChildren().Count); True(parsedRoot.GetChildren()[0].GetChildren().Count == 2, "count:" + parsedRoot.GetChildren()[0].GetChildren().Count); }
public IEnumerator ParserTestCustomLayerAndCustomContentCombination() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/ParserTestCombination/UUebTags'> <customtag><customtagtext><customtext>text</customtext></customtagtext></customtag> <customtext>text</customtext>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.GetChildren().Count == 2, "not match."); True(parsedRoot.GetChildren()[0].treeType == TreeType.CustomLayer, "not match. expected:" + TreeType.CustomLayer + " actual:" + parsedRoot.GetChildren()[0].treeType); True(parsedRoot.GetChildren()[1].treeType == TreeType.Container, "not match. expected:" + TreeType.Container + " actual:" + parsedRoot.GetChildren()[0].treeType); }
public IEnumerator ParseSimpleHTML() { var sampleHtml = @" <body>something</body> "; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var children = parsedRoot.GetChildren(); True(parsedRoot.GetChildren().Count == 1, "not match."); True(parsedRoot.GetChildren()[0].tagValue == (int)HTMLTag.body, "not match."); }
public IEnumerator Order() { var sampleHtml = @" <body>something1.<img src='https://dummyimage.com/100.png/09f/fff'/></body>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True( parsedRoot /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.treeType == TreeType.Content_Text, "not match, type:" + parsedRoot /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.treeType ); True( parsedRoot /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.treeType == TreeType.Content_Img, "not match, type:" + parsedRoot /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.treeType ); }
public IEnumerator CustomEmptyLayerCanSingleCloseTag() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'> <newbadge/>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); True(parsedRoot.errors.Count == 0, "not match. error:" + ParsedTree.ShowErrors(parsedRoot)); foreach (var child in parsedRoot.GetChildren()) { if (child.tagValue == 28) { Debug.LogError("child text:" + child.keyValueStore[HTMLAttribute._CONTENT]); } } True(parsedRoot.GetChildren().Count == 1, "count:" + parsedRoot.GetChildren().Count); }
public IEnumerator Revert() { var sampleHtml = @" <body>something</body> "; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); { var bodyContainer = parsedRoot.GetChildren()[0]; var textChildren = bodyContainer.GetChildren(); True(textChildren.Count == 1, "not match a. actual:" + textChildren.Count); var textChildrenTree = textChildren[0]; var textPart = textChildrenTree.keyValueStore[HTMLAttribute._CONTENT] as string; var frontHalf = textPart.Substring(0, 4); var backHalf = textPart.Substring(4); textChildrenTree.keyValueStore[HTMLAttribute._CONTENT] = frontHalf; var insertionTree = new InsertedTree(textChildrenTree, backHalf, textChildrenTree.tagValue); insertionTree.SetParent(bodyContainer); // 増えてるはず True(bodyContainer.GetChildren().Count == 2, "not match b. actual:" + bodyContainer.GetChildren().Count); } TagTree.CorrectTrees(parsedRoot); { var bodyContainer = parsedRoot.GetChildren()[0]; var textChildren = bodyContainer.GetChildren(); var textChildrenTree = textChildren[0]; True(textChildren.Count == 1, "not match c. actual:" + textChildren.Count); True(textChildrenTree.keyValueStore[HTMLAttribute._CONTENT] as string == "something", "actual:" + textChildrenTree.keyValueStore[HTMLAttribute._CONTENT] as string); } }
public IEnumerator LoadSimpleHTML() { var sampleHtml = @" <body>something</body> "; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var children = parsedRoot.GetChildren(); True(children.Count == 1, "not match. children.Count:" + children.Count); }
public IEnumerator PSupport() { var sampleHtml = @" <p> p1<a href=''>a</a>p2 </p>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var pChildren = parsedRoot.GetChildren()[0].GetChildren(); // foreach (var pp in pChildren) { // Debug.LogError("pp:" + pp.tagValue); // } True(pChildren.Count == 3, "not match, count:" + pChildren.Count); }
public IEnumerator CoronWrappedContentSupport() { var sampleHtml = @" <p> a'<a href=''>aqua color string</a>'b </p>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var pChildren = parsedRoot.GetChildren()[0].GetChildren(); foreach (var pp in pChildren) { True(pp.keyValueStore[HTMLAttribute._CONTENT] as string == "a'<a href=''>aqua color string</a>'b", "not match, " + pp.keyValueStore[HTMLAttribute._CONTENT]); } True(pChildren.Count == 1, "not match, pChildren count:" + pChildren.Count); }
public IEnumerator BrSupport() { var sampleHtml = @" <p> something<br> else </p>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var p = parsedRoot.GetChildren()[0].GetChildren(); // foreach (var pp in p) { // Debug.LogError("pp:" + pp.tagValue); // } True(p.Count == 3, "not match, count:" + p.Count); }
public IEnumerator UnityRichTextSizeSupport() { var sampleHtml = @" <p> a<size=50>large string</size>b </p>"; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); var pChildren = parsedRoot.GetChildren()[0].GetChildren(); foreach (var pp in pChildren) { // Debug.LogError("pp:" + pp.tagValue + " text:" + pp.keyValueStore[HTMLAttribute._CONTENT]); True(pp.keyValueStore[HTMLAttribute._CONTENT] as string == "a<size=50>large string</size>b", "not match, " + pp.keyValueStore[HTMLAttribute._CONTENT]); } True(pChildren.Count == 1, "not match, pChildren count:" + pChildren.Count); }
public IEnumerator WithDeepCustomTagBoxHasBoxAttr() { var sampleHtml = @" <!DOCTYPE uuebview href='resources://Views/WithDeepCustomTag/UUebTags'> <customtag><img src='https://github.com/sassembla/Autoya/blob/master/doc/scr.png?raw=true2' /><img src='https://github.com/sassembla/Autoya/blob/master/doc/scr.png?raw=true2' /></customtag> <p>else</p> "; ParsedTree parsedRoot = null; yield return(GetParsedRoot(sampleHtml, parsedRootSource => { parsedRoot = parsedRootSource; })); foreach (var s in parsedRoot.GetChildren()[0].GetChildren()) { True(s.treeType == TreeType.CustomBox, "not match, s.treeType:" + s.treeType); True(s.keyValueStore.ContainsKey(HTMLAttribute._BOX), "box does not have pos kv."); } // ShowRecursive(customizedTree, loader); }