Skip to content

Commit 4f60547

Browse files
docs: testing section added
1 parent 1a8b1b7 commit 4f60547

File tree

4 files changed

+122
-81
lines changed

4 files changed

+122
-81
lines changed

README.md

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,89 @@
11
# XCoder - easy to use modding tool
2+
23
Multiplatform modding tool for ANY Supercell\`s game.
34

45
## About
5-
Work with Supercell\`s files on **any** os! SC and CSV are supported for all Supercell\`s games.
6+
7+
Work with Supercell\`s files on **any** os! SC and CSV are supported for all
8+
Supercell\`s games.
69

710
### Features:
11+
812
- SC compile / decompile;
913
- Compression and decompression.
1014

1115
### How to install and use
16+
1217
- On Windows:
13-
- Download Python 3.7 or newer version from [official page](https://www.python.org/downloads/);
14-
- Install Python. While Installing, enable such parameters as "Add Python to PATH", "Install pip", "Install py launcher", "Associate files with Python" and "Add Python to environment variables";
15-
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
16-
- Locate the extracted directory and install required modules:
17-
```pip install -r requirements.txt```;
18-
- Execute "main.py" file.
18+
- Download Python 3.7 or newer version
19+
from [official page](https://www.python.org/downloads/);
20+
- Install Python. While Installing, enable such parameters as "Add Python to
21+
PATH", "Install pip", "Install py launcher", "Associate files with Python" and "
22+
Add Python to environment variables";
23+
- Download XCoder from
24+
the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
25+
- Locate the extracted directory and install required modules:
26+
```pip install -r requirements.txt```;
27+
- Execute "main.py" file.
1928

2029
- On Linux:
21-
- Open Terminal and install Python by executing following command:
22-
```sudo apt-get update && sudo apt-get install python3 python3-pip```;
23-
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
24-
- Locate the extracted directory and install required modules by executing following command:
25-
```sudo pip3 install -r requirements.txt```;
26-
- Execute "main.py" file.
30+
- Open Terminal and install Python by executing following command:
31+
```sudo apt-get update && sudo apt-get install python3 python3-pip```;
32+
- Download XCoder from
33+
the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
34+
- Locate the extracted directory and install required modules by executing following
35+
command:
36+
```sudo pip3 install -r requirements.txt```;
37+
- Execute "main.py" file.
2738

2839
- On Android:
29-
- Download and install PyDroid app from [Google Play](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3);
30-
- Open PyDroid and wait until Python installs;
31-
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
32-
- Install loguru using pip;
33-
- In PyDroid open and execute "main.py" file.
40+
- Download and install PyDroid app
41+
from [Google Play](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3);
42+
- Open PyDroid and wait until Python installs;
43+
- Download XCoder from
44+
the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
45+
- Install loguru using pip;
46+
- In PyDroid open and execute "main.py" file.
47+
48+
### Testing
49+
50+
The project supports unit-testing using the unittest module. To run tests by yourself, you can use the command:
51+
52+
```cmd
53+
python -m unittest
54+
```
55+
56+
or
57+
58+
```sh
59+
python3 -m unittest
60+
```
61+
62+
or using the poetry
63+
64+
```sh
65+
poetry run python -m unittest
66+
```
3467

3568
### How to enable KTX section
3669

37-
![KTX section demo](docs/KTX section.png)
70+
![KTX section demo](docs/KTX%20section.png)
3871

39-
**Supercell also uses KTX textures in new versions of the games, so it is advisable to perform this step.**
72+
**Supercell also uses KTX textures in new versions of the games, so it is advisable to
73+
perform this step.**
4074

41-
To enable the KTX module, you need to get the "PVRTexToolCLI" binary from the official site: https://developer.imaginationtech.com/pvrtextool/.
75+
To enable the KTX module, you need to get the "PVRTexToolCLI" binary from the official
76+
site: https://developer.imaginationtech.com/pvrtextool/.
4277

4378
Then it is necessary to put CLI in "system/bin/" folder in the main script folder.
4479

4580
### In the plans:
81+
4682
- CSV updating.
4783

4884
## Credits
49-
This tool is based on Original [XCoder](https://github.com/MasterDevX/xcoder), Developer: [MasterDevX](https://github.com/MasterDevX)</br>
85+
86+
This tool is based on Original [XCoder](https://github.com/MasterDevX/xcoder),
87+
Developer: [MasterDevX](https://github.com/MasterDevX)</br>
5088

5189
Many thanks to [spiky_Spike](https://github.com/spiky-s) for the provided developments

tests/__init__.py

Whitespace-only changes.

tests/polygon_test.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/test_polygon.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from unittest import TestCase
2+
3+
from system.lib.math.point import Point
4+
from system.lib.math.polygon import PointOrder, Polygon, get_polygon_point_order
5+
6+
7+
def create_polygon_from_tuple(*polygon: tuple[float, float]) -> Polygon:
8+
return [Point(x, y) for x, y in polygon]
9+
10+
11+
class PolygonTestCase(TestCase):
12+
def test_clockwise_square(self):
13+
polygon = create_polygon_from_tuple(
14+
(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)
15+
)
16+
17+
self.assertEqual(PointOrder.CLOCKWISE, get_polygon_point_order(polygon))
18+
19+
def test_clockwise_real1(self):
20+
polygon = create_polygon_from_tuple(
21+
(4.0, 4.0), (5.0, -2.0), (-1.0, -4.0), (-6.0, 0.0), (-2.0, 5.0), (0.0, 1.0)
22+
)
23+
24+
self.assertEqual(PointOrder.CLOCKWISE, get_polygon_point_order(polygon))
25+
26+
def test_clockwise_real2(self):
27+
polygon = create_polygon_from_tuple(
28+
(160.0, -73.0),
29+
(89.0, -73.0),
30+
(89.0, -10.0),
31+
(143.0, 10.0),
32+
(156.0, 10.0),
33+
(160.0, -46.0),
34+
)
35+
36+
self.assertEqual(PointOrder.CLOCKWISE, get_polygon_point_order(polygon))
37+
38+
def test_counter_clockwise_real1(self):
39+
polygon = create_polygon_from_tuple(
40+
(5.0, 0.0), (6.0, 4.0), (4.0, 5.0), (1.0, 5.0), (1.0, 0.0)
41+
)
42+
43+
self.assertEqual(PointOrder.COUNTER_CLOCKWISE, get_polygon_point_order(polygon))
44+
45+
def test_counter_clockwise_real2(self):
46+
polygon = create_polygon_from_tuple(
47+
(0.0, 0.0), (11.0, 0.0), (0.0, 10.0), (10.0, 10.0)
48+
)
49+
50+
self.assertEqual(PointOrder.COUNTER_CLOCKWISE, get_polygon_point_order(polygon))
51+
52+
def test_counter_clockwise_real3(self):
53+
polygon = create_polygon_from_tuple(
54+
(20.0, -73.0),
55+
(91.0, -73.0),
56+
(91.0, -10.0),
57+
(37.0, 10.0),
58+
(24.0, 10.0),
59+
(20.0, -46.0),
60+
)
61+
62+
self.assertEqual(PointOrder.COUNTER_CLOCKWISE, get_polygon_point_order(polygon))

0 commit comments

Comments
 (0)