Esempio n. 1
0
        public async Task TestImportWithBeatmaps()
        {
            using (HeadlessGameHost host = new CleanRunHeadlessGameHost())
            {
                try
                {
                    var osu = LoadOsuIntoHost(host, true);

                    await importCollectionsFromStream(osu, TestResources.OpenResource("Collections/collections.db"));

                    Assert.That(osu.CollectionManager.Collections.Count, Is.EqualTo(2));

                    Assert.That(osu.CollectionManager.Collections[0].Name.Value, Is.EqualTo("First"));
                    Assert.That(osu.CollectionManager.Collections[0].Beatmaps.Count, Is.EqualTo(1));

                    Assert.That(osu.CollectionManager.Collections[1].Name.Value, Is.EqualTo("Second"));
                    Assert.That(osu.CollectionManager.Collections[1].Beatmaps.Count, Is.EqualTo(12));
                }
                finally
                {
                    host.Exit();
                }
            }
        }
Esempio n. 2
0
        public void TestDecodeBeatmapGeneral()
        {
            var decoder = new LegacyBeatmapDecoder {
                ApplyOffsets = false
            };

            using (var resStream = TestResources.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
                using (var stream = new LineBufferedReader(resStream))
                {
                    var beatmap     = decoder.Decode(stream);
                    var beatmapInfo = beatmap.BeatmapInfo;
                    var metadata    = beatmap.Metadata;

                    Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", metadata.AudioFile);
                    Assert.AreEqual(0, beatmapInfo.AudioLeadIn);
                    Assert.AreEqual(164471, metadata.PreviewTime);
                    Assert.IsFalse(beatmapInfo.Countdown);
                    Assert.AreEqual(0.7f, beatmapInfo.StackLeniency);
                    Assert.IsTrue(beatmapInfo.RulesetID == 0);
                    Assert.IsFalse(beatmapInfo.LetterboxInBreaks);
                    Assert.IsFalse(beatmapInfo.SpecialStyle);
                    Assert.IsFalse(beatmapInfo.WidescreenStoryboard);
                }
        }
Esempio n. 3
0
        public void TestDecodeBeatmapTimingPoints()
        {
            var decoder = new LegacyBeatmapDecoder {
                ApplyOffsets = false
            };

            using (var resStream = TestResources.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
                using (var stream = new LineBufferedReader(resStream))
                {
                    var beatmap       = decoder.Decode(stream);
                    var controlPoints = beatmap.ControlPointInfo;

                    Assert.AreEqual(4, controlPoints.TimingPoints.Count);
                    Assert.AreEqual(5, controlPoints.DifficultyPoints.Count);
                    Assert.AreEqual(34, controlPoints.SamplePoints.Count);
                    Assert.AreEqual(8, controlPoints.EffectPoints.Count);

                    var timingPoint = controlPoints.TimingPointAt(0);
                    Assert.AreEqual(956, timingPoint.Time);
                    Assert.AreEqual(329.67032967033, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    timingPoint = controlPoints.TimingPointAt(48428);
                    Assert.AreEqual(956, timingPoint.Time);
                    Assert.AreEqual(329.67032967033d, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    timingPoint = controlPoints.TimingPointAt(119637);
                    Assert.AreEqual(119637, timingPoint.Time);
                    Assert.AreEqual(659.340659340659, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    var difficultyPoint = controlPoints.DifficultyPointAt(0);
                    Assert.AreEqual(0, difficultyPoint.Time);
                    Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);

                    difficultyPoint = controlPoints.DifficultyPointAt(48428);
                    Assert.AreEqual(0, difficultyPoint.Time);
                    Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);

                    difficultyPoint = controlPoints.DifficultyPointAt(116999);
                    Assert.AreEqual(116999, difficultyPoint.Time);
                    Assert.AreEqual(0.75, difficultyPoint.SpeedMultiplier, 0.1);

                    var soundPoint = controlPoints.SamplePointAt(0);
                    Assert.AreEqual(956, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(60, soundPoint.SampleVolume);

                    soundPoint = controlPoints.SamplePointAt(53373);
                    Assert.AreEqual(53373, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(60, soundPoint.SampleVolume);

                    soundPoint = controlPoints.SamplePointAt(119637);
                    Assert.AreEqual(119637, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(80, soundPoint.SampleVolume);

                    var effectPoint = controlPoints.EffectPointAt(0);
                    Assert.AreEqual(0, effectPoint.Time);
                    Assert.IsFalse(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);

                    effectPoint = controlPoints.EffectPointAt(53703);
                    Assert.AreEqual(53703, effectPoint.Time);
                    Assert.IsTrue(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);

                    effectPoint = controlPoints.EffectPointAt(119637);
                    Assert.AreEqual(95901, effectPoint.Time);
                    Assert.IsFalse(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);
                }
        }
Esempio n. 4
0
        public void TestDecodeStoryboardEvents()
        {
            var decoder = new LegacyStoryboardDecoder();

            using (var resStream = TestResources.OpenResource("Himeringo - Yotsuya-san ni Yoroshiku (RLC) [Winber1's Extreme].osu"))
                using (var stream = new StreamReader(resStream))
                {
                    var storyboard = decoder.Decode(stream);

                    Assert.IsTrue(storyboard.HasDrawable);
                    Assert.AreEqual(4, storyboard.Layers.Count());

                    StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
                    Assert.IsNotNull(background);
                    Assert.AreEqual(16, background.Elements.Count());
                    Assert.IsTrue(background.EnabledWhenFailing);
                    Assert.IsTrue(background.EnabledWhenPassing);
                    Assert.AreEqual("Background", background.Name);

                    StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
                    Assert.IsNotNull(fail);
                    Assert.AreEqual(0, fail.Elements.Count());
                    Assert.IsTrue(fail.EnabledWhenFailing);
                    Assert.IsFalse(fail.EnabledWhenPassing);
                    Assert.AreEqual("Fail", fail.Name);

                    StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
                    Assert.IsNotNull(pass);
                    Assert.AreEqual(0, pass.Elements.Count());
                    Assert.IsFalse(pass.EnabledWhenFailing);
                    Assert.IsTrue(pass.EnabledWhenPassing);
                    Assert.AreEqual("Pass", pass.Name);

                    StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
                    Assert.IsNotNull(foreground);
                    Assert.AreEqual(151, foreground.Elements.Count());
                    Assert.IsTrue(foreground.EnabledWhenFailing);
                    Assert.IsTrue(foreground.EnabledWhenPassing);
                    Assert.AreEqual("Foreground", foreground.Name);

                    int spriteCount    = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
                    int animationCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardAnimation));
                    int sampleCount    = background.Elements.Count(x => x.GetType() == typeof(StoryboardSample));

                    Assert.AreEqual(15, spriteCount);
                    Assert.AreEqual(1, animationCount);
                    Assert.AreEqual(0, sampleCount);
                    Assert.AreEqual(background.Elements.Count(), spriteCount + animationCount + sampleCount);

                    var sprite = background.Elements.ElementAt(0) as StoryboardSprite;
                    Assert.NotNull(sprite);
                    Assert.IsTrue(sprite.HasCommands);
                    Assert.AreEqual(new Vector2(320, 240), sprite.InitialPosition);
                    Assert.IsTrue(sprite.IsDrawable);
                    Assert.AreEqual(Anchor.Centre, sprite.Origin);
                    Assert.AreEqual("SB/lyric/ja-21.png", sprite.Path);

                    var animation = background.Elements.ElementAt(12) as StoryboardAnimation;
                    Assert.NotNull(animation);
                    Assert.AreEqual(141175, animation.EndTime);
                    Assert.AreEqual(10, animation.FrameCount);
                    Assert.AreEqual(30, animation.FrameDelay);
                    Assert.IsTrue(animation.HasCommands);
                    Assert.AreEqual(new Vector2(320, 240), animation.InitialPosition);
                    Assert.IsTrue(animation.IsDrawable);
                    Assert.AreEqual(AnimationLoopType.LoopForever, animation.LoopType);
                    Assert.AreEqual(Anchor.Centre, animation.Origin);
                    Assert.AreEqual("SB/red jitter/red_0000.jpg", animation.Path);
                    Assert.AreEqual(78993, animation.StartTime);
                }
        }
Esempio n. 5
0
 public void TestRegularVideoFile()
 {
     using (var resourceStream = TestResources.OpenResource("Videos/test-video.mp4"))
         Assert.IsEmpty(check.Run(getContext(resourceStream)));
 }
Esempio n. 6
0
        private void load()
        {
            var imported = skins.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-skin.osk"))).GetResultSafely();

            skin = imported.PerformRead(skinInfo => skins.GetSkin(skinInfo));
        }
        private void load()
        {
            var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result;

            beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
        }
Esempio n. 8
0
        private void load()
        {
            var imported = skins.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-skin.osk"))).Result;

            skin = skins.GetSkin(imported);
        }