示例#1
0
        public void TestClear()
        {
            var cpi = new LegacyControlPointInfo();

            cpi.Add(0, new TimingControlPoint());
            cpi.Add(1000, new TimingControlPoint {
                BeatLength = 500
            });
            cpi.Add(10000, new TimingControlPoint {
                BeatLength = 200
            });
            cpi.Add(5000, new TimingControlPoint {
                BeatLength = 100
            });
            cpi.Add(3000, new DifficultyControlPoint {
                SliderVelocity = 2
            });
            cpi.GroupAt(7000, true).Add(new DifficultyControlPoint {
                SliderVelocity = 4
            });
            cpi.GroupAt(1000).Add(new SampleControlPoint {
                SampleVolume = 0
            });
            cpi.GroupAt(8000, true).Add(new EffectControlPoint {
                KiaiMode = true
            });

            cpi.Clear();

            Assert.That(cpi.Groups.Count, Is.EqualTo(0));
            Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(0));
            Assert.That(cpi.AllControlPoints.Count, Is.EqualTo(0));
        }
示例#2
0
        public void TestOrdering()
        {
            var cpi = new LegacyControlPointInfo();

            cpi.Add(0, new TimingControlPoint());
            cpi.Add(1000, new TimingControlPoint {
                BeatLength = 500
            });
            cpi.Add(10000, new TimingControlPoint {
                BeatLength = 200
            });
            cpi.Add(5000, new TimingControlPoint {
                BeatLength = 100
            });
            cpi.Add(3000, new DifficultyControlPoint {
                SliderVelocity = 2
            });
            cpi.GroupAt(7000, true).Add(new DifficultyControlPoint {
                SliderVelocity = 4
            });
            cpi.GroupAt(1000).Add(new SampleControlPoint {
                SampleVolume = 0
            });
            cpi.GroupAt(8000, true).Add(new EffectControlPoint {
                KiaiMode = true
            });

            Assert.That(cpi.AllControlPoints.Count, Is.EqualTo(8));

            Assert.That(cpi.Groups, Is.Ordered.Ascending.By(nameof(ControlPointGroup.Time)));

            Assert.That(cpi.AllControlPoints, Is.Ordered.Ascending.By(nameof(ControlPoint.Time)));
            Assert.That(cpi.TimingPoints, Is.Ordered.Ascending.By(nameof(ControlPoint.Time)));
        }
示例#3
0
        public void TestAddControlPointToGroup()
        {
            var cpi = new LegacyControlPointInfo();

            var group = cpi.GroupAt(1000, true);

            Assert.That(cpi.Groups.Count, Is.EqualTo(1));

            // usually redundant, but adding to group forces it to be added
            group.Add(new DifficultyControlPoint());

            Assert.That(group.ControlPoints.Count, Is.EqualTo(1));
            Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(1));
        }
示例#4
0
        public void TestRemoveGroupAlsoRemovedControlPoints()
        {
            var cpi = new LegacyControlPointInfo();

            var group = cpi.GroupAt(1000, true);

            group.Add(new SampleControlPoint());

            Assert.That(cpi.SamplePoints.Count, Is.EqualTo(1));

            cpi.RemoveGroup(group);

            Assert.That(cpi.SamplePoints.Count, Is.EqualTo(0));
        }
示例#5
0
        public void TestRemoveControlPointFromGroup()
        {
            var cpi = new LegacyControlPointInfo();

            var group = cpi.GroupAt(1000, true);

            Assert.That(cpi.Groups.Count, Is.EqualTo(1));

            var difficultyPoint = new DifficultyControlPoint();

            group.Add(difficultyPoint);
            group.Remove(difficultyPoint);

            Assert.That(group.ControlPoints.Count, Is.EqualTo(0));
            Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(0));
            Assert.That(cpi.AllControlPoints.Count, Is.EqualTo(0));
        }
示例#6
0
        public void TestAddDuplicateControlPointToGroup()
        {
            var cpi = new LegacyControlPointInfo();

            var group = cpi.GroupAt(1000, true);

            Assert.That(cpi.Groups.Count, Is.EqualTo(1));

            group.Add(new DifficultyControlPoint());
            group.Add(new DifficultyControlPoint {
                SliderVelocity = 2
            });

            Assert.That(group.ControlPoints.Count, Is.EqualTo(1));
            Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(1));
            Assert.That(cpi.DifficultyPoints.First().SliderVelocity, Is.EqualTo(2));
        }