Skip to content

Commit

Permalink
Add shift note test, load actual mapping scene
Browse files Browse the repository at this point in the history
  • Loading branch information
Top-Cat committed Nov 28, 2020
1 parent 3b8e43c commit 77d7c78
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Assets/StandaloneFileBrowser/FileBrowser.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "FileBrowser"
}
7 changes: 7 additions & 0 deletions Assets/StandaloneFileBrowser/FileBrowser.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 51 additions & 1 deletion Assets/Tests/NotesContainerTest.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
using NUnit.Framework;
using SimpleJSON;
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;

namespace Tests
{
public class NotesContainerTest
{
private GameObject prefab = Resources.Load<GameObject>("Unassigned Note");

[UnityOneTimeSetUp]
public IEnumerator LoadMap()
{
yield return SceneManager.LoadSceneAsync("00_FirstBoot", LoadSceneMode.Single);
yield return new WaitUntil(() => SceneManager.GetActiveScene().buildIndex == 1 && !SceneTransitionManager.IsLoading);
BeatSaberSongContainer.Instance.song = new BeatSaberSong("testmap", new JSONObject());
var parentSet = new BeatSaberSong.DifficultyBeatmapSet();
var diff = new BeatSaberSong.DifficultyBeatmap(parentSet);
diff.customData = new JSONObject();
BeatSaberSongContainer.Instance.difficultyData = diff;
BeatSaberSongContainer.Instance.loadedSong = AudioClip.Create("MySinusoid", 44100 * 2, 1, 44100, false);
SceneTransitionManager.Instance.LoadScene(3);
yield return new WaitUntil(() => !SceneTransitionManager.IsLoading);
}

[Test]
public void TestRefreshSpecialAngles()
public void RefreshSpecialAngles()
{
var notesContainer = new NotesContainer();

Expand Down Expand Up @@ -111,6 +130,37 @@ public void TestRefreshSpecialAngles()
Assert.AreEqual(45, containerB.transform.localEulerAngles.z, 0.01);
}

[Test]
public void ShiftInTime()
{
var notesContainer = BeatmapObjectContainerCollection.GetCollectionForType(BeatmapObject.Type.NOTE);
var root = notesContainer.transform.root;

var noteA = new BeatmapNote
{
_time = 2,
_type = BeatmapNote.NOTE_TYPE_A
};
notesContainer.SpawnObject(noteA);

var noteB = new BeatmapNote
{
_time = 3,
_type = BeatmapNote.NOTE_TYPE_A
};
notesContainer.SpawnObject(noteB);

SelectionController.Select(noteB, false, false, false);

var selectionController = root.GetComponentInChildren<SelectionController>();
selectionController.MoveSelection(-2);

notesContainer.DeleteObject(noteB);

Assert.AreEqual(1, notesContainer.LoadedContainers.Count);
Assert.AreEqual(1, notesContainer.LoadedObjects.Count);
}

private void UpdateNote(BeatmapNoteContainer container, int lineIndex, int lineLayer, int cutDirection)
{
var note = (BeatmapNote)container.objectData;
Expand Down
3 changes: 2 additions & 1 deletion Assets/Tests/Tests.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Main"
"Main",
"Plugins"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
3 changes: 2 additions & 1 deletion Assets/__Scripts/Main.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"GUID:84651a3751eca9349aac36a66bba901b",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:60083a2e5e01f99429a2c948694aedb2"
"GUID:60083a2e5e01f99429a2c948694aedb2",
"GUID:d7c2e603c9eb62f43b862f903baad500"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
8 changes: 7 additions & 1 deletion Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"com.unity.multiplayer-hlapi": "1.0.4",
"com.unity.purchasing": "2.0.6",
"com.unity.render-pipelines.universal": "7.3.1",
"com.unity.test-framework": "1.1.14",
"com.unity.test-framework": "https://github.com/DanStevens/com.unity.test-framework.git",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.10",
"com.unity.ugui": "1.0.0",
Expand Down Expand Up @@ -49,5 +49,11 @@
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"lock": {
"com.unity.test-framework": {
"revision": "HEAD",
"hash": "37b8628b4d59a73516d9f39628877d89b8f14212"
}
}
}

0 comments on commit 77d7c78

Please sign in to comment.