-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
142 lines (102 loc) · 5.05 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/env python
# -*- encoding: utf-8 -*-
################################################################################
## TexPack test suite
################################################################################
import texpack
import unittest
################################################################################
class DirTest(unittest.TestCase):
def test_dirs(self):
texpack.main("test/test_dirs_", "test-sprites")
class GlobTest(unittest.TestCase):
def test_glob_gif(self):
texpack.main("test/test_glob_gif_", "test-sprites/*.gif")
def test_glob_jpg(self):
texpack.main("test/test_glob_jpg_", "test-sprites/*.jpg")
def test_glob_noth_gif(self):
texpack.main("test/test_glob_noth_gif_", "test-sprites/[!h]*.gif")
class MaskTest(unittest.TestCase):
def test_mask_default(self):
texpack.main("test/test_mask_default_", "test-sprites", "--mask")
def test_mask_hexcode(self):
texpack.main("test/test_mask_hexcode_", "test-sprites", "--mask=#fff")
def test_mask_cssname(self):
texpack.main("test/test_mask_cssname_", "test-sprites", "--mask=white")
class TrimTest(unittest.TestCase):
def test_trim(self):
texpack.main("test/test_trim_", "test-sprites", "--trim")
class AliasTest(unittest.TestCase):
def test_alias_default(self):
texpack.main("test/test_alias_default_", "test-sprites", "--alias")
def test_alias_custom(self):
texpack.main("test/test_alias_custom_", "test-sprites", "--alias=0.5")
class ExtrudeTest(unittest.TestCase):
def test_extrude_default(self):
texpack.main("test/test_extrude_default_", "test-sprites", "--extrude")
def test_extrude_custom(self):
texpack.main("test/test_extrude_custom_", "test-sprites", "--extrude=4")
class PadTest(unittest.TestCase):
def test_pad_default(self):
texpack.main("test/test_pad_default_", "test-sprites", "--pad")
def test_pad_custom(self):
texpack.main("test/test_pad_custom_", "test-sprites", "--pad=4")
class SortTest(unittest.TestCase):
def test_sort_default(self):
with self.assertRaises(SystemExit): # "expected argument"
texpack.main("test/test_sort_default_", "test-sprites", "--sort")
def test_sort_width(self):
texpack.main("test/test_sort_width_", "test-sprites", "--sort=width")
def test_sort_height(self):
texpack.main("test/test_sort_height_", "test-sprites", "--sort=height")
def test_sort_area(self):
texpack.main("test/test_sort_area_", "test-sprites", "--sort=area")
def test_sort_name(self):
texpack.main("test/test_sort_name_", "test-sprites", "--sort=name")
class LayoutTest(unittest.TestCase):
def test_layout_default(self):
with self.assertRaises(SystemExit): # "expected argument"
texpack.main("test/test_layout_default_", "test-sprites", "--layout")
def test_layout_shelf(self):
texpack.main("test/test_layout_shelf_", "test-sprites", "--layout=shelf")
def test_layout_stack(self):
texpack.main("test/test_layout_stack_", "test-sprites", "--layout=stack")
def test_layout_maxrects(self):
texpack.main("test/test_layout_maxrects_", "test-sprites", "--layout=max-rects")
@unittest.expectedFailure # remove when implemented
def test_layout_skyline(self):
texpack.main("test/test_layout_skyline_", "test-sprites", "--layout=skyline")
class RotateTest(unittest.TestCase):
def test_rotate(self):
texpack.main("test/test_rotate_", "test-sprites", "--rotate")
class NpotTest(unittest.TestCase):
def test_npot(self):
texpack.main("test/test_npot_", "test-sprites", "--npot")
class SquareTest(unittest.TestCase):
def test_square(self):
texpack.main("test/test_square_", "test-sprites", "--square")
class MinSizeTest(unittest.TestCase):
def test_minsize_default(self):
with self.assertRaises(SystemExit): # "expected argument"
texpack.main("test/test_minsize_default_", "test-sprites", "--min-size")
def test_minsize_custom(self):
texpack.main("test/test_minsize_custom_", "test-sprites", "--min-size=4096")
class MaxSizeTest(unittest.TestCase):
def test_maxsize_default(self):
with self.assertRaises(SystemExit): # "expected argument"
texpack.main("test/test_maxsize_default_", "test-sprites", "--max-size")
def test_maxsize_custom(self):
texpack.main("test/test_maxsize_custom_", "test-sprites", "--max-size=1024")
class ScaleTest(unittest.TestCase):
def test_scale(self):
texpack.main("test/test_scale_", "test-sprites", "--scale")
class CompressTest(unittest.TestCase):
def test_compress(self):
texpack.main("test/test_compress_", "test-sprites", "--compress")
################################################################################
if __name__ == '__main__':
import sys
unittest.main(*sys.argv[1:])
################################################################################
## EOF
################################################################################