2017-05-03 16:13:08 +08:00
|
|
|
import _init_path
|
2017-01-02 21:54:08 -05:00
|
|
|
|
|
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
|
|
from labelImg import get_main_app
|
|
|
|
|
|
2017-05-03 16:13:08 +08:00
|
|
|
from pascal_voc_io import PascalVocWriter
|
|
|
|
|
from pascal_voc_io import PascalVocReader
|
|
|
|
|
|
2017-01-02 21:54:08 -05:00
|
|
|
|
|
|
|
|
class TestMainWindow(TestCase):
|
|
|
|
|
|
|
|
|
|
app = None
|
|
|
|
|
win = None
|
|
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
|
self.app, self.win = get_main_app()
|
|
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
|
self.win.close()
|
|
|
|
|
self.app.quit()
|
|
|
|
|
|
|
|
|
|
def test_noop(self):
|
|
|
|
|
pass
|
2017-05-03 16:13:08 +08:00
|
|
|
|
|
|
|
|
# Test Write/Read
|
|
|
|
|
writer = PascalVocWriter('tests', 'test', (512, 512, 1), localImgPath='tests/test.bmp')
|
|
|
|
|
difficult = 1
|
|
|
|
|
writer.addBndBox(60, 40, 430, 504, 'person', difficult)
|
|
|
|
|
writer.addBndBox(113, 40, 450, 403, 'face', difficult)
|
|
|
|
|
writer.save('tests/test.xml')
|
|
|
|
|
|
|
|
|
|
reader = PascalVocReader('tests/test.xml')
|
|
|
|
|
shapes = reader.getShapes()
|