Ejemplo n.º 1
0
        public void TestExitSongSelectWithEscape()
        {
            TestSongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new TestSongSelect());
            AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
            AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
            pushEscape();
            AddAssert("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
            exitViaEscapeAndConfirm();
        }
Ejemplo n.º 2
0
        public void TestMenuMakesMusic()
        {
            TestSongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new TestSongSelect());

            AddUntilStep("wait for no track", () => Game.MusicController.CurrentTrack.IsDummyDevice);

            AddStep("return to menu", () => songSelect.Exit());

            AddUntilStep("wait for track", () => !Game.MusicController.CurrentTrack.IsDummyDevice && Game.MusicController.IsPlaying);
        }
Ejemplo n.º 3
0
        public override void SetUpSteps()
        {
            base.SetUpSteps();

            AddStep("reset defaults", () =>
            {
                Ruleset.Value = new OsuRuleset().RulesetInfo;
                Beatmap.SetDefault();

                songSelect = null;
            });

            AddStep("delete all beatmaps", () => manager?.Delete());
        }
Ejemplo n.º 4
0
        public void TestMenuMakesMusic()
        {
            WorkingBeatmap beatmap() => Game.Beatmap.Value;
            Track track() => beatmap().Track;

            TestSongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new TestSongSelect());

            AddUntilStep("wait for no track", () => track() is TrackVirtual);

            AddStep("return to menu", () => songSelect.Exit());

            AddUntilStep("wait for track", () => !(track() is TrackVirtual) && track().IsRunning);
        }
Ejemplo n.º 5
0
        public void TestExitSongSelectWithClick()
        {
            TestSongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new TestSongSelect());
            AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
            AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
            AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));

            // BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered.
            AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == Game.BackButton));

            AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
            AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
            exitViaBackButtonAndConfirm();
        }
Ejemplo n.º 6
0
        public void TestBeatmapOptionsInput()
        {
            TestSongSelect songSelect = null;

            PushAndConfirm(() => songSelect = new TestSongSelect());

            AddStep("Show options overlay", () => songSelect.BeatmapOptionsOverlay.Show());

            AddStep("Change ruleset to osu!taiko", () =>
            {
                InputManager.PressKey(Key.ControlLeft);
                InputManager.Key(Key.Number2);
                InputManager.ReleaseKey(Key.ControlLeft);
            });

            AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType <ToolbarRulesetSelector>().Single().Current.Value.ID == 1);

            AddAssert("Options overlay still visible", () => songSelect.BeatmapOptionsOverlay.State.Value == Visibility.Visible);
        }
Ejemplo n.º 7
0
        private void load()
        {
            TestSongSelect songSelect = null;

            factory = new DatabaseContextFactory(LocalStorage);
            factory.ResetDatabase();

            using (var usage = factory.Get())
                usage.Migrate();

            Dependencies.Cache(rulesets = new RulesetStore(factory));
            Dependencies.Cache(manager  = new BeatmapManager(LocalStorage, factory, rulesets, null, null)
            {
                DefaultBeatmap = defaultBeatmap = Beatmap.Default
            });

            void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () =>
            {
                if (deleteMaps)
                {
                    manager.Delete(manager.GetAllUsableBeatmapSets());
                    Beatmap.SetDefault();
                }

                if (songSelect != null)
                {
                    Remove(songSelect);
                    songSelect.Dispose();
                }

                Add(songSelect = new TestSongSelect());
            });

            loadNewSongSelect(true);

            AddWaitStep(3);

            AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);

            AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap);

            AddStep("import test maps", () =>
            {
                for (int i = 0; i < 100; i += 10)
                {
                    manager.Import(createTestBeatmapSet(i));
                }
            });

            AddWaitStep(3);
            AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);

            loadNewSongSelect();
            AddWaitStep(3);
            AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);

            AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
Ejemplo n.º 8
0
 public virtual void SetUp()
 {
     manager?.Delete(manager.GetAllUsableBeatmapSets());
     Child = songSelect = new TestSongSelect();
 }
Ejemplo n.º 9
0
 private void createSongSelect()
 {
     AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
     AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
     AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
 }
Ejemplo n.º 10
0
        private void load(OsuGameBase game)
        {
            TestSongSelect songSelect = null;

            var storage = new TestStorage(@"TestCasePlaySongSelect");

            // this is by no means clean. should be replacing inside of OsuGameBase somehow.
            var context = new OsuDbContext();

            Func <OsuDbContext> contextFactory = () => context;

            dependencies.Cache(rulesets = new RulesetStore(contextFactory));
            dependencies.Cache(manager  = new BeatmapManager(storage, contextFactory, rulesets, null)
            {
                DefaultBeatmap = defaultBeatmap = game.Beatmap.Default
            });

            void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () =>
            {
                if (deleteMaps)
                {
                    manager.DeleteAll();
                    game.Beatmap.SetDefault();
                }

                if (songSelect != null)
                {
                    Remove(songSelect);
                    songSelect.Dispose();
                }

                Add(songSelect = new TestSongSelect());
            });

            loadNewSongSelect(true);

            AddWaitStep(3);

            AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);

            AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap);

            AddStep("import test maps", () =>
            {
                for (int i = 0; i < 100; i += 10)
                {
                    manager.Import(createTestBeatmapSet(i));
                }
            });

            AddWaitStep(3);
            AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);

            loadNewSongSelect();
            AddWaitStep(3);
            AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);

            AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
            AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
            AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
            AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
        }
Ejemplo n.º 11
0
 private void createSongSelect()
 {
     AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
     AddUntilStep(() => songSelect.IsCurrentScreen(), "wait for present");
 }