aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test
diff options
context:
space:
mode:
authorThéo de la Hogue2022-11-29 11:08:53 +0100
committerThéo de la Hogue2022-11-29 11:08:53 +0100
commit0d58e3af1188a1e571c592f69c5289e5e477bb68 (patch)
tree4f18abfdc7c7486ec6a4cb4059271e727b2add4b /src/argaze.test
parentd1198a4627d6c6b523577abe6948430f553c12fa (diff)
downloadargaze-0d58e3af1188a1e571c592f69c5289e5e477bb68.zip
argaze-0d58e3af1188a1e571c592f69c5289e5e477bb68.tar.gz
argaze-0d58e3af1188a1e571c592f69c5289e5e477bb68.tar.bz2
argaze-0d58e3af1188a1e571c592f69c5289e5e477bb68.tar.xz
Adding new ArGazeProject class and its unitary test.
Diffstat (limited to 'src/argaze.test')
-rw-r--r--src/argaze.test/ArGazeProject.py31
-rw-r--r--src/argaze.test/utils/project.json36
2 files changed, 67 insertions, 0 deletions
diff --git a/src/argaze.test/ArGazeProject.py b/src/argaze.test/ArGazeProject.py
new file mode 100644
index 0000000..f37e1f5
--- /dev/null
+++ b/src/argaze.test/ArGazeProject.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import unittest
+import os
+
+from argaze import ArGazeProject
+
+
+class TestArGazeProjectClass(unittest.TestCase):
+ """Test ArGazeProject class."""
+
+ def test_from_json(self):
+ """Test ArGazeProject creation from json file."""
+
+ # Edit project file path
+ current_directory = os.path.dirname(os.path.abspath(__file__))
+ json_filepath = os.path.join(current_directory, 'utils/project.json')
+
+ # Load project
+ argaze_project = ArGazeProject.ArGazeProject.from_json(json_filepath)
+
+ # Check project meta data
+ self.assertEqual(argaze_project.name, "TestProject")
+
+ # Check ArUco camera
+ print(argaze_project.aruco_camera)
+ self.assertEqual(argaze_project.aruco_camera.rms, 0.)
+
+if __name__ == '__main__':
+
+ unittest.main() \ No newline at end of file
diff --git a/src/argaze.test/utils/project.json b/src/argaze.test/utils/project.json
new file mode 100644
index 0000000..96c644b
--- /dev/null
+++ b/src/argaze.test/utils/project.json
@@ -0,0 +1,36 @@
+{
+ "name": "TestProject",
+ "aruco_camera": {
+ "rms": 0.0,
+ "dimensions": [
+ 1920,
+ 1080
+ ],
+ "K": [
+ [
+ 1.0,
+ 0.0,
+ 1.0
+ ],
+ [
+ 0.0,
+ 1.0,
+ 1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ "D": [
+ [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ ]
+ }
+} \ No newline at end of file