Esempio n. 1
0
    public IEnumerator LayoutGroupHeightChanged()
    {
        var sample = @"
    <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'>
    <body>
        <bg>
            <titlebox>
                <titletext>Sample</titletext>
            </titlebox>
            <newbadge/>
            <newbadge/>
            <textbg>
                <textbox><p>中身が空だと伸縮しないみたいなやつか?とりあえず適当な分量で膨らませた場合どうなるんだろう、これで4行くらいなんだけど。</p></textbox>
            </textbg>
        </bg>
    </body>
    ";

        TagTree tree = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }, 300));

        var textBg = tree.GetChildren()[0].GetChildren()[0].GetChildren()[2];

        True(textBg.offsetY.ToString() == "53.93751", "not match, textBg.offsetY:" + textBg.offsetY + " expected:" + "53.93751");

        var targetArray = new List <TagTree>();

        foreach (var child1 in tree.GetChildren())
        {
            // Debug.Log("child1:" + child1.tagValue);
            foreach (var child2 in child1.GetChildren())
            {
                // Debug.Log("child2:" + child2.tagValue);
                foreach (var child3 in child2.GetChildren())
                {
                    // Debug.Log("child3:" + child3.tagValue);
                    foreach (var child4 in child3.GetChildren())
                    {
                        // Debug.Log("child4:" + child4.viewHeight);
                        foreach (var child5 in child4.GetChildren())
                        {
                            // Debug.Log("child5:" + child5.viewHeight);
                            foreach (var child6 in child5.GetChildren())
                            {
                                // Debug.Log("child6:" + child6.viewHeight);
                                foreach (var child7 in child6.GetChildren())
                                {
                                    // Debug.Log("child7:" + child7.viewHeight);
                                    targetArray = child7.GetChildren();
                                }
                            }
                        }
                    }
                }
            }
        }

        True(targetArray[0].viewHeight == 64, "not match:" + targetArray[0].viewHeight + " expected:64");
    }
Esempio n. 2
0
    public IEnumerator LayoutHTMLWithCustomTagLargeText()
    {
        var     sample = @"
        <!DOCTYPE uuebview href='resources://Views/LayoutHTMLWithCustomTag/UUebTags'>
        <body>
        <customtag><custombg><textbg><customtext>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        </customtext></textbg></custombg></customtag>
        else
        </body>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        while (true)
        {
            if (0 < tree.GetChildren().Count)
            {
                tree = tree.GetChildren()[tree.GetChildren().Count - 1];
                if (tree.offsetY != 0)
                {
                    True(tree.offsetY.ToString() == "754.95", "not match, offsetY:" + tree.offsetY + " expect:" + "754.95");
                }
            }
            else
            {
                break;
            }
        }
    }
Esempio n. 3
0
    public IEnumerator LayoutHTMLWithCustomTagMultiple()
    {
        var     sample = @"
        <!DOCTYPE uuebview href='resources://Views/LayoutHTMLWithCustomTag/UUebTags'>
        <customtag><custombg><textbg><customtext>something1</customtext></textbg></custombg></customtag>
        <customtag><custombg><textbg><customtext>something2</customtext></textbg></custombg></customtag>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        True(0 < tree.GetChildren().Count, "not match, actual:" + tree.GetChildren().Count);
        True(tree.GetChildren()[0].offsetY.ToString() == "0.04999924", "not match of 1. actual:" + tree.GetChildren()[0].offsetY);
        True(tree.GetChildren()[1].offsetY.ToString() == "60.8", "not match of 2. actual:" + tree.GetChildren()[1].offsetY);
    }
Esempio n. 4
0
    public IEnumerator Order()
    {
        var     sample = @"
        <body>something1.<img src='https://dummyimage.com/100.png/09f/fff'/></body>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        True(
            tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.treeType == TreeType.Content_Text, "not match, type:" + tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.treeType
            );

        True(
            tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.treeType == TreeType.Content_Img, "not match, type:" + tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.treeType
            );
    }
Esempio n. 5
0
    public IEnumerator MultipleBoxConstraints()
    {
        var     sample = @"
    <!DOCTYPE uuebview href='resources://Views/MultipleBoxConstraints/UUebTags'>
    <itemlayout>
    <topleft>
        <img src='https://dummyimage.com/100.png/09f/fff'/>
    </topleft>
    <topright>
        <img src='https://dummyimage.com/100.png/08f/fff'/>
    </topright>
    <content><p>something!</p></content>
    <bottom>
        <img src='https://dummyimage.com/100.png/07f/fff'/>
    </bottom>
    </itemlayout>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var itemLayout = tree.GetChildren()[0];
        var topleft    = itemLayout.GetChildren()[0];
        var topright   = itemLayout.GetChildren()[1];

        True(topleft.offsetY == 0, "not match, topleft.offsetY:" + topleft.offsetY + " should be 0.");
        True(topright.offsetY == 0, "not match, topright.offsetY:" + topright.offsetY + " should be 0.");
    }
Esempio n. 6
0
    public IEnumerator Position()
    {
        var     sample = @"
        <body>something1.<img src='https://dummyimage.com/100.png/09f/fff'/></body>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        True(
            tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.offsetY == 6f, "not match, offsetY:" + tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[0] /*text of body*/.offsetY
            );

        True(
            tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.offsetY == 0, "not match, offsetY:" + tree /*root*/.GetChildren()[0] /*body*/.GetChildren()[1] /*img*/.offsetY
            );
    }
Esempio n. 7
0
 private void ShowLayoutRecursive(TagTree tree, ResourceLoader loader)
 {
     Debug.Log("tree:" + loader.GetTagFromValue(tree.tagValue) + " offsetX:" + tree.offsetX + " offsetY:" + tree.offsetY + " width:" + tree.viewWidth + " height:" + tree.viewHeight);
     foreach (var child in tree.GetChildren())
     {
         ShowLayoutRecursive(child, loader);
     }
 }
Esempio n. 8
0
 public static void ShowRecursive(TagTree tree, ResourceLoader loader)
 {
     // Debug.Log("parsedTag:" + loader.GetTagFromValue(tree.tagValue) + " type:" + tree.treeType);
     foreach (var child in tree.GetChildren())
     {
         ShowRecursive(child, loader);
     }
 }
Esempio n. 9
0
    public IEnumerator LayoutHTMLWithDoubleBoxedLayerNeverOverLayout()
    {
        var     sample = @"
        <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'>
        <body>
            <bg>
                <textbg>
                    <textbox>
                        <p>koko ni nihongo ga iikanji ni hairu. <br> 2line content! 2line content! 2line content!2 line content! a good thing.<a href='somewhere'>link</a>a long text will make large window. something like this.</p>
                        <updatetext>omake! abc d</updatetext>
                        <p>ef ghijklm</p>
                        <updatetext>aaaaaaaaaaaaabcdefghijk</updatetext>
                    </textbox>
                </textbg>
            </bg>
        </body>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }, 300));

        var pAndUpdateText = tree.GetChildren()[0] /*body*/.GetChildren()[0] /*bg*/.GetChildren()[0] /*textbg*/.GetChildren()[0] /*textbox*/.GetChildren()[0] /*textbox_box*/.GetChildren()[0].GetChildren();
        // foreach (var s in pAndUpdateText) {
        //     Debug.LogError("s:" + loader.GetTagFromValue(s.tagValue) + " treeType:" + s.treeType);
        // }

        var pContainer = pAndUpdateText[0];

        True(pContainer.viewWidth.ToString() == "208.9", "not match. pContainer.viewWidth:" + pContainer.viewWidth);

        var lastPContents = pContainer.GetChildren().Last();

        True(lastPContents.offsetY.ToString() == "105", "not match. lastPContents.offsetY:" + lastPContents.offsetY);

        var updateTextContainer = pAndUpdateText[1];

        True(updateTextContainer.offsetX == 51f, "not match. updateTextContainer.offsetX:" + updateTextContainer.offsetX);
        True(updateTextContainer.offsetY == 96f, "not match. updateTextContainer.offsetY:" + updateTextContainer.offsetY);

        var updateTextContainer2 = pAndUpdateText[2];

        True(updateTextContainer2.offsetY == 96f, "not match. updateTextContainer2.offsetY:" + updateTextContainer2.offsetY);

        var pContainer2 = pAndUpdateText[3];

        True(pContainer2.offsetY == 121, "not match. pContainer2.offsetY:" + pContainer2.offsetY);

        var pContainer2FirstLine = pContainer2.GetChildren()[0];

        True(pContainer2FirstLine.offsetX == 44f, "not match. pContainer2FirstLine.offsetX:" + pContainer2FirstLine.offsetX);
        True(pContainer2FirstLine.offsetY == 0f, "not match. pContainer2FirstLine.offsetY:" + pContainer2FirstLine.offsetY);

        var pContainer2SecondLine = pContainer2.GetChildren()[1];

        True(pContainer2SecondLine.offsetX == 0f, "not match. pContainer2SecondLine.offsetX:" + pContainer2SecondLine.offsetX);
        True(pContainer2SecondLine.offsetY.ToString() == "25", "not match. pContainer2SecondLine.offsetY:" + pContainer2SecondLine.offsetY);
    }
Esempio n. 10
0
    private int CountContentsRecursive(TagTree tree)
    {
        // Debug.Log("tag:" + loader.GetTagFromValue(tree.tagValue));
        var children = tree.GetChildren();
        var count    = 0;

        foreach (var child in children)
        {
            count += CountContentsRecursive(child);
        }
        return(count + 1);// add this content count.
    }
Esempio n. 11
0
    public IEnumerator PSupport2()
    {
        Debug.LogWarning("保留。");
        yield break;
        var     sample = @"
    <p>
        p1<a href=''>a1</a>p2
    </p><p>
        p3
    </p>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var p1 = tree.GetChildren()[0];
        var p2 = tree.GetChildren()[1];

        True(p1.GetChildren().Count == 3, "not match, p1.GetChildren().Count:" + p1.GetChildren().Count);

        True(p1.offsetY == 0, "not match. p1.offsetY:" + p1.offsetY);
        True(p2.offsetY == 16f, "not match. p2.offsetY:" + p2.offsetY);
    }
Esempio n. 12
0
    public IEnumerator PSupport()
    {
        var     sample = @"
    <p>
        p1<a href=''>a1</a>p2
    </p>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var p1 = tree.GetChildren()[0];

        True(p1.GetChildren().Count == 3, "not match, p1.GetChildren().Count:" + p1.GetChildren().Count);
    }
Esempio n. 13
0
    public IEnumerator LayoutRightAlignSupport()
    {
        var sample = @"
    <p align='right'>aaa</p>";

        TagTree tree = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var p = tree.GetChildren()[0] /*p*/.GetChildren();

        True(p[0].offsetX == 76, "not match. custombgs[0].offsetX:" + p[0].offsetX);
        True(p[0].offsetY == 0, "not match. custombgs[0].offsetY:" + p[0].offsetY);
    }
Esempio n. 14
0
    public IEnumerator BrBrSupport()
    {
        var     sample = @"
    <p>
        something<br><br>
        else
    </p>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var p = tree.GetChildren()[0] /*p*/.GetChildren();

        True(p[0].offsetY == 0, "not match. custombgs[0].offsetY:" + p[0].offsetY);
        True(p[3].offsetY == 32f, "not match. custombgs[3].offsetY:" + p[3].offsetY);
    }
Esempio n. 15
0
    public IEnumerator LayoutHTMLWithCustomTagMultipleByInnerContentWithParentLayer()
    {
        var     sample = @"
        <!DOCTYPE uuebview href='resources://Views/LayoutHTMLWithCustomTag/UUebTags'>
        <customtag>
            <custombg><textbg><customtext>something1</customtext></textbg></custombg>
            <custombg><textbg><customtext>something2</customtext></textbg></custombg>
        </customtag>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var custombgs = tree.GetChildren()[0] /*customtag*/.GetChildren()[0] /*box*/.GetChildren();

        True(custombgs[0].offsetY == 0, "not match. custombgs[0].offsetY:" + custombgs[0].offsetY);
        True(custombgs[1].offsetY.ToString() == "60.7", "not match. custombgs[1].offsetY:" + custombgs[1].offsetY);
    }
Esempio n. 16
0
    public IEnumerator LayoutAfterLayer()
    {
        var     sample = @"
    <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'>
    <body>
        <bg>
        </bg>
        <p>hey!</p>
    </body>
    ";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }, 300));

        var p = tree.GetChildren()[0].GetChildren()[1];

        True(p.offsetX == 0 && p.offsetY == 100, "not match. p.offsetY:" + p.offsetY);
    }
Esempio n. 17
0
    public IEnumerator LayoutSampleView2_HiddenBreakView()
    {
        var     sample = @"
        <!DOCTYPE uuebview href='resources://Views/MyInfoView/UUebTags'>
        <body>
            <bg>
                <textbg>
                    <textbox>
                        <updatetext>koko ni nihongo ga iikanji ni hairu. good thing. long text will make large window. like this.</updatetext>
                        <updatetext hidden='true' listen='readmore'>omake!</updatetext>
                    </textbox>
                </textbg>
            </bg>
        </body>";
        TagTree tree   = null;

        yield return(CreateTagTree(sample, tagTreeSource => { tree = tagTreeSource; }));

        var textBox       = tree.GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0].GetChildren()[0];
        var updatetextBox = textBox.GetChildren()[0];

        // Debug.LogError("updatetextBox:" + updatetextBox.viewHeight);
        True(textBox.viewHeight == 1950, "not match, textBox.viewHeight:" + textBox.viewHeight);
    }