test_ovis.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python
  2. import os
  3. import numpy as np
  4. import cv2 as cv
  5. from tests_common import NewOpenCVTests
  6. #from unittest import TestCase as NewOpenCVTests
  7. class ovis_contrib_test(NewOpenCVTests):
  8. def setUp(self):
  9. super().setUp()
  10. # use software rendering
  11. os.environ["OPENCV_OVIS_RENDERSYSTEM"] = "Tiny Rendering Subsystem"
  12. # in case something goes wrong
  13. os.environ["OPENCV_OVIS_VERBOSE_LOG"] = "1"
  14. def test_multiWindow(self):
  15. win0 = cv.ovis.createWindow("main", (1, 1))
  16. win1 = cv.ovis.createWindow("other", (1, 1))
  17. del win1
  18. win1 = cv.ovis.createWindow("other", (1, 1))
  19. del win1
  20. def test_addResourceLocation(self):
  21. win0 = cv.ovis.createWindow("main", (1, 1))
  22. with self.assertRaises(cv.error):
  23. # must be called before the first createWindow
  24. cv.ovis.addResourceLocation(".")
  25. def test_texStride(self):
  26. win = cv.ovis.createWindow("main", (1, 1))
  27. data = np.zeros((200, 200), dtype=np.uint8)
  28. cv.ovis.createPlaneMesh("plane", (1, 1), data[50:-50, 50:-50])
  29. if __name__ == '__main__':
  30. NewOpenCVTests.bootstrap()