예제 #1
0
        public void TestBeatmapBackgroundTracksBeatmapWhenSuspended()
        {
            setSupporter(true);
            setSourceMode(BackgroundSource.Beatmap);

            AddStep("change beatmap", () => Beatmap.Value = createTestWorkingBeatmapWithUniqueBackground());
            AddAssert("background changed", () => screen.CheckLastLoadChange() == true);
            AddUntilStep("wait for beatmap background to be loaded", () => getCurrentBackground()?.GetType() == typeof(BeatmapBackground));

            BackgroundScreenBeatmap nestedScreen = null;

            // of note, this needs to be a type that doesn't match BackgroundScreenDefault else it is silently not pushed by the background stack.
            AddStep("push new background to stack", () => stack.Push(nestedScreen = new BackgroundScreenBeatmap(Beatmap.Value)));
            AddUntilStep("wait for screen to load", () => nestedScreen.IsLoaded && nestedScreen.IsCurrentScreen());
            AddUntilStep("previous background hidden", () => !screen.IsAlive);

            AddAssert("top level background hasn't changed yet", () => screen.CheckLastLoadChange() == null);

            AddStep("change beatmap", () => Beatmap.Value = createTestWorkingBeatmapWithUniqueBackground());

            AddAssert("top level background hasn't changed yet", () => screen.CheckLastLoadChange() == null);

            AddStep("pop screen back to top level", () => screen.MakeCurrent());

            AddAssert("top level background changed", () => screen.CheckLastLoadChange() == true);
        }
예제 #2
0
        public void TestBeatmapBackgroundIgnoresNoChangeWhenSuspended()
        {
            BackgroundScreenBeatmap nestedScreen    = null;
            WorkingBeatmap          originalWorking = null;

            setSupporter(true);
            setSourceMode(BackgroundSource.Beatmap);

            AddStep("change beatmap", () => originalWorking = Beatmap.Value = createTestWorkingBeatmapWithUniqueBackground());
            AddAssert("background changed", () => screen.CheckLastLoadChange() == true);
            AddUntilStep("wait for beatmap background to be loaded", () => getCurrentBackground()?.GetType() == typeof(BeatmapBackground));

            // of note, this needs to be a type that doesn't match BackgroundScreenDefault else it is silently not pushed by the background stack.
            AddStep("push new background to stack", () => stack.Push(nestedScreen = new BackgroundScreenBeatmap(Beatmap.Value)));
            AddUntilStep("wait for screen to load", () => nestedScreen.IsLoaded && nestedScreen.IsCurrentScreen());

            // we're testing a case where scheduling may be used to avoid issues, so ensure the scheduler is no longer running.
            AddUntilStep("wait for top level not alive", () => !screen.IsAlive);

            AddStep("change beatmap", () => Beatmap.Value      = createTestWorkingBeatmapWithUniqueBackground());
            AddStep("change beatmap back", () => Beatmap.Value = originalWorking);

            AddAssert("top level background hasn't changed yet", () => screen.CheckLastLoadChange() == null);

            AddStep("pop screen back to top level", () => screen.MakeCurrent());

            AddStep("top level screen is current", () => screen.IsCurrentScreen());
            AddAssert("top level background reused existing", () => screen.CheckLastLoadChange() == false);
        }
        public void TestBeatmapBackgroundWithStoryboardClockAlwaysUsesCurrentTrack()
        {
            BackgroundScreenBeatmap nestedScreen    = null;
            WorkingBeatmap          originalWorking = null;

            setSupporter(true);
            setSourceMode(BackgroundSource.BeatmapWithStoryboard);

            AddStep("change beatmap", () => originalWorking = Beatmap.Value = createTestWorkingBeatmapWithStoryboard());
            AddAssert("background changed", () => screen.CheckLastLoadChange() == true);
            AddUntilStep("wait for beatmap background to be loaded", () => getCurrentBackground()?.GetType() == typeof(BeatmapBackgroundWithStoryboard));

            AddStep("start music", () => MusicController.Play());
            AddUntilStep("storyboard clock running", () => screen.ChildrenOfType <DrawableStoryboard>().SingleOrDefault()?.Clock.IsRunning == true);

            // of note, this needs to be a type that doesn't match BackgroundScreenDefault else it is silently not pushed by the background stack.
            AddStep("push new background to stack", () => stack.Push(nestedScreen = new BackgroundScreenBeatmap(Beatmap.Value)));
            AddUntilStep("wait for screen to load", () => nestedScreen.IsLoaded && nestedScreen.IsCurrentScreen());

            // we're testing a case where scheduling may be used to avoid issues, so ensure the scheduler is no longer running.
            AddUntilStep("wait for top level not alive", () => !screen.IsAlive);

            AddStep("stop music", () => MusicController.Stop());
            AddStep("change beatmap", () => Beatmap.Value      = createTestWorkingBeatmapWithStoryboard());
            AddStep("change beatmap back", () => Beatmap.Value = originalWorking);
            AddStep("restart music", () => MusicController.Play());

            AddAssert("top level background hasn't changed yet", () => screen.CheckLastLoadChange() == null);

            AddStep("pop screen back to top level", () => screen.MakeCurrent());

            AddStep("top level screen is current", () => screen.IsCurrentScreen());
            AddAssert("top level background reused existing", () => screen.CheckLastLoadChange() == false);
            AddUntilStep("storyboard clock running", () => screen.ChildrenOfType <DrawableStoryboard>().Single().Clock.IsRunning);

            AddStep("stop music", () => MusicController.Stop());
            AddStep("restore default beatmap", () => Beatmap.SetDefault());
        }
예제 #4
0
        protected override BackgroundScreen CreateBackground()
        {
            var background = new BackgroundScreenBeatmap();

            return(background);
        }
예제 #5
0
 protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenBeatmap();