#!/usr/bin/env python import unittest import os import math from argaze.ArUcoMarkers import ArUcoScene import cv2 as cv import numpy class TestArUcoSceneClass(unittest.TestCase): """Test ArUcoScene class.""" def test_new(self): """Test ArUcoScene creation.""" # Edit file path current_directory = os.path.dirname(os.path.abspath(__file__)) obj_filepath = os.path.join(current_directory, 'utils/scene.obj') # Load file aruco_scene = ArUcoScene.ArUcoScene(1, obj_filepath) # Check ArUcoScene creation self.assertEqual(len(aruco_scene.places), 2) self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.identifiers, [0, 1])) self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#0'].translation, [0.5, 0.5, 0.])) self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#0'].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#1'].translation, [10.5, 10.5, 0.])) self.assertIsNone(numpy.testing.assert_array_equal(aruco_scene.places['DICT_ARUCO_ORIGINAL#1'].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) if __name__ == '__main__': unittest.main()