public void SurfaceConstruction()
        {
            var fileProvider = new FakeReadFileProvider();

            fileProvider.Add("test.png", "");

            surface = new Surface("test.png", fileProvider);

            Assert.AreEqual(1, fileProvider.ReadCount("test.png"));
        }
        public void Initialize()
        {
            var fakeFileProvider = new FakeReadFileProvider();

            fakeFileProvider.Add("resources.yaml", FacetSource);

            var resourceManager = new AgateResourceManager(
                new ResourceDataLoader(fakeFileProvider).Load("resources.yaml"));

            FacetName = resourceManager.Data.Facets.First().Key;

            resourceManager.InitializeContainer(this);

            Adapter = InterfaceRoot.Renderer.Adapter;

            InitializeTest();
        }
Beispiel #3
0
        public void InitializeWindow(int width, int height)
        {
            string yaml = $@"
themes:
    default:
        window:
            box:
                padding: {WindowPadding}
                margin: {WindowMargin}
            border:
                size: {WindowBorder}
        panel:
            box:
                padding: {PanelPadding}
                margin: {PanelMargin}
            border:
                size: {PanelBorder}
        label:
            box:
                padding: {LabelPadding}
                margin: {LabelMargin}
            border:
                size: {LabelBorder}

facets:
    main: 
    -   name: window
        type: window
        position: {WindowPosition.X} {WindowPosition.Y}
        size: {width} {height}
        children:
        -   name: container_1
            type: panel
            children:
            -   name: label_1
                type: label
                text: hello
            -   name: label_2
                type: label
                text: hello, world
            -   name: label_3
                type: label
                text: hello your face
        -   name: container_2
            type: panel
            children:
            -   name: label_4
                type: label
                text: dogs are the best
            -   name: label_5
                type: label
                text: cats suck
";

            var fileProvider = new FakeReadFileProvider();

            fileProvider.Add("resources.yaml", yaml);

            var resourceDataModel = new ResourceDataLoader(fileProvider)
                                    .Load("resources.yaml");

            Resources = new AgateResourceManager(resourceDataModel);

            Facet = new TestFacet();
            Resources.UserInterface.InitializeFacet(Facet);

            LayoutEngine = Facet.InterfaceRoot.LayoutEngine;
            Adapter      = Facet.InterfaceRoot.Renderer.Adapter;

            LayoutEngine.UpdateLayout(Facet.InterfaceRoot);
        }