Ejemplo n.º 1
0
        public void TestPartManagement()
        {
            ITextPart part = null;

            AddStep("clear text", () => textContainer.Clear());
            assertSpriteTextCount(0);

            AddStep("add text", () => part = textContainer.AddText("this is some text"));
            AddStep("set text colour to red manually", () => part.Drawables.ForEach(p => p.Colour = Colour4.Red));
            assertSpriteTextCount(4);

            AddStep("add more text", () => textContainer.AddText("and some more of it too"));
            assertSpriteTextCount(10);

            AddStep("add manual drawable", () => textContainer.AddPart(new TextPartManual(new[]
            {
                new SpriteIcon
                {
                    Icon = FontAwesome.Regular.Clipboard,
                    Size = new Vector2(16)
                }
            })));
            assertSpriteTextCount(10);
            assertTotalChildCount(11);

            AddStep("remove original text", () => textContainer.RemovePart(part));
            assertSpriteTextCount(6);
            assertTotalChildCount(7);

            AddStep("clear text", () => textContainer.Clear());
            assertSpriteTextCount(0);
        }