Skip to content

Commit 52dad38

Browse files
committed
test update
1 parent edfc2f6 commit 52dad38

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

‎tests/test_main.py‎

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
import os
2+
import UnityPy
3+
from PIL import Image
24
SAMPLES = os.path.join(os.path.dirname(os.path.abspath(__file__)), "samples")
35

46

5-
def test_import():
6-
import UnityPy
7-
8-
97
def test_read():
10-
import UnityPy
118
for f in os.listdir(SAMPLES):
12-
am = UnityPy.AssetsManager(os.path.join(SAMPLES, f))
13-
for asset in am.assets.values():
14-
for obj in asset.objects.values():
15-
obj.read()
9+
env = UnityPy.load(os.path.join(SAMPLES, f))
10+
for obj in env.objects:
11+
obj.read()
1612

1713

1814
def test_texture2d():
1915
import UnityPy
2016
for f in os.listdir(SAMPLES):
21-
am = UnityPy.AssetsManager(os.path.join(SAMPLES, f))
22-
for asset in am.assets.values():
23-
for obj in asset.objects.values():
24-
if obj.type == "Texture2D":
25-
obj.read().image.save("test.png")
17+
env = UnityPy.load(os.path.join(SAMPLES, f))
18+
for obj in env.objects:
19+
if obj.type == "Texture2D":
20+
data = obj.read()
21+
data.image.save("test.png")
22+
data.image = data.image.transpose(Image.ROTATE_90)
23+
data.save()
2624

2725

2826
def test_sprite():
2927
import UnityPy
3028
for f in os.listdir(SAMPLES):
31-
am = UnityPy.AssetsManager(os.path.join(SAMPLES, f))
32-
for asset in am.assets.values():
33-
for obj in asset.objects.values():
34-
if obj.type == "Sprite":
35-
obj.read().image.save("test.png")
29+
env = UnityPy.load(os.path.join(SAMPLES, f))
30+
for obj in env.objects:
31+
if obj.type == "Sprite":
32+
obj.read().image.save("test.png")
3633

3734

3835
def test_audioclip():

0 commit comments

Comments
 (0)