diff --git a/tests/data/ b/tests/data/ new file mode 100644 index 0000000..7224d4b Binary files /dev/null and b/tests/data/ differ diff --git a/tests/data/example1_labels.json b/tests/data/example1_labels.json new file mode 100644 index 0000000..47c9fb9 --- /dev/null +++ b/tests/data/example1_labels.json @@ -0,0 +1,33 @@ +[ + { + "type": "image", + "annotations": [ + { + "height": 60.0, + "width": 46.0, + "y": 105.0, + "x": 346.0, + "type": "rect" + }, + { + "height": 58.0, + "width": 56.0, + "y": 119.0, + "x": 636.0, + "type": "rect" + } + ], + "filename": "image1.jpg" + }, + { + "type": "image", + "annotations": [ + { + "y": 155.0, + "x": 409.0, + "type": "point" + } + ], + "filename": "image2.jpg" + } +] diff --git a/tests/data/image1.jpg b/tests/data/image1.jpg new file mode 100644 index 0000000..7224d4b Binary files /dev/null and b/tests/data/image1.jpg differ diff --git a/tests/data/image2.jpg b/tests/data/image2.jpg new file mode 100644 index 0000000..9eeb6d5 Binary files /dev/null and b/tests/data/image2.jpg differ diff --git a/tests/data/test.jpg b/tests/data/test.jpg new file mode 100644 index 0000000..c66f8b7 Binary files /dev/null and b/tests/data/test.jpg differ diff --git a/tests/model_test.py b/tests/model_test.py new file mode 100644 index 0000000..7d0158b --- /dev/null +++ b/tests/model_test.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +import os, sys +from PyQt4.QtGui import QApplication +from sloth.gui import MainWindow +from sloth.core.labeltool import LabelTool +from sloth import APP_NAME, ORGANIZATION_NAME, ORGANIZATION_DOMAIN +from pymodeltest.modeltest import ModelTest + +SAMPLE_DATA = os.path.join(os.path.dirname(__file__), 'data', 'example1_labels.json') + +if __name__ == '__main__': + app = QApplication(sys.argv) + app.setOrganizationName(ORGANIZATION_NAME) + app.setOrganizationDomain(ORGANIZATION_DOMAIN) + app.setApplicationName(APP_NAME) + + labeltool = LabelTool() + if len(sys.argv) < 2: + sys.argv.append(SAMPLE_DATA) + labeltool.execute_from_commandline(sys.argv) + labeltool.modeltest = ModelTest(labeltool._model, labeltool) + + wnd = MainWindow(labeltool) + labeltool._mainwindow = wnd + wnd.show() + + sys.exit(app.exec_())