예제 #1
0
        private void load(Storage storage, GameHost host, FrameworkConfigManager frameworkConfig, FontStore fonts, Game game, AudioManager audio)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            exit = host.Exit;

            audio.AddAdjustment(AdjustableProperty.Frequency, audioRateAdjust);

            var resources = game.Resources;

            //Roboto
            game.AddFont(resources, @"Fonts/Roboto/Roboto-Regular");
            game.AddFont(resources, @"Fonts/Roboto/Roboto-Bold");

            //RobotoCondensed
            game.AddFont(resources, @"Fonts/RobotoCondensed/RobotoCondensed-Regular");
            game.AddFont(resources, @"Fonts/RobotoCondensed/RobotoCondensed-Bold");

            showLogOverlay = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay);

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                mainContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = test_list_width
                    },
                    Children = new Drawable[]
                    {
                        new SafeAreaContainer
                        {
                            SafeAreaOverrideEdges = Edges.Right | Edges.Bottom,
                            RelativeSizeAxes      = Axes.Both,
                            Child = testContentContainer = new Container
                            {
                                Clock            = framedClock,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding {
                                    Top = 50
                                },
                                Child = compilingNotice = new Container
                                {
                                    Alpha        = 0,
                                    Anchor       = Anchor.Centre,
                                    Origin       = Anchor.Centre,
                                    Masking      = true,
                                    Depth        = float.MinValue,
                                    CornerRadius = 5,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4.Black,
                                        },
                                        new SpriteText
                                        {
                                            Font = new FontUsage(size: 30),
                                            Text = @"Compiling new version..."
                                        }
                                    },
                                }
                            }
                        },
                        toolbar = new TestBrowserToolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                        },
                    }
                },
                leftContainer = new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(test_list_width, 1),
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new SafeAreaContainer
                        {
                            SafeAreaOverrideEdges = Edges.Left | Edges.Top | Edges.Bottom,
                            RelativeSizeAxes      = Axes.Both,
                            Child = new Box
                            {
                                Colour           = FrameworkColour.GreenDark,
                                RelativeSizeAxes = Axes.Both
                            }
                        },
                        new FillFlowContainer
                        {
                            Direction        = FillDirection.Vertical,
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                searchTextBox = new TestBrowserTextBox
                                {
                                    OnCommit = delegate
                                    {
                                        var firstTest = leftFlowContainer.Where(b => b.IsPresent).SelectMany(b => b.FilterableChildren).OfType <TestSubButton>()
                                                        .FirstOrDefault(b => b.MatchingFilter)?.TestType;
                                        if (firstTest != null)
                                        {
                                            LoadTest(firstTest);
                                        }
                                    },
                                    Height           = 25,
                                    RelativeSizeAxes = Axes.X,
                                    PlaceholderText  = "type to search",
                                    Depth            = -1,
                                },
                                new BasicScrollContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = false,
                                    Child            = leftFlowContainer = new SearchContainer <TestGroupButton>
                                    {
                                        Padding = new MarginPadding {
                                            Top = 3, Bottom = 20
                                        },
                                        Direction        = FillDirection.Vertical,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                    }
                                }
                            }
                        }
                    }
                },
            };

            searchTextBox.Current.ValueChanged += e => leftFlowContainer.SearchTerm = e.NewValue;

            if (RuntimeInfo.SupportsJIT)
            {
                backgroundCompiler = new DynamicClassCompiler <TestScene>();
                backgroundCompiler.CompilationStarted  += compileStarted;
                backgroundCompiler.CompilationFinished += compileFinished;
                backgroundCompiler.CompilationFailed   += compileFailed;

                try
                {
                    backgroundCompiler.Start();
                }
                catch
                {
                    //it's okay for this to fail for now.
                }
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AddAssembly(asm.GetName().Name, asm);
            }

            Assembly.BindValueChanged(updateList);
            RunAllSteps.BindValueChanged(v => runTests(null));
            PlaybackRate.BindValueChanged(e =>
            {
                rateAdjustClock.Rate  = e.NewValue;
                audioRateAdjust.Value = e.NewValue;
            }, true);
        }
예제 #2
0
        private void load(Storage storage, GameHost host)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            exit = host.Exit;

            rateBindable = new BindableDouble(1)
            {
                MinValue = 0,
                MaxValue = 2,
            };

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                leftContainer = new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(test_list_width, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new FillFlowContainer
                        {
                            Direction        = FillDirection.Vertical,
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                searchTextBox = new TextBox
                                {
                                    OnCommit = delegate
                                    {
                                        var firstVisible = leftFlowContainer.FirstOrDefault(b => b.IsPresent);
                                        if (firstVisible != null)
                                        {
                                            LoadTest(firstVisible.TestType);
                                        }
                                    },
                                    Height           = 20,
                                    RelativeSizeAxes = Axes.X,
                                    PlaceholderText  = "type to search"
                                },
                                new ScrollContainer
                                {
                                    Padding = new MarginPadding {
                                        Top = 3, Bottom = 20
                                    },
                                    RelativeSizeAxes         = Axes.Both,
                                    ScrollbarOverlapsContent = false,
                                    Child = leftFlowContainer = new SearchContainer <TestCaseButton>
                                    {
                                        Padding          = new MarginPadding(3),
                                        Direction        = FillDirection.Vertical,
                                        Spacing          = new Vector2(0, 5),
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                    }
                                }
                            }
                        }
                    }
                },
                mainContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = test_list_width
                    },
                    Children = new Drawable[]
                    {
                        toolbar = new Toolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                        },
                        testContentContainer = new Container
                        {
                            Clock            = framedClock,
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            searchTextBox.Current.ValueChanged += newValue => leftFlowContainer.SearchTerm = newValue;

            backgroundCompiler = new DynamicClassCompiler <TestCase>
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
            };
            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AssemblyDropdown.AddDropdownItem(asm.GetName().Name, asm);
            }

            toolbar.AssemblyDropdown.Current.ValueChanged += updateList;
            toolbar.RunAllSteps.Current.ValueChanged      += v => runTests(null);
            toolbar.RateAdjustSlider.Current.BindTo(rateBindable);

            rateBindable.ValueChanged += v => rateAdjustClock.Rate = v;
            rateBindable.TriggerChange();
        }
예제 #3
0
        private void load(Storage storage)
        {
            config = new TestBrowserConfig(storage);

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(200, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new ScrollContainer
                        {
                            RelativeSizeAxes             = Axes.Both,
                            ScrollDraggerOverlapsContent = false,
                            Children = new[]
                            {
                                leftFlowContainer = new FillFlowContainer <TestCaseButton>
                                {
                                    Padding          = new MarginPadding(3),
                                    Direction        = FillDirection.Vertical,
                                    Spacing          = new Vector2(0, 5),
                                    AutoSizeAxes     = Axes.Y,
                                    RelativeSizeAxes = Axes.X,
                                }
                            }
                        }
                    }
                },
                testContentContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = 200
                    },
                    Children = new Drawable[]
                    {
                        compilingNotice = new Container
                        {
                            Alpha        = 0,
                            Anchor       = Anchor.Centre,
                            Origin       = Anchor.Centre,
                            Masking      = true,
                            Depth        = float.MinValue,
                            CornerRadius = 5,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                new SpriteText
                                {
                                    TextSize = 30,
                                    Text     = @"Compiling new version..."
                                }
                            },
                        }
                    }
                }
            };

            //Add buttons for each TestCase.
            leftFlowContainer.Add(Tests.Select(t => new TestCaseButton(t)
            {
                Action = () => LoadTest(t)
            }));

            backgroundCompiler = new DynamicClassCompiler <TestCase>()
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
                WatchDirectory      = @"Tests",
            };

            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }
        }
예제 #4
0
        private void load(Storage storage, GameHost host, FrameworkConfigManager frameworkConfig)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            exit = host.Exit;

            showLogOverlay = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay);

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                leftContainer = new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(test_list_width, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = new Color4(50, 50, 50, 255),
                            RelativeSizeAxes = Axes.Both
                        },
                        new FillFlowContainer
                        {
                            Direction        = FillDirection.Vertical,
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                searchTextBox = new TextBox
                                {
                                    OnCommit = delegate
                                    {
                                        var firstVisible = leftFlowContainer.FirstOrDefault(b => b.IsPresent);
                                        if (firstVisible != null)
                                        {
                                            LoadTest(firstVisible.SelectFirst());
                                        }
                                    },
                                    Height           = 20,
                                    RelativeSizeAxes = Axes.X,
                                    PlaceholderText  = "type to search"
                                },
                                new ScrollContainer
                                {
                                    Padding = new MarginPadding {
                                        Top = 3, Bottom = 20
                                    },
                                    RelativeSizeAxes         = Axes.Both,
                                    ScrollbarOverlapsContent = false,
                                    Child = leftFlowContainer = new SearchContainer <TestCaseButtonGroup>
                                    {
                                        Padding          = new MarginPadding(3),
                                        Direction        = FillDirection.Vertical,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                    }
                                }
                            }
                        }
                    }
                },
                mainContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = test_list_width
                    },
                    Children = new Drawable[]
                    {
                        toolbar = new TestBrowserToolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                        },
                        testContentContainer = new Container
                        {
                            Clock            = framedClock,
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            searchTextBox.Current.ValueChanged += newValue => leftFlowContainer.SearchTerm = newValue;

            if (RuntimeInfo.SupportsJIT)
            {
                backgroundCompiler = new DynamicClassCompiler <TestCase>
                {
                    CompilationStarted  = compileStarted,
                    CompilationFinished = compileFinished,
                    CompilationFailed   = compileFailed
                };
                try
                {
                    backgroundCompiler.Start();
                }
                catch
                {
                    //it's okay for this to fail for now.
                }
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AddAssembly(asm.GetName().Name, asm);
            }

            Assembly.BindValueChanged(updateList);
            RunAllSteps.BindValueChanged(v => runTests(null));
            PlaybackRate.BindValueChanged(v => rateAdjustClock.Rate = v, true);
        }
예제 #5
0
        private void load(Storage storage, GameHost host)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            rateBindable = new BindableDouble(1)
            {
                MinValue = 0,
                MaxValue = 1,
            };

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(200, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new ScrollContainer
                        {
                            RelativeSizeAxes         = Axes.Both,
                            ScrollbarOverlapsContent = false,
                            Child = leftFlowContainer = new FillFlowContainer <TestCaseButton>
                            {
                                Padding          = new MarginPadding(3),
                                Direction        = FillDirection.Vertical,
                                Spacing          = new Vector2(0, 5),
                                AutoSizeAxes     = Axes.Y,
                                RelativeSizeAxes = Axes.X,
                            }
                        }
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = 200
                    },
                    Children = new Drawable[]
                    {
                        toolbar = new Toolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                            RunAllSteps      = () => CurrentTest.RunAllSteps(() => toolbar.RunComplete(), toolbar.RunComplete),
                        },
                        testContentContainer = new Container
                        {
                            Clock            = framedClock,
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            backgroundCompiler = new DynamicClassCompiler <TestCase>
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
            };
            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AssemblyDropdown.AddDropdownItem(asm.GetName().Name, asm);
            }

            toolbar.AssemblyDropdown.Current.ValueChanged += updateList;
            toolbar.RateAdjustSlider.Current.BindTo(rateBindable);

            rateBindable.ValueChanged += v => rateAdjustClock.Rate = v;
            rateBindable.TriggerChange();
        }
예제 #6
0
        private void load(Storage storage, GameHost host)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(200, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new ScrollContainer
                        {
                            RelativeSizeAxes         = Axes.Both,
                            ScrollbarOverlapsContent = false,
                            Child = leftFlowContainer = new FillFlowContainer <TestCaseButton>
                            {
                                Padding          = new MarginPadding(3),
                                Direction        = FillDirection.Vertical,
                                Spacing          = new Vector2(0, 5),
                                AutoSizeAxes     = Axes.Y,
                                RelativeSizeAxes = Axes.X,
                            }
                        }
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = 200
                    },
                    Children = new[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                },
                                new FillFlowContainer
                                {
                                    Spacing          = new Vector2(5),
                                    Direction        = FillDirection.Horizontal,
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding(10),
                                    Children         = new Drawable[]
                                    {
                                        new SpriteText
                                        {
                                            Padding = new MarginPadding(5),
                                            Text    = "Current Assembly:"
                                        },
                                        assemblyDropdown,
                                        runAllButton = new Button
                                        {
                                            Text             = "Run all steps",
                                            BackgroundColour = Color4.MediumPurple,
                                            Action           = delegate
                                            {
                                                runAllButton.Enabled.Value    = false;
                                                runAllButton.BackgroundColour = Color4.DimGray;
                                                CurrentTest.RunAllSteps(() => runAllComplete(), e => runAllComplete(true));
                                            },
                                            Width            = 150,
                                            RelativeSizeAxes = Axes.Y,
                                        },
                                    }
                                }
                            }
                        },
                        testContentContainer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            backgroundCompiler = new DynamicClassCompiler <TestCase>
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
            };

            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }
        }