from omni.ui.tests.test_base import OmniUiTest
from pathlib import Path
import omni.ui as ui

from ..extension import register_page, _extension_instance as welcome_instance

CURRENT_PATH = Path(__file__).parent
TEST_DATA_PATH = CURRENT_PATH.parent.parent.parent.parent.parent.joinpath("data").joinpath("tests")


class TestWelcomeWindow(OmniUiTest):
    # Before running each test
    async def setUp(self):
        await super().setUp()

        self._golden_img_dir = TEST_DATA_PATH.absolute().joinpath("golden_img").absolute()

        # Register page build function
        register_page("omni.kit.welcome.window", self.__build_ui)

        # Show window
        self._window = welcome_instance._window
        self._window.visible = True

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

    async def test_window(self):
        await self.docked_test_window(window=self._window, width=1280, height=720, block_devices=False)
        await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="window.png")

    def __build_ui(self):
        with ui.VStack():
            ui.Label("PLACE PAGE WIDGETS HERE!", height=0)