Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Finished editor testing
Browse files Browse the repository at this point in the history
  • Loading branch information
megamaz committed Nov 24, 2020
1 parent ad1b874 commit 081a6af
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -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
* [ ] Animator.editTrack
100 changes: 100 additions & 0 deletions test_editor.py
Original file line number Diff line number Diff line change
@@ -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
]
]
}
}

0 comments on commit 081a6af

Please sign in to comment.