## Copyright (c) 2022, 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.test
import omni.kit.app
from omni.kit.test import AsyncTestCase


import omni.splash

class TestSplash(AsyncTestCase):
    async def setUp(self):
        self._splash_iface = omni.splash.acquire_splash_screen_interface()

    async def tearDown(self):
        pass

    async def test_001_close_autocreated(self):
        # This test just closes the automatically created by the extension on startup
        self._splash_iface.close_all()

    async def test_002_create_destroy_splash(self):
        splash = self._splash_iface.create("${resources}/splash/splash.png", 1.0)
        self._splash_iface.show(splash)

        for _ in range(3):
            await omni.kit.app.get_app().next_update_async()

        self.assertTrue(self._splash_iface.is_valid(splash))

        for _ in range(3):
            await omni.kit.app.get_app().next_update_async()

        self._splash_iface.close(splash)
