## Copyright (c) 2021, NVIDIA CORPORATION.  All rights reserved.
##
## NVIDIA CORPORATION and its licensors retain all intellectual property
## and proprietary rights in and to this software, related documentation
## and any modifications thereto.  Any use, reproduction, disclosure or
## distribution of this software and related documentation without an express
## license agreement from NVIDIA CORPORATION is strictly prohibited.
##
import omni.kit.app
import omni.kit.commands
import omni.kit.test
import omni.ui as ui
from omni.kit import ui_test
from omni.ui.tests.test_base import OmniUiTest
from omni.kit.test_suite.helpers import open_stage, get_test_data_path, select_prims, wait_stage_loading, arrange_windows


class TestLayerAudioWidget(OmniUiTest):  # pragma: no cover
    # Before running each test
    async def setUp(self):
        await super().setUp()
        await arrange_windows("Layer")

        from omni.kit.property.audio.scripts.audio_properties import TEST_DATA_PATH
        self._usd_path = TEST_DATA_PATH.absolute()

        usd_context = omni.usd.get_context()
        test_file_path = self._usd_path.joinpath("audio_test.usda").absolute()
        usd_context.open_stage(str(test_file_path))

    # After running each test
    async def tearDown(self):
        await super().tearDown()

    async def test_layer_sound_ui(self):
        await ui_test.find("Layer").focus()
        await ui_test.find("Layer//Frame/**/TreeView[*]").find(f"**/Label[*].text=='Root Layer (Authoring Layer)'").click()
        await ui_test.human_delay(50)
