3
0

hydra_AtomEditorComponents_SkyAtmosphereAdded.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. class Tests:
  7. sky_atmosphere_creation = (
  8. "Sky AtmosphereEntity successfully created",
  9. "P0: Sky AtmosphereEntity failed to be created")
  10. sky_atmosphere_component = (
  11. "Entity has a Sky Atmosphere component",
  12. "P0: Entity failed to find Sky Atmosphere component")
  13. sky_atmosphere_component_removal = (
  14. "Sky Atmosphere component successfully removed",
  15. "P0: Sky Atmosphere component failed to be removed")
  16. removal_undo = (
  17. "UNDO Sky Atmosphere component removal success",
  18. "P0: UNDO Sky Atmosphere component removal failed")
  19. sky_atmosphere_disabled = (
  20. "Sky Atmosphere component disabled",
  21. "P0: Sky Atmosphere component was not disabled")
  22. sky_atmosphere_enabled = (
  23. "Sky Atmosphere component enabled",
  24. "P0: Sky Atmosphere component was not enabled")
  25. ground_albedo = (
  26. "Ground albedo property set",
  27. "P1: 'Ground albedo' property failed to set")
  28. ground_radius = (
  29. "Ground radius property set",
  30. "P1: 'Ground radius' property failed to set")
  31. atmosphere_height = (
  32. "Atmosphere height property set",
  33. "P1: 'Atmosphere height' property failed to set")
  34. illuminance_factor = (
  35. "Illuminance factor property set",
  36. "P1: 'Illuminance factor' property failed to set")
  37. mie_absorption_scale = (
  38. "Mie absorption Scale property set",
  39. "P1: 'Mie absorption Scale' property failed to set")
  40. mie_absorption = (
  41. "Mie absorption property set",
  42. "P1: 'Mie absorption' property failed to set")
  43. mie_exponential_distribution = (
  44. "Mie exponential distribution property set",
  45. "P1: 'Mie exponential distribution' property failed to set")
  46. mie_scattering_scale = (
  47. "Mie scattering Scale property set",
  48. "P1: 'Mie scattering Scale' property failed to set")
  49. mie_scattering = (
  50. "Mie scattering property set",
  51. "P1: 'Mie scattering' property failed to set")
  52. ozone_absorption_scale = (
  53. "Ozone Absorption Scale property set",
  54. "P1: 'Ozone Absorption Scale' property failed to set")
  55. ozone_absorption = (
  56. "Ozone Absorption property set",
  57. "P1: 'Ozone Absorption' property failed to set")
  58. rayleigh_exponential_distribution = (
  59. "Rayleigh exponential distribution property set",
  60. "P1: 'Rayleigh exponential distribution' property failed to set")
  61. rayleigh_scattering_scale = (
  62. "Rayleigh scattering Scale property set",
  63. "P1: 'Rayleigh scattering Scale' property failed to set")
  64. rayleigh_scattering = (
  65. "Rayleigh scattering property set",
  66. "P1: 'Rayleigh scattering' property failed to set")
  67. show_sun = (
  68. "Show sun property set",
  69. "P1: 'Show sun' property failed to set")
  70. sun_color = (
  71. "Sun color property set",
  72. "P1: 'Sun color' property failed to set")
  73. sun_falloff_factor = (
  74. "Sun falloff factor property set",
  75. "P1: 'Sun falloff factor' property failed to set")
  76. sun_limb_color = (
  77. "Sun limb color property set",
  78. "P1: 'Sun limb color' property failed to set")
  79. sun_luminance_factor = (
  80. "Sun luminance factor property set",
  81. "P1: 'Sun luminance factor' property failed to set")
  82. sun_orientation = (
  83. "Sun orientation property set",
  84. "P1: 'Sun orientation' property failed to set")
  85. sun_radius_factor = (
  86. "Sun radius factor property set",
  87. "P1: 'Sun radius factor' property failed to set")
  88. enable_shadows = (
  89. "Enable shadows property set",
  90. "P1: 'Enable shadows' property failed to set")
  91. fast_sky = (
  92. "Fast sky property set",
  93. "P1: 'Fast sky' property failed to set")
  94. max_samples = (
  95. "Max samples property set",
  96. "P1: 'Max samples' property failed to set")
  97. min_samples = (
  98. "Min samples property set",
  99. "P1: 'Min samples' property failed to set")
  100. near_clip = (
  101. "Near Clip property set",
  102. "P1: 'Near Clip' property failed to set")
  103. near_fade_distance = (
  104. "Near Fade Distance property set",
  105. "P1: 'Near Fade Distance' property failed to set")
  106. enter_game_mode = (
  107. "Entered game mode",
  108. "P0: Failed to enter game mode")
  109. exit_game_mode = (
  110. "Exited game mode",
  111. "P0: Couldn't exit game mode")
  112. is_visible = (
  113. "Entity is visible",
  114. "P0: Entity was not visible")
  115. is_hidden = (
  116. "Entity is hidden",
  117. "P0: Entity was not hidden")
  118. entity_deleted = (
  119. "Entity deleted",
  120. "P0: Entity was not deleted")
  121. deletion_undo = (
  122. "UNDO deletion success",
  123. "P0: UNDO deletion failed")
  124. deletion_redo = (
  125. "REDO deletion success",
  126. "P0: REDO deletion failed")
  127. def AtomEditorComponents_SkyAtmosphere_AddedToEntity():
  128. """
  129. Summary:
  130. Tests the Sky Atmosphere component can be added to an entity and has the expected functionality.
  131. Test setup:
  132. - Wait for Editor idle loop.
  133. - Open the "Base" level.
  134. Expected Behavior:
  135. The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
  136. Creation and deletion undo/redo should also work.
  137. Test Steps:
  138. 1) Create an Sky Atmosphere entity with no components.
  139. 2) Add Sky Atmosphere component to Sky Atmosphere entity.
  140. 3) Remove the Sky Atmosphere component.
  141. 4) Undo Sky Atmosphere component removal.
  142. 5) Verify Sky Atmosphere component is enabled.
  143. 6) Set a value for 'Ground albedo' property
  144. 7) Set a value for 'Ground radius' property
  145. 8) Set a value for 'Origin' property
  146. 9) Set a value for 'Atmosphere height' property
  147. 10) Set a value for 'Illuminance factor' property
  148. 11) Set a value for 'Mie absorption Scale' property
  149. 12) Set a value for 'Mie absorption' property
  150. 13) Set a value for 'Mie exponential distribution' property
  151. 14) Set a value for 'Mie scattering Scale' property
  152. 15) Set a value for 'Mie scattering' property
  153. 16) Set a value for 'Ozone Absorption Scale' property
  154. 17) Set a value for 'Ozone Absorption' property
  155. 18) Set a value for 'Rayleigh exponential distribution' property
  156. 19) Set a value for 'Rayleigh scattering Scale' property
  157. 20) Set a value for 'Rayleigh scattering' property
  158. 21) Set a value for 'Show sun' property
  159. 22) Set a value for 'Sun color' property
  160. 23) Set a value for 'Sun falloff factor' property
  161. 24) Set a value for 'Sun limb color' property
  162. 25) Set a value for 'Sun luminance factor' property
  163. 26) Set a value for 'Sun orientation' property
  164. 27) Set a value for 'Sun radius factor' property
  165. 28) Set a value for 'Enable shadows' property
  166. 29) Set a value for 'Fast sky' property
  167. 30) Set a value for 'Max samples' property
  168. 31) Set a value for 'Min samples' property
  169. 32) Set a value for 'Near Clip' property
  170. 33) Set a value for 'Near Fade Distance' property
  171. 34) Enter/Exit game mode.
  172. 35) Test IsHidden.
  173. 36) Test IsVisible.
  174. 37) Delete Sky Atmosphere entity.
  175. 38) UNDO deletion.
  176. 39) REDO deletion.
  177. 40) Look for errors and asserts.
  178. :return: None
  179. """
  180. import azlmbr.legacy.general as general
  181. from azlmbr.math import Vector3, Color
  182. from editor_python_test_tools.editor_entity_utils import EditorEntity
  183. from editor_python_test_tools.wait_utils import PrefabWaiter
  184. from editor_python_test_tools.utils import Report, Tracer, TestHelper
  185. from Atom.atom_utils.atom_constants import AtomComponentProperties, ATMOSPHERE_ORIGIN
  186. with Tracer() as error_tracer:
  187. # Test setup begins.
  188. # Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
  189. TestHelper.init_idle()
  190. TestHelper.open_level("Graphics", "base_empty")
  191. # Test steps begin.
  192. # 1. Create an Sky Atmosphere entity with no components.
  193. sky_atmosphere_entity = EditorEntity.create_editor_entity(AtomComponentProperties.sky_atmosphere())
  194. Report.critical_result(Tests.sky_atmosphere_creation, sky_atmosphere_entity.exists())
  195. # 2. Add Sky Atmosphere component to Sky Atmosphere entity.
  196. sky_atmosphere_component = sky_atmosphere_entity.add_component(AtomComponentProperties.sky_atmosphere())
  197. Report.critical_result(Tests.sky_atmosphere_component,
  198. sky_atmosphere_entity.has_component(AtomComponentProperties.sky_atmosphere()))
  199. # 3. Remove the Sky Atmosphere component.
  200. sky_atmosphere_component.remove()
  201. PrefabWaiter.wait_for_propagation()
  202. Report.critical_result(Tests.sky_atmosphere_component_removal,
  203. not sky_atmosphere_entity.has_component(AtomComponentProperties.sky_atmosphere()))
  204. # 4. Undo Sky Atmosphere component removal.
  205. general.undo()
  206. PrefabWaiter.wait_for_propagation()
  207. Report.result(Tests.removal_undo,
  208. sky_atmosphere_entity.has_component(AtomComponentProperties.sky_atmosphere()))
  209. # 5. Verify Sky Atmosphere component is enabled.
  210. Report.result(Tests.sky_atmosphere_enabled, sky_atmosphere_component.is_enabled())
  211. # 6. Set a value for 'Ground albedo' property
  212. sky_atmosphere_component.set_component_property_value(
  213. AtomComponentProperties.sky_atmosphere('Ground albedo'), Vector3(0.0, 1.0, 0.0))
  214. Report.result(
  215. Tests.ground_albedo,
  216. sky_atmosphere_component.get_component_property_value(
  217. AtomComponentProperties.sky_atmosphere('Ground albedo')) == Vector3(0.0, 1.0, 0.0))
  218. # 7. Set a value for 'Ground radius' property
  219. sky_atmosphere_component.set_component_property_value(
  220. AtomComponentProperties.sky_atmosphere('Ground radius'), 100000.0)
  221. Report.result(
  222. Tests.ground_radius,
  223. sky_atmosphere_component.get_component_property_value(
  224. AtomComponentProperties.sky_atmosphere('Ground radius')) == 100000.0)
  225. # 8. Set a value for 'Origin' property
  226. for origin_type in ATMOSPHERE_ORIGIN:
  227. test_origin = (
  228. f"Origin property set to {origin_type}",
  229. f"P1: 'Origin' property failed to set {origin_type}")
  230. sky_atmosphere_component.set_component_property_value(
  231. AtomComponentProperties.sky_atmosphere('Origin'), ATMOSPHERE_ORIGIN[origin_type])
  232. Report.result(
  233. test_origin,
  234. sky_atmosphere_component.get_component_property_value(
  235. AtomComponentProperties.sky_atmosphere('Origin')) == ATMOSPHERE_ORIGIN[origin_type])
  236. sky_atmosphere_component.set_component_property_value(
  237. AtomComponentProperties.sky_atmosphere('Origin'), ATMOSPHERE_ORIGIN['GroundAtWorldOrigin'])
  238. # 9. Set a value for 'Atmosphere height' property
  239. sky_atmosphere_component.set_component_property_value(
  240. AtomComponentProperties.sky_atmosphere('Atmosphere height'), 10000.0)
  241. Report.result(
  242. Tests.atmosphere_height,
  243. sky_atmosphere_component.get_component_property_value(
  244. AtomComponentProperties.sky_atmosphere('Atmosphere height')) == 10000.0)
  245. # 10. Set a value for 'Illuminance factor' property
  246. sky_atmosphere_component.set_component_property_value(
  247. AtomComponentProperties.sky_atmosphere('Illuminance factor'), Vector3(100.0,100.0,100.0))
  248. Report.result(
  249. Tests.illuminance_factor,
  250. sky_atmosphere_component.get_component_property_value(
  251. AtomComponentProperties.sky_atmosphere('Illuminance factor')) == Vector3(100.0,100.0,100.0))
  252. # 11. Set a value for 'Mie absorption Scale' property
  253. sky_atmosphere_component.set_component_property_value(
  254. AtomComponentProperties.sky_atmosphere('Mie absorption scale'), 1.0)
  255. Report.result(
  256. Tests.mie_absorption_scale,
  257. sky_atmosphere_component.get_component_property_value(
  258. AtomComponentProperties.sky_atmosphere('Mie absorption scale')) == 1.0)
  259. # 12. Set a value for 'Mie absorption' property
  260. sky_atmosphere_component.set_component_property_value(
  261. AtomComponentProperties.sky_atmosphere('Mie absorption'), Vector3(0.5,0.0,0.5))
  262. Report.result(
  263. Tests.mie_absorption,
  264. sky_atmosphere_component.get_component_property_value(
  265. AtomComponentProperties.sky_atmosphere('Mie absorption')) == Vector3(0.5,0.0,0.5))
  266. # 13. Set a value for 'Mie exponential distribution' property
  267. sky_atmosphere_component.set_component_property_value(
  268. AtomComponentProperties.sky_atmosphere('Mie exponential distribution'), 400.0)
  269. Report.result(
  270. Tests.mie_exponential_distribution,
  271. sky_atmosphere_component.get_component_property_value(
  272. AtomComponentProperties.sky_atmosphere('Mie exponential distribution')) == 400.0)
  273. # 14. Set a value for 'Mie scattering Scale' property
  274. sky_atmosphere_component.set_component_property_value(
  275. AtomComponentProperties.sky_atmosphere('Mie scattering scale'), 1.0)
  276. Report.result(
  277. Tests.mie_scattering_scale,
  278. sky_atmosphere_component.get_component_property_value(
  279. AtomComponentProperties.sky_atmosphere('Mie scattering scale')) == 1.0)
  280. # 15. Set a value for 'Mie scattering' property
  281. sky_atmosphere_component.set_component_property_value(
  282. AtomComponentProperties.sky_atmosphere('Mie scattering'), Vector3(1.0,0.0,0.0))
  283. Report.result(
  284. Tests.mie_scattering,
  285. sky_atmosphere_component.get_component_property_value(
  286. AtomComponentProperties.sky_atmosphere('Mie scattering')) == Vector3(1.0,0.0,0.0))
  287. # 16. Set a value for 'Ozone Absorption Scale' property
  288. sky_atmosphere_component.set_component_property_value(
  289. AtomComponentProperties.sky_atmosphere('Ozone absorption scale'), 1.0)
  290. Report.result(
  291. Tests.ozone_absorption_scale,
  292. sky_atmosphere_component.get_component_property_value(
  293. AtomComponentProperties.sky_atmosphere('Ozone absorption scale')) == 1.0)
  294. # 17. Set a value for 'Ozone Absorption' property
  295. sky_atmosphere_component.set_component_property_value(
  296. AtomComponentProperties.sky_atmosphere('Ozone absorption'), Vector3(0.5,0.5,0.0))
  297. Report.result(
  298. Tests.ozone_absorption,
  299. sky_atmosphere_component.get_component_property_value(
  300. AtomComponentProperties.sky_atmosphere('Ozone absorption')) == Vector3(0.5,0.5,0.0))
  301. # 18. Set a value for 'Rayleigh exponential distribution' property
  302. sky_atmosphere_component.set_component_property_value(
  303. AtomComponentProperties.sky_atmosphere('Rayleigh exponential distribution'), 400.0)
  304. Report.result(
  305. Tests.rayleigh_exponential_distribution,
  306. sky_atmosphere_component.get_component_property_value(
  307. AtomComponentProperties.sky_atmosphere('Rayleigh exponential distribution')) == 400.0)
  308. # 19. Set a value for 'Rayleigh scattering Scale' property
  309. sky_atmosphere_component.set_component_property_value(
  310. AtomComponentProperties.sky_atmosphere('Rayleigh scattering scale'), 1.0)
  311. Report.result(
  312. Tests.rayleigh_scattering_scale,
  313. sky_atmosphere_component.get_component_property_value(
  314. AtomComponentProperties.sky_atmosphere('Rayleigh scattering scale')) == 1.0)
  315. # 20. Set a value for 'Rayleigh scattering' property
  316. sky_atmosphere_component.set_component_property_value(
  317. AtomComponentProperties.sky_atmosphere('Rayleigh scattering'), Vector3(1.0,1.0,1.0))
  318. Report.result(
  319. Tests.rayleigh_scattering,
  320. sky_atmosphere_component.get_component_property_value(
  321. AtomComponentProperties.sky_atmosphere('Rayleigh scattering')) == Vector3(1.0,1.0,1.0))
  322. # 21. Set a value for 'Show sun' property
  323. sky_atmosphere_component.set_component_property_value(
  324. AtomComponentProperties.sky_atmosphere('Show sun'), False)
  325. Report.result(
  326. Tests.show_sun,
  327. sky_atmosphere_component.get_component_property_value(
  328. AtomComponentProperties.sky_atmosphere('Show sun')) is False)
  329. sky_atmosphere_component.set_component_property_value(
  330. AtomComponentProperties.sky_atmosphere('Show sun'), True)
  331. Report.result(
  332. Tests.show_sun,
  333. sky_atmosphere_component.get_component_property_value(
  334. AtomComponentProperties.sky_atmosphere('Show sun')) is True)
  335. # 22. Set a value for 'Sun color' property
  336. sky_atmosphere_component.set_component_property_value(
  337. AtomComponentProperties.sky_atmosphere('Sun color'), Color(0.0,0.0,0.0,255.0))
  338. Report.result(
  339. Tests.sun_color,
  340. sky_atmosphere_component.get_component_property_value(
  341. AtomComponentProperties.sky_atmosphere('Sun color')) == Color(0.0,0.0,0.0,255.0))
  342. # 23. Set a value for 'Sun falloff factor' property
  343. sky_atmosphere_component.set_component_property_value(
  344. AtomComponentProperties.sky_atmosphere('Sun falloff factor'), 200.0)
  345. Report.result(
  346. Tests.sun_falloff_factor,
  347. sky_atmosphere_component.get_component_property_value(
  348. AtomComponentProperties.sky_atmosphere('Sun falloff factor')) == 200.0)
  349. # 24. Set a value for 'Sun limb color' property
  350. sky_atmosphere_component.set_component_property_value(
  351. AtomComponentProperties.sky_atmosphere('Sun limb color'), Color(0.0,0.0,0.0,255.0))
  352. Report.result(
  353. Tests.sun_limb_color,
  354. sky_atmosphere_component.get_component_property_value(
  355. AtomComponentProperties.sky_atmosphere('Sun limb color')) == Color(0.0,0.0,0.0,255.0))
  356. # 25. Set a value for 'Sun luminance factor' property
  357. sky_atmosphere_component.set_component_property_value(
  358. AtomComponentProperties.sky_atmosphere('Sun luminance factor'), 100000.0)
  359. Report.result(
  360. Tests.sun_luminance_factor,
  361. sky_atmosphere_component.get_component_property_value(
  362. AtomComponentProperties.sky_atmosphere('Sun luminance factor')) == 100000.0)
  363. # 26. Set a value for 'Sun orientation' property
  364. sun_entity = EditorEntity.create_editor_entity_at((10.0,0.0,0.0), name='Sun')
  365. sky_atmosphere_component.set_component_property_value(
  366. AtomComponentProperties.sky_atmosphere('Sun orientation'), sun_entity.id)
  367. Report.result(
  368. Tests.sun_orientation,
  369. sky_atmosphere_component.get_component_property_value(
  370. AtomComponentProperties.sky_atmosphere('Sun orientation')) == sun_entity.id)
  371. # 27. Set a value for 'Sun radius factor' property
  372. sky_atmosphere_component.set_component_property_value(
  373. AtomComponentProperties.sky_atmosphere('Sun radius factor'), 100.0)
  374. Report.result(
  375. Tests.sun_radius_factor,
  376. sky_atmosphere_component.get_component_property_value(
  377. AtomComponentProperties.sky_atmosphere('Sun radius factor')) == 100.0)
  378. # 28. Set a value for 'Enable shadows' property
  379. sky_atmosphere_component.set_component_property_value(
  380. AtomComponentProperties.sky_atmosphere('Enable shadows'), True)
  381. Report.result(
  382. Tests.enable_shadows,
  383. sky_atmosphere_component.get_component_property_value(
  384. AtomComponentProperties.sky_atmosphere('Enable shadows')) is True)
  385. sky_atmosphere_component.set_component_property_value(
  386. AtomComponentProperties.sky_atmosphere('Enable shadows'), False)
  387. Report.result(
  388. Tests.enable_shadows,
  389. sky_atmosphere_component.get_component_property_value(
  390. AtomComponentProperties.sky_atmosphere('Enable shadows')) is False)
  391. # 29. Set a value for 'Fast sky' property
  392. sky_atmosphere_component.set_component_property_value(
  393. AtomComponentProperties.sky_atmosphere('Fast sky'), False)
  394. Report.result(
  395. Tests.fast_sky,
  396. sky_atmosphere_component.get_component_property_value(
  397. AtomComponentProperties.sky_atmosphere('Fast sky')) is False)
  398. sky_atmosphere_component.set_component_property_value(
  399. AtomComponentProperties.sky_atmosphere('Fast sky'), True)
  400. Report.result(
  401. Tests.fast_sky,
  402. sky_atmosphere_component.get_component_property_value(
  403. AtomComponentProperties.sky_atmosphere('Fast sky')) is True)
  404. # 30. Set a value for 'Max samples' property
  405. sky_atmosphere_component.set_component_property_value(
  406. AtomComponentProperties.sky_atmosphere('Max samples'), 64)
  407. Report.result(
  408. Tests.max_samples,
  409. sky_atmosphere_component.get_component_property_value(
  410. AtomComponentProperties.sky_atmosphere('Max samples')) == 64)
  411. # 31. Set a value for 'Min samples' property
  412. sky_atmosphere_component.set_component_property_value(
  413. AtomComponentProperties.sky_atmosphere('Min samples'), 64)
  414. Report.result(
  415. Tests.min_samples,
  416. sky_atmosphere_component.get_component_property_value(
  417. AtomComponentProperties.sky_atmosphere('Min samples')) == 64)
  418. # 32. Set a value for 'Near Clip' property
  419. sky_atmosphere_component.set_component_property_value(
  420. AtomComponentProperties.sky_atmosphere('Near clip'), 10.0)
  421. Report.result(
  422. Tests.near_clip,
  423. sky_atmosphere_component.get_component_property_value(
  424. AtomComponentProperties.sky_atmosphere('Near clip')) == 10.0)
  425. # 33. Set a value for 'Near Fade Distance' property
  426. sky_atmosphere_component.set_component_property_value(
  427. AtomComponentProperties.sky_atmosphere('Near fade distance'), 20.0)
  428. Report.result(
  429. Tests.near_fade_distance,
  430. sky_atmosphere_component.get_component_property_value(
  431. AtomComponentProperties.sky_atmosphere('Near fade distance')) == 20.0)
  432. # 34. Enter/Exit game mode.
  433. TestHelper.enter_game_mode(Tests.enter_game_mode)
  434. PrefabWaiter.wait_for_propagation()
  435. TestHelper.exit_game_mode(Tests.exit_game_mode)
  436. # 35. Test IsHidden.
  437. sky_atmosphere_entity.set_visibility_state(False)
  438. Report.result(Tests.is_hidden, sky_atmosphere_entity.is_hidden() is True)
  439. # 36. Test IsVisible.
  440. sky_atmosphere_entity.set_visibility_state(True)
  441. PrefabWaiter.wait_for_propagation()
  442. Report.result(Tests.is_visible, sky_atmosphere_entity.is_visible() is True)
  443. # 37. Delete Sky Atmosphere entity.
  444. sky_atmosphere_entity.delete()
  445. PrefabWaiter.wait_for_propagation()
  446. Report.result(Tests.entity_deleted, not sky_atmosphere_entity.exists())
  447. # 38. UNDO deletion.
  448. general.undo()
  449. PrefabWaiter.wait_for_propagation()
  450. Report.result(Tests.deletion_undo, sky_atmosphere_entity.exists())
  451. # 39. REDO deletion.
  452. general.redo()
  453. PrefabWaiter.wait_for_propagation()
  454. Report.result(Tests.deletion_redo, not sky_atmosphere_entity.exists())
  455. # 40. Look for errors and asserts.
  456. TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
  457. for error_info in error_tracer.errors:
  458. Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
  459. for assert_info in error_tracer.asserts:
  460. Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
  461. if __name__ == "__main__":
  462. from editor_python_test_tools.utils import Report
  463. Report.start_test(AtomEditorComponents_SkyAtmosphere_AddedToEntity)