From 364c3bca06122e0c04ed72240cd9a379381df19b Mon Sep 17 00:00:00 2001
From: smoogipoo <smoogipoo@smgi.me>
Date: Wed, 4 Apr 2018 16:24:03 +0900
Subject: [PATCH 1/2] Fix osu!catch autoplay missing starts/ends of
 JuiceStreams

Fixes #2328.

Would only happen when ticks and ends were spaced too far apart (or there were no ticks in a juicestream).
---
 .../TestCaseJuiceStream.cs                    | 62 +++++++++++++++++++
 .../Replays/CatchAutoGenerator.cs             |  1 +
 2 files changed, 63 insertions(+)
 create mode 100644 osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs

diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs
new file mode 100644
index 0000000000..0af60cc452
--- /dev/null
+++ b/osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs
@@ -0,0 +1,62 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System.Collections.Generic;
+using System.Linq;
+using osu.Game.Beatmaps;
+using osu.Game.Rulesets.Catch.Objects;
+using osu.Game.Rulesets.Catch.UI;
+using osu.Game.Rulesets.Objects.Types;
+using osu.Game.Screens.Play;
+using osu.Game.Tests.Visual;
+using OpenTK;
+
+namespace osu.Game.Rulesets.Catch.Tests
+{
+    public class TestCaseJuiceStream : TestCasePlayer
+    {
+        public TestCaseJuiceStream()
+            : base(new CatchRuleset())
+        {
+        }
+
+        protected override Beatmap CreateBeatmap(Ruleset ruleset)
+        {
+            var beatmap = new Beatmap
+            {
+                BeatmapInfo = new BeatmapInfo
+                {
+                    BaseDifficulty = new BeatmapDifficulty { CircleSize = 6, SliderMultiplier = 3 },
+                    Ruleset = ruleset.RulesetInfo
+                }
+            };
+
+            for (int i = 0; i < 100; i++)
+            {
+                float width = (i % 10 + 1) / 20f;
+
+                beatmap.HitObjects.Add(new JuiceStream
+                {
+                    X = 0.5f - width / 2,
+                    ControlPoints = new List<Vector2>
+                    {
+                        Vector2.Zero,
+                        new Vector2(width * CatchPlayfield.BASE_WIDTH, 0)
+                    },
+                    CurveType = CurveType.Linear,
+                    Distance = width * CatchPlayfield.BASE_WIDTH,
+                    StartTime = i * 2000,
+                    NewCombo = i % 8 == 0
+                });
+            }
+
+            return beatmap;
+        }
+
+        protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
+        {
+            beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
+            return base.CreatePlayer(beatmap, ruleset);
+        }
+    }
+}
diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
index f1503a14ee..244ab2b508 100644
--- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
+++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs
@@ -108,6 +108,7 @@ namespace osu.Game.Rulesets.Catch.Replays
                         case BananaShower.Banana _:
                         case TinyDroplet _:
                         case Droplet _:
+                        case Fruit _:
                             moveToNext(nestedObj);
                             break;
                     }

From e69951b59f63769397da87caeec84e3cae6c2221 Mon Sep 17 00:00:00 2001
From: Dean Herbert <pe@ppy.sh>
Date: Wed, 4 Apr 2018 18:48:19 +0900
Subject: [PATCH 2/2] Rename test to signify it's got auto enabled

---
 .../{TestCaseJuiceStream.cs => TestCaseAutoJuiceStream.cs}    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename osu.Game.Rulesets.Catch.Tests/{TestCaseJuiceStream.cs => TestCaseAutoJuiceStream.cs} (92%)

diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
similarity index 92%
rename from osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs
rename to osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
index 0af60cc452..11a22c69f3 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestCaseJuiceStream.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
@@ -13,9 +13,9 @@ using OpenTK;
 
 namespace osu.Game.Rulesets.Catch.Tests
 {
-    public class TestCaseJuiceStream : TestCasePlayer
+    public class TestCaseAutoJuiceStream : TestCasePlayer
     {
-        public TestCaseJuiceStream()
+        public TestCaseAutoJuiceStream()
             : base(new CatchRuleset())
         {
         }