-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.10.0' into 'main'
Release/v0.10.0 See merge request momentfactory/products/xagora/omniverse/kit-exts-ndi!44
- Loading branch information
Showing
14 changed files
with
533 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .test_USDtools import * | ||
from .test_model import * | ||
from .test_NDItools import * | ||
from .test_ui import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import omni.kit.test | ||
from ..NDItools import NDIData | ||
from .test_utils import SOURCE1 | ||
|
||
|
||
class NDIDataUnitTest(omni.kit.test.AsyncTestCase): | ||
async def test_source(self): | ||
data = NDIData(SOURCE1, False) | ||
self.assertEqual(data.get_source(), SOURCE1) | ||
|
||
async def test_active(self): | ||
data = NDIData(SOURCE1) | ||
self.assertFalse(data.is_active()) | ||
|
||
data = NDIData(SOURCE1, False) | ||
self.assertFalse(data.is_active()) | ||
|
||
data = NDIData(SOURCE1, True) | ||
self.assertTrue(data.is_active()) | ||
|
||
data.set_active(False) | ||
self.assertFalse(data.is_active()) | ||
|
||
data.set_active(True) | ||
self.assertTrue(data.is_active()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import omni.kit.test | ||
from ..USDtools import USDtools | ||
from .test_utils import make_stage, close_stage, create_dynamic_material, create_dynamic_rectlight, SOURCE1 | ||
|
||
|
||
class USDValidNameUnitTest(omni.kit.test.AsyncTestCase): | ||
async def test_name_valid(self): | ||
self.check_name_valid("myDynamicMaterial", "myDynamicMaterial") | ||
self.check_name_valid("789testing123numbers456", "_89testing123numbers456") | ||
self.check_name_valid("", "_") | ||
self.check_name_valid("àâáäãåÀÂÁÃÅÄ", "aaaaaaAAAAAA") | ||
self.check_name_valid("èêéëÈÊÉË", "eeeeEEEE") | ||
self.check_name_valid("ìîíïÌÎÍÏ", "iiiiIIII") | ||
self.check_name_valid("òôóöõøÒÔÓÕÖØ", "ooooooOOOOOO") | ||
self.check_name_valid("ùûúüÙÛÚÜ", "uuuuUUUU") | ||
self.check_name_valid("æœÆŒçÇ°ðÐñÑýÝþÞÿß", "aeoeAEOEcCdegdDnNyYthThyss") | ||
self.check_name_valid("!¡¿@#$%?&*()-_=+/`^~.,'\\<>`;:¤{}[]|\"¦¨«»¬¯±´·¸÷", | ||
"___________________________________________________") | ||
self.check_name_valid("¢£¥§©ªº®¹²³µ¶¼½¾×", "C_PSY_SS_c_ao_r_123uP_1_4_1_2_3_4x") | ||
|
||
def check_name_valid(self, source, expected): | ||
v: str = USDtools.make_name_valid(source) | ||
self.assertEqual(v, expected, f"Expected \"{v}\", derived from \"{source}\", to equals \"{expected}\"") | ||
|
||
|
||
class USDToolsUnitTest(omni.kit.test.AsyncTestCase): | ||
def setUp(self): | ||
self._stage = make_stage() | ||
|
||
def tearDown(self): | ||
close_stage() | ||
|
||
async def test_create_dynamic_material(self): | ||
material = create_dynamic_material() | ||
prim = self._stage.GetPrimAtPath(material.GetPath()) | ||
self.assertIsNotNone(prim) | ||
|
||
async def test_find_dynamic_sources(self): | ||
create_dynamic_material() | ||
create_dynamic_rectlight() | ||
|
||
sources = USDtools.find_all_dynamic_sources() | ||
self.assertEqual(len(sources), 2) | ||
|
||
async def test_set_property_ndi(self): | ||
material = create_dynamic_material() | ||
path = material.GetPath() | ||
USDtools.set_prim_ndi_attribute(path, SOURCE1) | ||
|
||
attr = material.GetPrim().GetAttribute(USDtools.ATTR_NDI_NAME) | ||
self.assertEqual(attr.Get(), SOURCE1) | ||
|
||
async def test_set_property_bandwidth(self): | ||
material = create_dynamic_material() | ||
path = material.GetPath() | ||
USDtools.set_prim_bandwidth_attribute(path, True) | ||
|
||
attr = material.GetPrim().GetAttribute(USDtools.ATTR_BANDWIDTH_NAME) | ||
self.assertTrue(attr.Get()) | ||
|
||
USDtools.set_prim_bandwidth_attribute(path, False) | ||
self.assertFalse(attr.Get()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import omni.kit.test | ||
from ..NDItools import NDIData | ||
from ..model import NDIBinding, NDIModel | ||
from ..USDtools import USDtools | ||
from ..comboboxModel import ComboboxModel | ||
from .test_utils import SOURCE1, SOURCE2, DYNAMIC_ID1, DYNAMIC_ID2, DUMMY_PATH | ||
|
||
|
||
class NDIBindingsUnitTest(omni.kit.test.AsyncTestCase): | ||
async def test_dynamic_id(self): | ||
ndi_data = NDIData(SOURCE1) | ||
ndi_binding = NDIBinding(DYNAMIC_ID1, ndi_data, DUMMY_PATH, False) | ||
|
||
self.assertEqual(ndi_binding.get_id(), DYNAMIC_ID1) | ||
self.assertEqual(ndi_binding.get_id_full(), USDtools.PREFIX + DYNAMIC_ID1) | ||
|
||
async def test_source(self): | ||
ndi_data1 = NDIData(SOURCE1) | ||
ndi_data2 = NDIData(SOURCE2) | ||
|
||
ndi_binding = NDIBinding(DYNAMIC_ID1, ndi_data1, DUMMY_PATH, False) | ||
self.assertEqual(ndi_binding.get_source(), SOURCE1) | ||
|
||
ndi_binding.set_ndi_id(ndi_data2) | ||
self.assertEqual(ndi_binding.get_source(), SOURCE2) | ||
|
||
async def test_lowbandwidth(self): | ||
ndi_data = NDIData(SOURCE1) | ||
ndi_binding = NDIBinding(DYNAMIC_ID1, ndi_data, DUMMY_PATH, False) | ||
self.assertFalse(ndi_binding.get_lowbandwidth()) | ||
|
||
ndi_binding = NDIBinding(DYNAMIC_ID1, ndi_data, DUMMY_PATH, True) | ||
self.assertTrue(ndi_binding.get_lowbandwidth()) | ||
|
||
ndi_binding.set_lowbandwidth(False) | ||
self.assertFalse(ndi_binding.get_lowbandwidth()) | ||
ndi_binding.set_lowbandwidth(True) | ||
self.assertTrue(ndi_binding.get_lowbandwidth()) | ||
pass | ||
|
||
|
||
class ModelUnitTest(omni.kit.test.AsyncTestCase): | ||
def setUp(self): | ||
self._model = NDIModel(None) | ||
|
||
def tearDown(self): | ||
self._model.on_shutdown() | ||
|
||
async def test_no_stream_at_start(self): | ||
streams_length = len(self._model._streams) | ||
self.assertEqual(streams_length, 0) | ||
|
||
async def test_add_stream_NONE(self): | ||
streams_base_length = len(self._model._streams) | ||
|
||
self._model.add_stream(DYNAMIC_ID1, ComboboxModel.NONE_VALUE, False) | ||
self.assertEqual(len(self._model._streams), streams_base_length) | ||
|
||
async def test_add_stream_PROXY(self): | ||
streams_length = len(self._model._streams) | ||
|
||
self._model.add_stream(DYNAMIC_ID1, ComboboxModel.PROXY_VALUE, False) | ||
self.assertEqual(len(self._model._streams), streams_length + 1) | ||
|
||
async def test_kill_all_streams(self): | ||
self._model.add_stream(DYNAMIC_ID1, ComboboxModel.PROXY_VALUE, False) | ||
self._model.add_stream(DYNAMIC_ID2, ComboboxModel.PROXY_VALUE, False) | ||
self.assertGreater(len(self._model._streams), 0) | ||
|
||
self._model.kill_all_streams() | ||
self.assertEqual(len(self._model._streams), 0) | ||
|
||
async def test_remove_stream(self): | ||
self._model.add_stream(DYNAMIC_ID1, ComboboxModel.PROXY_VALUE, False) | ||
self._model.add_stream(DYNAMIC_ID2, ComboboxModel.PROXY_VALUE, False) | ||
streams_length = len(self._model._streams) | ||
self.assertGreater(streams_length, 0) | ||
|
||
self._model.remove_stream(DYNAMIC_ID1, ComboboxModel.PROXY_VALUE) | ||
self.assertEqual(len(self._model._streams), streams_length - 1) | ||
self._model.remove_stream(DYNAMIC_ID1, ComboboxModel.PROXY_VALUE) | ||
self.assertEqual(len(self._model._streams), streams_length - 1) | ||
self._model.remove_stream(DYNAMIC_ID2, ComboboxModel.PROXY_VALUE) | ||
self.assertEqual(len(self._model._streams), streams_length - 2) | ||
|
||
|
||
""" | ||
async def test_add_stream(self): | ||
model = NDIModel(None) | ||
streams_length = len(model._streams) | ||
model.add_stream(DYNAMIC_ID, SOURCE1, False) | ||
self.assertEqual(len(model._streams), streams_length + 1) | ||
model.add_stream(DYNAMIC_ID, SOURCE2, False) | ||
self.assertEqual(len(model._streams), streams_length + 2) | ||
""" |
Oops, something went wrong.