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