From 081a6af227950ac1272b94c1af735d0b912c3ee7 Mon Sep 17 00:00:00 2001 From: megamaz <44149188+megamaz@users.noreply.github.com> Date: Mon, 23 Nov 2020 21:14:22 -0800 Subject: [PATCH] Finished editor testing --- README.md | 17 +++++++-- test_editor.py | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 test_editor.py diff --git a/README.md b/README.md index a03581d..bf0cb29 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,17 @@ Just go in the releases tab and download the latest version. ## Extra notes: - Made entirely in python - Pull requests are appreciated. Someone needs to fix up my horid code. +## Samples +```py +from noodle_extensions import Editor, Animator + +editor = Editor("YourLevel.datPath") +animator = Animator(editor) + +# Animations can go here. +# Basic position animation (that does nothing) +animator.animate("AnimateTrack", "_position", [[0, 0]], "DummyTrach", 0, 3) +``` ## Current Issues: *There are currently no known issues.* @@ -37,8 +48,8 @@ Just go in the releases tab and download the latest version. * [X] Editor.editWall * [X] Editor.getBlock * [X] Editor.getWall -* [ ] Editor.editEvent -* [ ] Animator.animate +* [X] Editor.removeEvent +* [X] Animator.animate * [ ] Animator.animateBlock * [ ] Animator.animateWall -* [ ] Animator.editTrack \ No newline at end of file +* [ ] Animator.editTrack diff --git a/test_editor.py b/test_editor.py new file mode 100644 index 0000000..acf7a63 --- /dev/null +++ b/test_editor.py @@ -0,0 +1,100 @@ +import sys + +from noodle_extensions import Editor, Animator +from noodle_extensions.constants import EventType, Animations + +editor = Editor(r"C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\CustomWIPLevels\ExampleLevel\EasyStandard.dat") +animator = Animator(editor) + + +def test_createDummyEvent(): + animator.animate("AnimateTrack", "_position", [[0, 0]], "DummyTrach", 0, 3) + assert True +def test_UpdateReqs(): + assert "Noodle Extensions" in editor.updateDependencies("Noodle Extensions") + +def test_editNote(): + beat = 14 + pos = (2,0) + track = "TestTrack" + assert editor.editBlock(beat, pos, track) == { + "_time": 14, + "_lineIndex": 2, + "_lineLayer": 0, + "_type": 1, + "_cutDirection": 1, + "_customData" : { + "_track":track, + "_fake":False, + "_interactable":True + } + } +def test_editWall(): + beat = 18 + length = 18+6 # start beat + length of wall + index = 3 + assert editor.editWall(beat, length, index, "TestTrack") == { + + "_time": 18, + "_lineIndex": 3, + "_type": 0, + "_duration": 6, + "_width": 1, + "_customData": { + "_track": "TestTrack", + "_fake": False, + "_interactable": True + } + } + +def test_getBlock(): + beat = 14 + pos = (2,0) + track = "TestTrack" + block = editor.getBlock(beat, pos) + assert block == { + "_time": 14, + "_lineIndex": 2, + "_lineLayer": 0, + "_type": 1, + "_cutDirection": 1, + "_customData" : { + "_track":track, + "_fake":False, + "_interactable":True + } + } + +def test_getWall(): + beat = 18 + length = 18+6 # start beat + length of wall + index = 3 + wall = editor.getWall(beat, index, length) + assert wall == { + "_time": 18, + "_lineIndex": 3, + "_type": 0, + "_duration": 6, + "_width": 1, + "_customData": { + "_track": "TestTrack", + "_fake": False, + "_interactable": True + } + } + +def test_removeEvent(): + assert editor.removeEvent(0, "AnimateTrack", "DummyTrach") == { + "_time": 0, + "_type": "AnimateTrack", + "_data": { + "_track": "DummyTrach", + "_duration": 3, + "_position": [ + [ + 0, + 0 + ] + ] + } + } \ No newline at end of file