-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathtest_pngtosvg.py
29 lines (24 loc) · 1.04 KB
/
test_pngtosvg.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
import os
import unittest
from handwrite.pngtosvg import PNGtoSVG
class TestPNGtoSVG(unittest.TestCase):
def setUp(self):
self.directory = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"test_data" + os.sep + "pngtosvg",
)
self.converter = PNGtoSVG()
def test_bmpToSvg(self):
self.converter.bmpToSvg(self.directory + os.sep + "45.bmp")
self.assertTrue(os.path.exists(self.directory + os.sep + "45.svg"))
os.remove(self.directory + os.sep + "45.svg")
def test_convert(self):
self.converter.convert(self.directory)
path = os.walk(self.directory)
for root, dirs, files in path:
for f in files:
if f[-4:] == ".png":
self.assertTrue(os.path.exists(root + os.sep + f[0:-4] + ".bmp"))
self.assertTrue(os.path.exists(root + os.sep + f[0:-4] + ".svg"))
os.remove(root + os.sep + f[0:-4] + ".bmp")
os.remove(root + os.sep + f[0:-4] + ".svg")