pyside_auto_menubar_test.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #
  7. # This is a pytest module to test the basic integration of PySide2 (aka Qt for Python)
  8. #
  9. import pytest
  10. import time
  11. import logging
  12. import os
  13. import shutil
  14. from test_tools import WINDOWS_LAUNCHER
  15. import test_tools.shared.log_monitor
  16. import test_tools.launchers.phase
  17. import test_tools.builtin.fixtures as fixtures
  18. # Use the built-in workspace and editor fixtures.
  19. # These will configure the requested project and run the editor.
  20. workspace = fixtures.use_fixture(fixtures.builtin_workspace_fixture, scope='function')
  21. editor = fixtures.use_fixture(fixtures.editor, scope='function')
  22. logger = logging.getLogger(__name__)
  23. @pytest.mark.parametrize("platform,configuration,project,spec", [
  24. pytest.param("win_x64_vs2017", "profile", "AutomatedTesting", "all", marks=pytest.mark.skipif(not WINDOWS_LAUNCHER, reason="Only supported on Windows hosts")),
  25. ])
  26. class TestEditorMenuBarAutomation(object):
  27. def test_MenuBar(self, request, editor, project):
  28. logger.debug("Running automated test")
  29. request.addfinalizer(editor.ensure_stopped)
  30. editor.deploy()
  31. editor.launch(["--runpython", "@engroot@/Gems/QtForPython/Code/Tests/pyside_auto_menubar_test_case.py"])
  32. editorlog_file = os.path.join(editor.workspace.release.paths.project_log(), 'Editor.log')
  33. expected_lines = [
  34. "QtForPython Is Ready",
  35. "Value allWindows greater than zero",
  36. "GetMainWindowId",
  37. "Get QtWidgets.QMainWindow",
  38. "Value menuBar is valid",
  39. "Found File action",
  40. "Found Edit action",
  41. "Found Game action",
  42. "Found Tools action"
  43. ]
  44. test_tools.shared.log_monitor.monitor_for_expected_lines(editor, editorlog_file, expected_lines)
  45. # Rely on the test script to quit after running
  46. editor.run(test_tools.launchers.phase.WaitForLauncherToQuit(editor, 10))